Skip to content

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