Skip to content

Commit

Permalink
set pull policy as default for mgrpxy upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mbussolotto committed Apr 18, 2024
1 parent e5b991a commit 45297c6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mgrpxy/cmd/upgrade/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NOTE: for now upgrading on a remote kubernetes cluster is not supported!
},
}

pxy_utils.AddImageFlags(cmd)
pxy_utils.AddImageUpgradeFlags(cmd)

kubernetes.AddHelmFlags(cmd)

Expand Down
2 changes: 1 addition & 1 deletion mgrpxy/cmd/upgrade/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ NOTE: for now upgrading on a remote podman is not supported!
},
}

utils.AddImageFlags(podmanCmd)
utils.AddImageUpgradeFlags(podmanCmd)

return podmanCmd
}
16 changes: 15 additions & 1 deletion mgrpxy/shared/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (f *ProxyImageFlags) GetContainerImage(name string) string {
return imageUrl
}

// AddImageFlags will add the proxy install flags to a command.
// AddImageFlags will add the proxy image flags to a command.
func AddImageFlags(cmd *cobra.Command) {
cmd.Flags().String("imagesLocation", utils.DefaultNamespace,
L("registry URL prefix containing the all the container images"))
Expand All @@ -78,6 +78,20 @@ func AddImageFlags(cmd *cobra.Command) {
addContainerImageFlags(cmd, "tftpd")
}

// AddImageUpgradeFlags will add the proxy image flags to an upgrade command.
func AddImageUpgradeFlags(cmd *cobra.Command) {
cmd.Flags().String("imagesLocation", utils.DefaultNamespace,
L("registry URL prefix containing the all the container images"))
cmd.Flags().String("tag", utils.DefaultTag, L("image tag"))
cmd.Flags().String("pullPolicy", "Always",
L("set whether to pull the images or not during upgrade. The value can be one of 'Never', 'IfNotPresent' or 'Always'"))

addContainerImageFlags(cmd, "httpd")
addContainerImageFlags(cmd, "saltBroker")
addContainerImageFlags(cmd, "squid")
addContainerImageFlags(cmd, "ssh")
addContainerImageFlags(cmd, "tftpd")
}
func addContainerImageFlags(cmd *cobra.Command, container string) {
cmd.Flags().String(container+"-image", "",
fmt.Sprintf(L("Image for %s container, overrides the namespace if set"), container))
Expand Down

0 comments on commit 45297c6

Please sign in to comment.