Skip to content
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: Support set image operation for sidecarsets #72

Merged
merged 2 commits into from
Mar 3, 2023

Conversation

chengleqi
Copy link
Contributor

@chengleqi chengleqi commented Feb 28, 2023

Result

User can use kubectl kruise set image sidecarsets/test-sidecarset sidecar1=debian:11

Fix Issue

Fix: openkruise/kruise#1106

Change

  • pkg/internal/polymorphichelpers/updatepodspec.go: Add a kruiseappsv1alpha1.SidecarSet branch.
  • pkg/cmd/set/set_image.go: Check if it is kruiseappsv1alpha1.SidecarSet type then use setSideCarImage function which is similar with setImage.
  • pkg/cmd/set/set_image_test.go: Add unit test

@kruise-bot
Copy link

Welcome @chengleqi! It looks like this is your first PR to openkruise/kruise-tools 🎉

Signed-off-by: chengleqi <chengleqi5g@hotmail.com>
Copy link
Member

@hantmac hantmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/LGTM 🚀

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hantmac

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: chengleqi <chengleqi5g@hotmail.com>
@chengleqi
Copy link
Contributor Author

/hold sorry @hantmac I found a typo.

@chengleqi chengleqi requested review from hantmac and removed request for FillZpp March 1, 2023 04:55
},
},
groupVersion: corev1.SchemeGroupVersion,
path: "/namespaces/test/sidecarsets/nginx",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since sidecarset is a cluster scoped resource, i doubt whether the path test is valid here

Copy link
Contributor Author

@chengleqi chengleqi Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the SidecarSet is a cluster-wide resource, it is defined across all namespaces and can be operated on by all namespaces, even the namespaces does not exist.

This can work

# dummy-ns do not existed
[root@zone-a code]# kubectl get sidecarset -n dummy-ns
NAME              MATCHED   UPDATED   READY   AGE
test-sidecarset   1         1         1       28m

This also can work

# dummy-ns do not existed
kubectl kruise set image sidecarsets/test-sidecarset sidecar1=debian:11 -n dummy-ns
# output sidecarset.apps.kruise.io/test-sidecarset image updated

So I think the namespace is not important for cluster-scoped resources, and the only identifier that can distinguish cluster-scoped resources is their name.

Copy link
Member

@furykerry furykerry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@kruise-bot kruise-bot added the lgtm label Mar 2, 2023
@hantmac hantmac merged commit debf778 into openkruise:master Mar 3, 2023
@chengleqi chengleqi deleted the issue-1106 branch March 3, 2023 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Cannot set the image of the SidecarSet with the kubectl set command
4 participants