Skip to content

Commit 4e057d7

Browse files
committed
Set image pull policy.
1 parent b429fca commit 4e057d7

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

pkg/util/options/options.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ type Options struct {
5656
JobCompleteSuccessGraceTime time.Duration
5757
}
5858

59+
type pullpolicy v1.PullPolicy
60+
61+
func (pp *pullpolicy) String() string {
62+
return string(*pp)
63+
}
64+
65+
func (pp *pullpolicy) Set(value string) error {
66+
*pp = pullpolicy(value)
67+
return nil
68+
}
69+
70+
func (pp *pullpolicy) Type() string {
71+
return "v1.PullPolicy"
72+
}
73+
74+
func newPullPolicyValue(defaultValue v1.PullPolicy, v *v1.PullPolicy) *pullpolicy {
75+
*v = defaultValue
76+
return (*pullpolicy)(v)
77+
}
78+
5979
const (
6080
defaultMysqlImage = "percona:5.7"
6181
defaultExporterImage = "prom/mysqld-exporter:latest"
@@ -78,8 +98,12 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
7898
"The image that instrumentate mysql.")
7999
fs.StringVar(&o.MetricsExporterImage, "metrics-exporter-image", defaultExporterImage,
80100
"The image for mysql metrics exporter.")
81-
fs.StringVar(&o.ImagePullSecretName, "pull-secret", "",
101+
fs.StringVar(&o.ImagePullSecretName, "image-pull-secret", "",
82102
"The secret name for used as pull secret.")
103+
104+
fs.VarP(newPullPolicyValue(defaultImagePullPolicy, &o.ImagePullPolicy),
105+
"image-pull-policy", "", "Set image pull policy.")
106+
83107
fs.StringVar(&o.OrchestratorUri, "orchestrator-uri", "",
84108
"The orchestrator uri")
85109
fs.StringVar(&o.OrchestratorTopologyPassword, "orchestrator-topology-password", defaultOrchestratorTopologyUser,

0 commit comments

Comments
 (0)