feat: add 'imagePullPolicy' parameter for 'goctl kube deploy' (#1996)
This commit is contained in:
@@ -22,6 +22,7 @@ var (
|
|||||||
varStringRemote string
|
varStringRemote string
|
||||||
varStringBranch string
|
varStringBranch string
|
||||||
varStringServiceAccount string
|
varStringServiceAccount string
|
||||||
|
varStringImagePullPolicy string
|
||||||
|
|
||||||
// Cmd describes a kube command.
|
// Cmd describes a kube command.
|
||||||
Cmd = &cobra.Command{
|
Cmd = &cobra.Command{
|
||||||
@@ -52,6 +53,7 @@ func init() {
|
|||||||
deployCmd.Flags().IntVar(&varIntNodePort, "nodePort", 0, "The nodePort of the deployment to expose")
|
deployCmd.Flags().IntVar(&varIntNodePort, "nodePort", 0, "The nodePort of the deployment to expose")
|
||||||
deployCmd.Flags().IntVar(&varIntMinReplicas, "minReplicas", 3, "The min replicas to deploy")
|
deployCmd.Flags().IntVar(&varIntMinReplicas, "minReplicas", 3, "The min replicas to deploy")
|
||||||
deployCmd.Flags().IntVar(&varIntMaxReplicas, "maxReplicas", 10, "The max replicas to deploy")
|
deployCmd.Flags().IntVar(&varIntMaxReplicas, "maxReplicas", 10, "The max replicas to deploy")
|
||||||
|
deployCmd.Flags().StringVar(&varStringImagePullPolicy, "imagePullPolicy", "", "Image pull policy. One of Always, Never, IfNotPresent")
|
||||||
|
|
||||||
deployCmd.Flags().StringVar(&varStringHome, "home", "", "The goctl home path of the template, "+
|
deployCmd.Flags().StringVar(&varStringHome, "home", "", "The goctl home path of the template, "+
|
||||||
"--home and --remote cannot be set at the same time, if they are, --remote has higher priority")
|
"--home and --remote cannot be set at the same time, if they are, --remote has higher priority")
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: {{.Name}}
|
- name: {{.Name}}
|
||||||
image: {{.Image}}
|
image: {{.Image}}
|
||||||
lifecycle:
|
{{if .ImagePullPolicy}}imagePullPolicy: {{.ImagePullPolicy}}
|
||||||
|
{{end}}lifecycle:
|
||||||
preStop:
|
preStop:
|
||||||
exec:
|
exec:
|
||||||
command: ["sh","-c","sleep 5"]
|
command: ["sh","-c","sleep 5"]
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ type Deployment struct {
|
|||||||
MinReplicas int
|
MinReplicas int
|
||||||
MaxReplicas int
|
MaxReplicas int
|
||||||
ServiceAccount string
|
ServiceAccount string
|
||||||
|
ImagePullPolicy string
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeploymentCommand is used to generate the kubernetes deployment yaml files.
|
// DeploymentCommand is used to generate the kubernetes deployment yaml files.
|
||||||
@@ -98,6 +99,7 @@ func deploymentCommand(_ *cobra.Command, _ []string) error {
|
|||||||
MinReplicas: varIntMinReplicas,
|
MinReplicas: varIntMinReplicas,
|
||||||
MaxReplicas: varIntMaxReplicas,
|
MaxReplicas: varIntMaxReplicas,
|
||||||
ServiceAccount: varStringServiceAccount,
|
ServiceAccount: varStringServiceAccount,
|
||||||
|
ImagePullPolicy: varStringImagePullPolicy,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user