Addon custom registry:

* fix missing suffix when using global image repo
* support override global image repo
* change all imagePullPolicy to IfNotPresent
* fix empty global image repo suffix

Signed-off-by: Ling Samuel <lingsamuelgrace@gmail.com>
pull/10111/head
Ling Samuel 2021-01-13 12:01:37 +08:00
parent c9f4cb8388
commit 101d39fc51
No known key found for this signature in database
GPG Key ID: 1405A670863B367F
36 changed files with 88 additions and 61 deletions

View File

@ -74,7 +74,7 @@ var (
) )
func init() { func init() {
addonsEnableCmd.Flags().StringVar(&images, "images", "", "Images used by this addon. Divided by comma.") addonsEnableCmd.Flags().StringVar(&images, "images", "", "Images used by this addon. Separated by commas.")
addonsEnableCmd.Flags().StringVar(&registries, "registries", "", "Registries used by this addon. Divided by comma.") addonsEnableCmd.Flags().StringVar(&registries, "registries", "", "Registries used by this addon. Separated by commas.")
AddonsCmd.AddCommand(addonsEnableCmd) AddonsCmd.AddCommand(addonsEnableCmd)
} }

View File

@ -180,10 +180,10 @@ spec:
containers: containers:
- name: ambassador-operator - name: ambassador-operator
# Replace this with the built image name # Replace this with the built image name
image: {{default .Registries.AmbassadorOperator .ImageRepository}}{{.Images.AmbassadorOperator}} image: {{.CustomRegistries.AmbassadorOperator | default .ImageRepository | default .Registries.AmbassadorOperator }}{{.Images.AmbassadorOperator}}
command: command:
- ambassador-operator - ambassador-operator
imagePullPolicy: Always imagePullPolicy: IfNotPresent
env: env:
- name: WATCH_NAMESPACE - name: WATCH_NAMESPACE
valueFrom: valueFrom:

View File

@ -57,7 +57,7 @@ spec:
serviceAccountName: csi-attacher serviceAccountName: csi-attacher
containers: containers:
- name: csi-attacher - name: csi-attacher
image: {{default .Registries.Attacher .ImageRepository}}{{.Images.Attacher}} image: {{.CustomRegistries.Attacher | default .ImageRepository | default .Registries.Attacher }}{{.Images.Attacher}}
args: args:
- --v=5 - --v=5
- --csi-address=/csi/csi.sock - --csi-address=/csi/csi.sock

View File

@ -53,7 +53,7 @@ spec:
spec: spec:
containers: containers:
- name: node-driver-registrar - name: node-driver-registrar
image: {{default .Registries.NodeDriverRegistrar .ImageRepository}}{{.Images.NodeDriverRegistrar}} image: {{.CustomRegistries.NodeDriverRegistrar | default .ImageRepository | default .Registries.NodeDriverRegistrar }}{{.Images.NodeDriverRegistrar}}
args: args:
- --v=5 - --v=5
- --csi-address=/csi/csi.sock - --csi-address=/csi/csi.sock
@ -78,7 +78,7 @@ spec:
name: csi-data-dir name: csi-data-dir
- name: hostpath - name: hostpath
image: {{default .Registries.HostPathPlugin .ImageRepository}}{{.Images.HostPathPlugin}} image: {{.CustomRegistries.HostPathPlugin | default .ImageRepository | default .Registries.HostPathPlugin }}{{.Images.HostPathPlugin}}
args: args:
- "--drivername=hostpath.csi.k8s.io" - "--drivername=hostpath.csi.k8s.io"
- "--v=5" - "--v=5"
@ -123,7 +123,7 @@ spec:
volumeMounts: volumeMounts:
- mountPath: /csi - mountPath: /csi
name: socket-dir name: socket-dir
image: {{default .Registries.LivenessProbe .ImageRepository}}{{.Images.LivenessProbe}} image: {{.CustomRegistries.LivenessProbe | default .ImageRepository | default .Registries.LivenessProbe }}{{.Images.LivenessProbe}}
args: args:
- --csi-address=/csi/csi.sock - --csi-address=/csi/csi.sock
- --health-port=9898 - --health-port=9898

View File

@ -57,7 +57,7 @@ spec:
serviceAccountName: csi-provisioner serviceAccountName: csi-provisioner
containers: containers:
- name: csi-provisioner - name: csi-provisioner
image: {{default .Registries.Provisioner .ImageRepository}}{{.Images.Provisioner}} image: {{.CustomRegistries.Provisioner | default .ImageRepository | default .Registries.Provisioner }}{{.Images.Provisioner}}
args: args:
- -v=5 - -v=5
- --csi-address=/csi/csi.sock - --csi-address=/csi/csi.sock

View File

@ -57,7 +57,7 @@ spec:
serviceAccountName: csi-resizer serviceAccountName: csi-resizer
containers: containers:
- name: csi-resizer - name: csi-resizer
image: {{default .Registries.Resizer .ImageRepository}}{{.Images.Resizer}} image: {{.CustomRegistries.Resizer | default .ImageRepository | default .Registries.Resizer }}{{.Images.Resizer}}
args: args:
- -v=5 - -v=5
- -csi-address=/csi/csi.sock - -csi-address=/csi/csi.sock

View File

@ -57,7 +57,7 @@ spec:
serviceAccount: csi-snapshotter serviceAccount: csi-snapshotter
containers: containers:
- name: csi-snapshotter - name: csi-snapshotter
image: {{default .Registries.Snapshotter .ImageRepository}}{{.Images.Snapshotter}} image: {{.CustomRegistries.Snapshotter | default .ImageRepository | default .Registries.Snapshotter }}{{.Images.Snapshotter}}
args: args:
- -v=5 - -v=5
- --csi-address=/csi/csi.sock - --csi-address=/csi/csi.sock

View File

@ -36,7 +36,7 @@ spec:
spec: spec:
containers: containers:
- name: dashboard-metrics-scraper - name: dashboard-metrics-scraper
image: {{default .Registries.MetricsScraper .ImageRepository}}{{.Images.MetricsScraper}} image: {{.CustomRegistries.MetricsScraper | default .ImageRepository | default .Registries.MetricsScraper }}{{.Images.MetricsScraper}}
ports: ports:
- containerPort: 8000 - containerPort: 8000
protocol: TCP protocol: TCP
@ -91,7 +91,7 @@ spec:
containers: containers:
- name: kubernetes-dashboard - name: kubernetes-dashboard
# WARNING: This must match pkg/minikube/bootstrapper/images/images.go # WARNING: This must match pkg/minikube/bootstrapper/images/images.go
image: {{default .Registries.Dashboard .ImageRepository}}{{.Images.Dashboard}} image: {{.CustomRegistries.Dashboard | default .ImageRepository | default .Registries.Dashboard }}{{.Images.Dashboard}}
ports: ports:
- containerPort: 9090 - containerPort: 9090
protocol: TCP protocol: TCP

View File

@ -34,7 +34,7 @@ spec:
spec: spec:
containers: containers:
- name: elasticsearch-logging - name: elasticsearch-logging
image: {{default .Registries.Elasticsearch .ImageRepository}}{{.Images.Elasticsearch}} image: {{.CustomRegistries.Elasticsearch | default .ImageRepository | default .Registries.Elasticsearch }}{{.Images.Elasticsearch}}
resources: resources:
limits: limits:
cpu: 500m cpu: 500m
@ -62,7 +62,7 @@ spec:
- name: ES_JAVA_OPTS - name: ES_JAVA_OPTS
value: "-Xms1024m -Xmx1024m" value: "-Xms1024m -Xmx1024m"
initContainers: initContainers:
- image: {{default .Registries.Alpine .ImageRepository}}{{.Images.Alpine}} - image: {{.CustomRegistries.Alpine | default .ImageRepository | default .Registries.Alpine }}{{.Images.Alpine}}
command: ["/sbin/sysctl", "-w", "vm.max_map_count=262144"] command: ["/sbin/sysctl", "-w", "vm.max_map_count=262144"]
name: elasticsearch-logging-init name: elasticsearch-logging-init
securityContext: securityContext:

View File

@ -31,7 +31,7 @@ spec:
spec: spec:
containers: containers:
- name: fluentd-es - name: fluentd-es
image: {{default .Registries.FluentdElasticsearch .ImageRepository}}{{.Images.FluentdElasticsearch}} image: {{.CustomRegistries.FluentdElasticsearch | default .ImageRepository | default .Registries.FluentdElasticsearch }}{{.Images.FluentdElasticsearch}}
env: env:
- name: FLUENTD_ARGS - name: FLUENTD_ARGS
value: --no-supervisor -q value: --no-supervisor -q

View File

@ -34,7 +34,7 @@ spec:
spec: spec:
containers: containers:
- name: kibana-logging - name: kibana-logging
image: {{default .Registries.Kibana .ImageRepository}}{{.Images.Kibana}} image: {{.CustomRegistries.Kibana | default .ImageRepository | default .Registries.Kibana }}{{.Images.Kibana}}
resources: resources:
limits: limits:
cpu: 500m cpu: 500m

View File

@ -34,7 +34,7 @@ spec:
spec: spec:
containers: containers:
- name: freshpod - name: freshpod
image: {{default .Registries.FreshPod .ImageRepository}}{{.Images.FreshPod}} image: {{.CustomRegistries.FreshPod | default .ImageRepository | default .Registries.FreshPod }}{{.Images.FreshPod}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
volumeMounts: volumeMounts:
- name: docker - name: docker

View File

@ -68,7 +68,7 @@ spec:
serviceAccountName: minikube-gcp-auth-certs serviceAccountName: minikube-gcp-auth-certs
containers: containers:
- name: create - name: create
image: {{default .Registries.KubeWebhookCertgen .ImageRepository}}{{.Images.KubeWebhookCertgen}} image: {{.CustomRegistries.KubeWebhookCertgen | default .ImageRepository | default .Registries.KubeWebhookCertgen }}{{.Images.KubeWebhookCertgen}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
args: args:
- create - create
@ -94,7 +94,7 @@ spec:
spec: spec:
containers: containers:
- name: gcp-auth - name: gcp-auth
image: {{default .Registries.GCPAuthWebhook .ImageRepository}}{{.Images.GCPAuthWebhook}} image: {{.CustomRegistries.GCPAuthWebhook | default .ImageRepository | default .Registries.GCPAuthWebhook }}{{.Images.GCPAuthWebhook}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8443 - containerPort: 8443
@ -127,7 +127,7 @@ spec:
serviceAccountName: minikube-gcp-auth-certs serviceAccountName: minikube-gcp-auth-certs
containers: containers:
- name: patch - name: patch
image: {{default .Registries.KubeWebhookCertgen .ImageRepository}}{{.Images.KubeWebhookCertgen}} image: {{.CustomRegistries.KubeWebhookCertgen | default .ImageRepository | default .Registries.KubeWebhookCertgen }}{{.Images.KubeWebhookCertgen}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
args: args:
- patch - patch

View File

@ -50,7 +50,7 @@ spec:
hostPath: hostPath:
path: / path: /
initContainers: initContainers:
- image: {{default .Registries.NvidiaDriverInstaller .ImageRepository}}{{.Images.NvidiaDriverInstaller}} - image: {{.CustomRegistries.NvidiaDriverInstaller | default .ImageRepository | default .Registries.NvidiaDriverInstaller }}{{.Images.NvidiaDriverInstaller}}
name: nvidia-driver-installer name: nvidia-driver-installer
resources: resources:
requests: requests:

View File

@ -43,7 +43,7 @@ spec:
hostPath: hostPath:
path: /var/lib/kubelet/device-plugins path: /var/lib/kubelet/device-plugins
containers: containers:
- image: {{default .Registries.NvidiaDevicePlugin .ImageRepository}}{{.Images.NvidiaDevicePlugin}} - image: {{.CustomRegistries.NvidiaDevicePlugin | default .ImageRepository | default .Registries.NvidiaDevicePlugin }}{{.Images.NvidiaDevicePlugin}}
command: ["/usr/bin/nvidia-device-plugin", "-logtostderr"] command: ["/usr/bin/nvidia-device-plugin", "-logtostderr"]
name: nvidia-gpu-device-plugin name: nvidia-gpu-device-plugin
resources: resources:

View File

@ -25,7 +25,7 @@ spec:
hostPID: true hostPID: true
containers: containers:
- name: gvisor - name: gvisor
image: {{default .Registries.GvisorAddon .ImageRepository}}{{.Images.GvisorAddon}} image: {{.CustomRegistries.GvisorAddon | default .ImageRepository | default .Registries.GvisorAddon }}{{.Images.GvisorAddon}}
securityContext: securityContext:
privileged: true privileged: true
volumeMounts: volumeMounts:

View File

@ -46,7 +46,7 @@ spec:
value: kube-system value: kube-system
- name: TILLER_HISTORY_MAX - name: TILLER_HISTORY_MAX
value: "0" value: "0"
image: {{default .Registries.Tiller .ImageRepository}}{{.Images.Tiller}} image: {{.CustomRegistries.Tiller | default .ImageRepository | default .Registries.Tiller }}{{.Images.Tiller}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
livenessProbe: livenessProbe:
failureThreshold: 3 failureThreshold: 3

View File

@ -80,7 +80,7 @@ spec:
hostNetwork: true hostNetwork: true
containers: containers:
- name: minikube-ingress-dns - name: minikube-ingress-dns
image: {{default .Registries.IngressDNS .ImageRepository}}{{.Images.IngressDNS}} image: {{.CustomRegistries.IngressDNS | default .ImageRepository | default .Registries.IngressDNS }}{{.Images.IngressDNS}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 53 - containerPort: 53

View File

@ -49,7 +49,7 @@ spec:
serviceAccountName: ingress-nginx serviceAccountName: ingress-nginx
containers: containers:
- name: controller - name: controller
image: {{default .Registries.IngressController .ImageRepository}}{{.Images.IngressController}} image: {{.CustomRegistries.IngressController | default .ImageRepository | default .Registries.IngressController }}{{.Images.IngressController}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
lifecycle: lifecycle:
preStop: preStop:
@ -220,7 +220,7 @@ spec:
spec: spec:
containers: containers:
- name: create - name: create
image: {{default .Registries.KubeWebhookCertgenCreate .ImageRepository}}{{.Images.KubeWebhookCertgenCreate}} image: {{.CustomRegistries.KubeWebhookCertgenCreate | default .ImageRepository | default .Registries.KubeWebhookCertgenCreate }}{{.Images.KubeWebhookCertgenCreate}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
args: args:
- create - create
@ -255,7 +255,7 @@ spec:
spec: spec:
containers: containers:
- name: patch - name: patch
image: {{default .Registries.KubeWebhookCertgenPatch .ImageRepository}}{{.Images.KubeWebhookCertgenPatch}} image: {{.CustomRegistries.KubeWebhookCertgenPatch | default .ImageRepository | default .Registries.KubeWebhookCertgenPatch }}{{.Images.KubeWebhookCertgenPatch}}
imagePullPolicy: imagePullPolicy:
args: args:
- patch - patch

View File

@ -218,11 +218,11 @@ spec:
serviceAccountName: istio-operator serviceAccountName: istio-operator
containers: containers:
- name: istio-operator - name: istio-operator
image: {{default .Registries.IstioOperator .ImageRepository}}{{.Images.IstioOperator}} image: {{.CustomRegistries.IstioOperator | default .ImageRepository | default .Registries.IstioOperator }}{{.Images.IstioOperator}}
command: command:
- operator - operator
- server - server
imagePullPolicy: Always imagePullPolicy: IfNotPresent
resources: resources:
limits: limits:
cpu: 200m cpu: 200m

View File

@ -50,7 +50,7 @@ spec:
- /bin/bash - /bin/bash
- -c - -c
- /kubevirt-scripts/install.sh - /kubevirt-scripts/install.sh
image: {{default .Registries.Kubectl .ImageRepository}}{{.Images.Kubectl}} image: {{.CustomRegistries.Kubectl | default .ImageRepository | default .Registries.Kubectl }}{{.Images.Kubectl}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: kubevirt-provisioner name: kubevirt-provisioner
lifecycle: lifecycle:

View File

@ -41,8 +41,8 @@ spec:
serviceAccountName: sa-logviewer serviceAccountName: sa-logviewer
containers: containers:
- name: logviewer - name: logviewer
imagePullPolicy: Always imagePullPolicy: IfNotPresent
image: {{default .Registries.LogViewer .ImageRepository}}{{.Images.LogViewer}} image: {{.CustomRegistries.LogViewer | default .ImageRepository | default .Registries.LogViewer }}{{.Images.LogViewer}}
volumeMounts: volumeMounts:
- name: logs - name: logs
mountPath: /var/log/containers/ mountPath: /var/log/containers/

View File

@ -212,7 +212,7 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: status.hostIP fieldPath: status.hostIP
image: {{default .Registries.Speaker .ImageRepository}}{{.Images.Speaker}} image: {{.CustomRegistries.Speaker | default .ImageRepository | default .Registries.Speaker }}{{.Images.Speaker}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: speaker name: speaker
ports: ports:
@ -268,7 +268,7 @@ spec:
- args: - args:
- --port=7472 - --port=7472
- --config=config - --config=config
image: {{default .Registries.Controller .ImageRepository}}{{.Images.Controller}} image: {{.CustomRegistries.Controller | default .ImageRepository | default .Registries.Controller }}{{.Images.Controller}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: controller name: controller
ports: ports:

View File

@ -19,7 +19,7 @@ spec:
spec: spec:
containers: containers:
- name: metrics-server - name: metrics-server
image: {{default .Registries.MetricsServer .ImageRepository}}{{.Images.MetricsServer}} image: {{.CustomRegistries.MetricsServer | default .ImageRepository | default .Registries.MetricsServer }}{{.Images.MetricsServer}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
command: command:
- /metrics-server - /metrics-server

View File

@ -82,7 +82,7 @@ spec:
- $(OPERATOR_NAMESPACE) - $(OPERATOR_NAMESPACE)
- -writeStatusName - -writeStatusName
- "" - ""
image: {{default .Registries.OLM .ImageRepository}}{{.Images.OLM}} image: {{.CustomRegistries.OLM | default .ImageRepository | default .Registries.OLM }}{{.Images.OLM}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
@ -143,7 +143,7 @@ spec:
- '-namespace' - '-namespace'
- olm - olm
- -configmapServerImage=quay.io/operator-framework/configmap-operator-registry:latest - -configmapServerImage=quay.io/operator-framework/configmap-operator-registry:latest
image: {{default .Registries.OLM .ImageRepository}}{{.Images.OLM}} image: {{.CustomRegistries.OLM | default .ImageRepository | default .Registries.OLM }}{{.Images.OLM}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 8080 - containerPort: 8080
@ -307,8 +307,8 @@ spec:
- "5443" - "5443"
- --global-namespace - --global-namespace
- olm - olm
image: {{default .Registries.OLM .ImageRepository}}{{.Images.OLM}} image: {{.CustomRegistries.OLM | default .ImageRepository | default .Registries.OLM }}{{.Images.OLM}}
imagePullPolicy: Always imagePullPolicy: IfNotPresent
ports: ports:
- containerPort: 5443 - containerPort: 5443
livenessProbe: livenessProbe:
@ -346,6 +346,6 @@ metadata:
namespace: olm namespace: olm
spec: spec:
sourceType: grpc sourceType: grpc
image: {{default .Registries.UpstreamCommunityOperators .ImageRepository}}{{.Images.UpstreamCommunityOperators}} image: {{.CustomRegistries.UpstreamCommunityOperators | default .ImageRepository | default .Registries.UpstreamCommunityOperators }}{{.Images.UpstreamCommunityOperators}}
displayName: Community Operators displayName: Community Operators
publisher: OperatorHub.io publisher: OperatorHub.io

View File

@ -17,7 +17,7 @@ spec:
spec: spec:
initContainers: initContainers:
- name: update - name: update
image: {{default .Registries.Alpine .ImageRepository}}{{.Images.Alpine}} image: {{.CustomRegistries.Alpine | default .ImageRepository | default .Registries.Alpine }}{{.Images.Alpine}}
volumeMounts: volumeMounts:
- name: etchosts - name: etchosts
mountPath: /host-etc/hosts mountPath: /host-etc/hosts
@ -43,7 +43,7 @@ spec:
echo "Done." echo "Done."
containers: containers:
- name: pause-for-update - name: pause-for-update
image: {{default .Registries.Pause .ImageRepository}}{{.Images.Pause}} image: {{.CustomRegistries.Pause | default .ImageRepository | default .Registries.Pause }}{{.Images.Pause}}
terminationGracePeriodSeconds: 30 terminationGracePeriodSeconds: 30
volumes: volumes:
- name: etchosts - name: etchosts

View File

@ -18,9 +18,9 @@ spec:
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
spec: spec:
containers: containers:
- image: {{default .Registries.RegistryCreds .ImageRepository}}{{.Images.RegistryCreds}} - image: {{.CustomRegistries.RegistryCreds | default .ImageRepository | default .Registries.RegistryCreds }}{{.Images.RegistryCreds}}
name: registry-creds name: registry-creds
imagePullPolicy: Always imagePullPolicy: IfNotPresent
env: env:
- name: AWS_ACCESS_KEY_ID - name: AWS_ACCESS_KEY_ID
valueFrom: valueFrom:

View File

@ -19,7 +19,7 @@ spec:
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
spec: spec:
containers: containers:
- image: {{default .Registries.KubeRegistryProxy .ImageRepository}}{{.Images.KubeRegistryProxy}} - image: {{.CustomRegistries.KubeRegistryProxy | default .ImageRepository | default .Registries.KubeRegistryProxy }}{{.Images.KubeRegistryProxy}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: registry-proxy name: registry-proxy
ports: ports:

View File

@ -18,7 +18,7 @@ spec:
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
spec: spec:
containers: containers:
- image: {{default .Registries.Registry .ImageRepository}}{{.Images.Registry}} - image: {{.CustomRegistries.Registry | default .ImageRepository | default .Registries.Registry }}{{.Images.Registry}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: registry name: registry
ports: ports:

View File

@ -31,7 +31,7 @@ spec:
# kubernetes.io/hostname: minikube # kubernetes.io/hostname: minikube
hostNetwork: true hostNetwork: true
containers: containers:
- image: {{default .Registries.GlusterfsServer .ImageRepository}}{{.Images.GlusterfsServer}} - image: {{.CustomRegistries.GlusterfsServer | default .ImageRepository | default .Registries.GlusterfsServer }}{{.Images.GlusterfsServer}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: glusterfs name: glusterfs
env: env:

View File

@ -116,7 +116,7 @@ spec:
spec: spec:
serviceAccountName: heketi-service-account serviceAccountName: heketi-service-account
containers: containers:
- image: {{default .Registries.Heketi .ImageRepository}}{{.Images.Heketi}} - image: {{.CustomRegistries.Heketi | default .ImageRepository | default .Registries.Heketi }}{{.Images.Heketi}}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
name: heketi name: heketi
env: env:

View File

@ -106,8 +106,8 @@ spec:
serviceAccountName: glusterfile-provisioner serviceAccountName: glusterfile-provisioner
containers: containers:
- name: glusterfile-provisioner - name: glusterfile-provisioner
image: {{default .Registries.GlusterfileProvisioner .ImageRepository}}{{.Images.GlusterfileProvisioner}} image: {{.CustomRegistries.GlusterfileProvisioner | default .ImageRepository | default .Registries.GlusterfileProvisioner }}{{.Images.GlusterfileProvisioner}}
imagePullPolicy: Always imagePullPolicy: IfNotPresent
env: env:
- name: PROVISIONER_NAME - name: PROVISIONER_NAME
value: gluster.org/glusterfile value: gluster.org/glusterfile

View File

@ -100,7 +100,7 @@ spec:
hostNetwork: true hostNetwork: true
containers: containers:
- name: storage-provisioner - name: storage-provisioner
image: {{default .Registries.StorageProvisioner .ImageRepository}}{{.Images.StorageProvisioner}} image: {{.CustomRegistries.StorageProvisioner | default .ImageRepository | default .Registries.StorageProvisioner }}{{.Images.StorageProvisioner}}
command: ["/storage-provisioner"] command: ["/storage-provisioner"]
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
volumeMounts: volumeMounts:

View File

@ -23,7 +23,7 @@ spec:
containers: containers:
- name: volume-snapshot-controller - name: volume-snapshot-controller
# TODO(xyang): Replace with an official image when it is released # TODO(xyang): Replace with an official image when it is released
image: {{default .Registries.SnapshotController .ImageRepository}}{{.Images.SnapshotController}} image: {{.CustomRegistries.SnapshotController | default .ImageRepository | default .Registries.SnapshotController }}{{.Images.SnapshotController}}
args: args:
- "--v=5" - "--v=5"
imagePullPolicy: Always imagePullPolicy: IfNotPresent

View File

@ -615,6 +615,7 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig) interface{}
CustomIngressCert string CustomIngressCert string
Images map[string]string Images map[string]string
Registries map[string]string Registries map[string]string
CustomRegistries map[string]string
}{ }{
Arch: a, Arch: a,
ExoticArch: ea, ExoticArch: ea,
@ -624,6 +625,10 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig) interface{}
CustomIngressCert: cfg.CustomIngressCert, CustomIngressCert: cfg.CustomIngressCert,
Images: addon.Images, Images: addon.Images,
Registries: addon.Registries, Registries: addon.Registries,
CustomRegistries: make(map[string]string),
}
if opts.ImageRepository != "" && !strings.HasSuffix(opts.ImageRepository, "/") {
opts.ImageRepository += "/"
} }
if opts.Images == nil { if opts.Images == nil {
@ -658,8 +663,8 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig) interface{}
out.WarningT("Ignoring invalid custom registry {{.conf}}", out.V{"conf": registry}) out.WarningT("Ignoring invalid custom registry {{.conf}}", out.V{"conf": registry})
continue continue
} }
if _, ok := opts.Registries[vals[0]]; ok { if _, ok := opts.Images[vals[0]]; ok { // check images map because registry map may omitted default registry
opts.Registries[vals[0]] = vals[1] opts.CustomRegistries[vals[0]] = vals[1]
} else { } else {
out.WarningT("Ignoring unknown custom registry {{.name}}", out.V{"name": vals[0]}) out.WarningT("Ignoring unknown custom registry {{.name}}", out.V{"name": vals[0]})
} }
@ -668,17 +673,39 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig) interface{}
// Append postfix "/" to registries // Append postfix "/" to registries
for k, v := range opts.Registries { for k, v := range opts.Registries {
if opts.Registries[k] != "" && !strings.HasSuffix(opts.Registries[k], "/") { if v != "" && !strings.HasSuffix(v, "/") {
opts.Registries[k] = v + "/" opts.Registries[k] = v + "/"
} }
} }
for k, v := range opts.CustomRegistries {
if v != "" && !strings.HasSuffix(v, "/") {
opts.CustomRegistries[k] = v + "/"
}
}
for name, image := range opts.Images { for name, image := range opts.Images {
if _, ok := opts.Registries[name]; !ok { if _, ok := opts.Registries[name]; !ok {
opts.Registries[name] = "" // Avoid nil access when rendering opts.Registries[name] = "" // Avoid nil access when rendering
} }
// Send messages to stderr due to some tests rely on stdout // Send messages to stderr due to some tests rely on stdout
out.ErrT(style.Option, "Using image {{.registry}}{{.image}}", out.V{"registry": opts.Registries[name], "image": image}) if override, ok := opts.CustomRegistries[name]; ok {
out.ErrT(style.Option, "Using image {{.registry}}{{.image}}", out.V{
"registry": override,
"image": image,
})
} else if opts.ImageRepository != "" {
out.ErrT(style.Option, "Using image {{.registry}}{{.image}} (global image repository)", out.V{
"registry": opts.ImageRepository,
"image": image,
})
} else {
out.ErrT(style.Option, "Using image {{.registry}}{{.image}}", out.V{
"registry": opts.Registries[name],
"image": image,
})
}
} }
return opts return opts
} }

View File

@ -128,8 +128,8 @@ minikube addons enable dashboard
### Options ### Options
``` ```
--images string Images used by this addon. Divided by comma. --images string Images used by this addon. Separated by commas.
--registries string Registries used by this addon. Divided by comma. --registries string Registries used by this addon. Separated by commas.
``` ```
### Options inherited from parent commands ### Options inherited from parent commands