Skip to content

Commit 18331dc

Browse files
committed
Added a global variable for corev1.PullPolicy in modules pkg and made mg
dev up set this to Always for iteration with mg dev.
1 parent 9513a70 commit 18331dc

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

mg/cmd/dev.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/laetho/metagraf/pkg/modules"
2828
"github.com/spf13/cobra"
2929
"github.com/spf13/viper"
30+
corev1 "k8s.io/api/core/v1"
3031
log "k8s.io/klog"
3132
)
3233

@@ -51,6 +52,7 @@ func init() {
5152
devCmdUp.Flags().Int32Var(&params.ServiceMonitorPort, "service-monitor-port", params.ServiceMonitorPort, "Set Service port to scrape in ServiceMonitor.")
5253
devCmdUp.Flags().StringVar(&params.ServiceMonitorOperatorName, "service-monitor-operator-name", params.ServiceMonitorOperatorName, "Name of prometheus-operator instance to create ServiceMonitor for.")
5354

55+
5456
devCmd.AddCommand(devCmdDown)
5557
devCmdDown.Flags().StringVarP(&params.NameSpace, "namespace", "n", "", "namespace to work on, if not supplied it will use current active namespace.")
5658
devCmdDown.Flags().BoolVar(&params.Everything, "everything", false, "Delete all resources and artifacts generated from mg dev up.")
@@ -138,6 +140,7 @@ func devUp(mgf string) {
138140
modules.Variables = GetCmdProperties(mg.GetProperties())
139141
log.V(2).Info("Current MGProperties: ", modules.Variables)
140142

143+
modules.PullPolicy = corev1.PullAlways
141144
modules.GenSecrets(&mg)
142145
modules.GenConfigMaps(&mg)
143146
modules.GenImageStream(&mg, params.NameSpace)

pkg/modules/common.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ var (
4949
OName string
5050
Context string // Application context root from FlagPassingHack.
5151
CreateGlobals bool
52+
// Sets the default pull policy for all metagraf modules
53+
PullPolicy corev1.PullPolicy = corev1.PullIfNotPresent
5254
)
5355

5456
var Variables metagraf.MGProperties

pkg/modules/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func GenDeployment(mg *metagraf.MetaGraf, namespace string) {
130130
Container := corev1.Container{
131131
Name: objname,
132132
Image: imageRef(mg),
133-
ImagePullPolicy: corev1.PullIfNotPresent,
133+
ImagePullPolicy: PullPolicy,
134134
Ports: ContainerPorts,
135135
VolumeMounts: VolumeMounts,
136136
Env: EnvVars,

pkg/modules/deploymentconfig.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func GenDeploymentConfig(mg *metagraf.MetaGraf) {
142142
Container := corev1.Container{
143143
Name: objname,
144144
Image: imageRef(mg),
145-
ImagePullPolicy: corev1.PullIfNotPresent,
145+
ImagePullPolicy: PullPolicy,
146146
Ports: ContainerPorts,
147147
VolumeMounts: VolumeMounts,
148148
Env: EnvVars,

0 commit comments

Comments
 (0)