-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(components): Added Kubernetes CRUD operations #5239
feat(components): Added Kubernetes CRUD operations #5239
Conversation
object_path=$0 | ||
output_name_path=$1 | ||
output_kind_path=$2 | ||
output_object_path=$3 | ||
mkdir -p "$(dirname "$output_name_path")" | ||
mkdir -p "$(dirname "$output_kind_path")" | ||
mkdir -p "$(dirname "$output_object_path")" | ||
|
||
kubectl apply -f "$object_path" --output=json > "$output_object_path" | ||
|
||
< "$output_object_path" jq '.metadata.name' --raw-output > "$output_name_path" | ||
< "$output_object_path" jq '.kind' --raw-output > "$output_kind_path" | ||
|
||
- {inputPath: Object} | ||
- {outputPath: Name} | ||
- {outputPath: Kind} | ||
- {outputPath: Object} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between create
and apply
objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference is pretty small. Create always tries to create a new object and fails when it already exists.
Apply patches or replaces an object if it exists. Create supports auto-generating object names (generateName
), but apply does not.
I'm adding both for the sake of completeness. There is a long-term plan to replace or retrofit kfp.dsl.ResourceOp
with these components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Alexey! Do we plan to support generateName
for Create, and fails if already exists in current PR? Or as you mentioned, it is for future plan?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generateName
is supported as part of the Kubernetes object passed to the Object
input.
If you pass structure that has:
...
metadata:
generateName: "some-prefix-"
...
to the "Create Kubernetes object" component, which calls kubectl create
then the object name would be generated by Kubernetes and returned from the component.
If you pass that to the "Apply Kubernetes object" component, then kubectl
will fail and the component will fail as it should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thank you Alexey!
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Ark-kun, zijianjoy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
No description provided.