-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Add 'kubectl set image' #25509
Add 'kubectl set image' #25509
Conversation
The main disadvantage of not using flags is that it makes supporting multiple resources impossible. |
cab5663
to
191ca7d
Compare
Why? Current implementation supports setting images of multiple resources. For example, $ kubectl set image rc,deployment redis=redis --all
replicationcontroller "frontend" image updated
deployment "nginx-deployment" image updated |
191ca7d
to
ba3993d
Compare
Per in-person discussion with @bgrant0607:
|
0c38f00
to
a5b69a0
Compare
kube::test::get_object_assert deployment "{{range.items}}{{$id_field}}:{{end}}" 'nginx-deployment:' | ||
kube::test::get_object_assert deployment "{{range.items}}{{$deployment_image_field}}:{{end}}" "${IMAGE_DEPLOYMENT_R1}:" | ||
# Set the deployment's image | ||
kubectl set image deployment nginx-deployment nginx="${IMAGE_DEPLOYMENT_R2}" "${kube_flags[@]}" |
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.
Should add a test for wildcard.
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's the expected behavior for wildcard? Wildcard in key (container name) or value (container image) or resource name?
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.
This was wildcard for container name so you could set image on every container in the pod. Just key I think.
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.
Added wildcard support and added test
a5b69a0
to
5899e76
Compare
@smarterclayton PTAL |
5899e76
to
2c49680
Compare
} | ||
|
||
func hasWildcardKey(containerImages map[string]string) bool { | ||
for k := range containerImages { |
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.
You don't need to traverse a map for a key, do you?
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.
Oops, you're right. Fixed
I had no more comments |
squash down and this lgtm |
b92b937
to
28a111e
Compare
Squashed. Thanks! |
28a111e
to
4332472
Compare
Bumping up priority from fixing test flakes #25756 |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit 4332472. |
Automatic merge from submit-queue |
Usage:
Example:
I abandoned the
--container=xxx --image=xxx
flags in the deploy proposal since it's much easier to use with just KEY=VALUE (CONTAINER_NAME=CONTAINER_IMAGE) pairs.Ref #21648
@kubernetes/kubectl @bgrant0607 @kubernetes/sig-config