Skip to content

Commit

Permalink
Remove default image from yaml, fix empty images warning
Browse files Browse the repository at this point in the history
Signed-off-by: Ling Samuel <[email protected]>
  • Loading branch information
lingsamuel committed Jan 8, 2021
1 parent 51246ac commit 0b19a59
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions deploy/addons/ingress/ingress-dp.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
serviceAccountName: ingress-nginx
containers:
- name: controller
image: {{default "us.gcr.io/k8s-artifacts-prod" .ImageRepository}}/{{default "ingress-nginx/controller:v0.40.2" .Images.IngressController}}
image: {{default "us.gcr.io/k8s-artifacts-prod" .ImageRepository}}/{{.Images.IngressController}}
imagePullPolicy: IfNotPresent
lifecycle:
preStop:
Expand Down Expand Up @@ -220,7 +220,7 @@ spec:
spec:
containers:
- name: create
image: {{default "jettech" .ImageRepository}}/{{default "kube-webhook-certgen:v1.2.2" .Images.KubeWebhookCertgenCreate}}
image: {{default "jettech" .ImageRepository}}/{{.Images.KubeWebhookCertgenCreate}}
imagePullPolicy: IfNotPresent
args:
- create
Expand Down Expand Up @@ -255,7 +255,7 @@ spec:
spec:
containers:
- name: patch
image: {{default "jettech" .ImageRepository}}/{{default "kube-webhook-certgen:v1.3.0" .Images.KubeWebhookCertgenPatch}}
image: {{default "jettech" .ImageRepository}}/{{.Images.KubeWebhookCertgenPatch}}
imagePullPolicy:
args:
- patch
Expand Down
20 changes: 11 additions & 9 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,18 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig) interface{}
}

images := viper.GetString(config.AddonImages)
for _, image := range strings.Split(images, ",") {
vals := strings.Split(image, "=")
if len(vals) != 2 {
out.WarningT("Ignoring invalid custom image {{.conf}}", out.V{"conf": image})
continue
if images != "" {
for _, image := range strings.Split(images, ",") {
vals := strings.Split(image, "=")
if len(vals) != 2 {
out.WarningT("Ignoring invalid custom image {{.conf}}", out.V{"conf": image})
continue
}
if defaultImage, ok := opts.Images[vals[0]]; ok {
out.Infof("Using {{.image}} instead default image {{.default}}", out.V{"image": vals[1], "name": defaultImage})
}
opts.Images[vals[0]] = vals[1]
}
if defaultImage, ok := opts.Images[vals[0]]; ok {
out.Infof("Using {{.image}} instead default image {{.default}}", out.V{"image": vals[1], "name": defaultImage})
}
opts.Images[vals[0]] = vals[1]
}

return opts
Expand Down

0 comments on commit 0b19a59

Please sign in to comment.