Remove default image from yaml, fix empty images warning

Signed-off-by: Ling Samuel <lingsamuelgrace@gmail.com>
pull/10111/head
Ling Samuel 2021-01-08 14:51:52 +08:00
parent a49d91524b
commit 7b2d1a6838
No known key found for this signature in database
GPG Key ID: 1405A670863B367F
2 changed files with 14 additions and 12 deletions

View File

@ -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:
@ -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
@ -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

View File

@ -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