Skip to content

fix: set-image with more matching rules #909

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

zyy98
Copy link
Contributor

@zyy98 zyy98 commented Aug 30, 2022

to fix issue kptdev/kpt#3444
provide containerName and imageName as input, support containerName matching, support imageName omission inside input

Comment on lines +201 to 210
// getContainers gets the containers inside kubeObject
func getContainers(o *fn.KubeObject) fn.SliceSubObjects {
switch o.GetKind() {
case "Pod":
return getPodContainers(o)
case "Deployment", "StatefulSet", "ReplicaSet", "DaemonSet", "PodTemplate":
return getPodSpecContainers(o)
}
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

suggest adding it back to the main Run method. This part belongs to the main logic so it's better to be replaced in the main function

Copy link
Contributor Author

@zyy98 zyy98 Aug 31, 2022

Choose a reason for hiding this comment

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

Run method already uses this function getContianers, I have this as a separate function because I feel I need to iterate containers twice, once for validating user input if image name is not provided, once for update container images. To reduce code duplication, I have this function here.

@zyy98 zyy98 requested a review from yuwenma August 31, 2022 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants