diff --git a/cmd/minikube/cmd/config/enable.go b/cmd/minikube/cmd/config/enable.go index fd593c82cd01..f79a07ab4c49 100644 --- a/cmd/minikube/cmd/config/enable.go +++ b/cmd/minikube/cmd/config/enable.go @@ -31,9 +31,10 @@ import ( ) var addonsEnableCmd = &cobra.Command{ - Use: "enable ADDON_NAME", - Short: "Enables the addon w/ADDON_NAME within minikube (example: minikube addons enable dashboard). For a list of available addons use: minikube addons list ", - Long: "Enables the addon w/ADDON_NAME within minikube (example: minikube addons enable dashboard). For a list of available addons use: minikube addons list ", + Use: "enable ADDON_NAME", + Short: "Enables the addon w/ADDON_NAME within minikube. For a list of available addons use: minikube addons list ", + Long: "Enables the addon w/ADDON_NAME within minikube. For a list of available addons use: minikube addons list ", + Example: "minikube addons enable dashboard", Run: func(cmd *cobra.Command, args []string) { if len(args) != 1 { exit.Message(reason.Usage, "usage: minikube addons enable ADDON_NAME") @@ -45,6 +46,7 @@ var addonsEnableCmd = &cobra.Command{ addon = "metrics-server" } viper.Set(config.AddonImages, images) + viper.Set(config.AddonRegistries, registries) err := addons.SetAndSave(ClusterFlagValue(), addon, "true") if err != nil { exit.Error(reason.InternalEnable, "enable failed", err) @@ -67,10 +69,12 @@ var addonsEnableCmd = &cobra.Command{ } var ( - images string + images string + registries string ) func init() { - addonsEnableCmd.Flags().StringVar(&images, "images", "", "Alpha feature. Image names used by this addon. Divided by comma.") + addonsEnableCmd.Flags().StringVar(&images, "images", "", "Images used by this addon. Divided by comma.") + addonsEnableCmd.Flags().StringVar(®istries, "registries", "", "Registries used by this addon. Divided by comma.") AddonsCmd.AddCommand(addonsEnableCmd) } diff --git a/deploy/addons/ambassador/ambassador-operator.yaml.tmpl b/deploy/addons/ambassador/ambassador-operator.yaml.tmpl index 57e67d24e165..a2391acb0644 100644 --- a/deploy/addons/ambassador/ambassador-operator.yaml.tmpl +++ b/deploy/addons/ambassador/ambassador-operator.yaml.tmpl @@ -180,7 +180,7 @@ spec: containers: - name: ambassador-operator # Replace this with the built image name - image: {{default .Registries.AmbassadorOperator .ImageRepository}}/{{.Images.AmbassadorOperator}} + image: {{default .Registries.AmbassadorOperator .ImageRepository}}{{.Images.AmbassadorOperator}} command: - ambassador-operator imagePullPolicy: Always diff --git a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-attacher.yaml.tmpl b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-attacher.yaml.tmpl index 371ac65845e9..e37357afbc30 100644 --- a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-attacher.yaml.tmpl +++ b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-attacher.yaml.tmpl @@ -57,7 +57,7 @@ spec: serviceAccountName: csi-attacher containers: - name: csi-attacher - image: {{default .Registries.Attacher .ImageRepository}}/{{.Images.Attacher}} + image: {{default .Registries.Attacher .ImageRepository}}{{.Images.Attacher}} args: - --v=5 - --csi-address=/csi/csi.sock diff --git a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-plugin.yaml.tmpl b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-plugin.yaml.tmpl index ff9ea1b9b0e4..552f6619fc65 100644 --- a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-plugin.yaml.tmpl +++ b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-plugin.yaml.tmpl @@ -53,7 +53,7 @@ spec: spec: containers: - name: node-driver-registrar - image: {{default .Registries.NodeDriverRegistrar .ImageRepository}}/{{.Images.NodeDriverRegistrar}} + image: {{default .Registries.NodeDriverRegistrar .ImageRepository}}{{.Images.NodeDriverRegistrar}} args: - --v=5 - --csi-address=/csi/csi.sock @@ -78,7 +78,7 @@ spec: name: csi-data-dir - name: hostpath - image: {{default .Registries.HostPathPlugin .ImageRepository}}/{{.Images.HostPathPlugin}} + image: {{default .Registries.HostPathPlugin .ImageRepository}}{{.Images.HostPathPlugin}} args: - "--drivername=hostpath.csi.k8s.io" - "--v=5" @@ -123,7 +123,7 @@ spec: volumeMounts: - mountPath: /csi name: socket-dir - image: {{default .Registries.LivenessProbe .ImageRepository}}/{{.Images.LivenessProbe}} + image: {{default .Registries.LivenessProbe .ImageRepository}}{{.Images.LivenessProbe}} args: - --csi-address=/csi/csi.sock - --health-port=9898 diff --git a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-provisioner.yaml.tmpl b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-provisioner.yaml.tmpl index 0afc654b9acf..b88dd7c0aade 100644 --- a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-provisioner.yaml.tmpl +++ b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-provisioner.yaml.tmpl @@ -57,7 +57,7 @@ spec: serviceAccountName: csi-provisioner containers: - name: csi-provisioner - image: {{default .Registries.Provisioner .ImageRepository}}/{{.Images.Provisioner}} + image: {{default .Registries.Provisioner .ImageRepository}}{{.Images.Provisioner}} args: - -v=5 - --csi-address=/csi/csi.sock diff --git a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-resizer.yaml.tmpl b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-resizer.yaml.tmpl index 6b6d18709d41..36cad376e22f 100644 --- a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-resizer.yaml.tmpl +++ b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-resizer.yaml.tmpl @@ -57,7 +57,7 @@ spec: serviceAccountName: csi-resizer containers: - name: csi-resizer - image: {{default .Registries.Resizer .ImageRepository}}/{{.Images.Resizer}} + image: {{default .Registries.Resizer .ImageRepository}}{{.Images.Resizer}} args: - -v=5 - -csi-address=/csi/csi.sock diff --git a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-snapshotter.yaml.tmpl b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-snapshotter.yaml.tmpl index 98d736d4186c..0190e28e0e9b 100644 --- a/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-snapshotter.yaml.tmpl +++ b/deploy/addons/csi-hostpath-driver/deploy/csi-hostpath-snapshotter.yaml.tmpl @@ -57,7 +57,7 @@ spec: serviceAccount: csi-snapshotter containers: - name: csi-snapshotter - image: {{default .Registries.Snapshotter .ImageRepository}}/{{.Images.Snapshotter}} + image: {{default .Registries.Snapshotter .ImageRepository}}{{.Images.Snapshotter}} args: - -v=5 - --csi-address=/csi/csi.sock diff --git a/deploy/addons/dashboard/dashboard-dp.yaml.tmpl b/deploy/addons/dashboard/dashboard-dp.yaml.tmpl index 73fe1a914948..bdec475f55ca 100644 --- a/deploy/addons/dashboard/dashboard-dp.yaml.tmpl +++ b/deploy/addons/dashboard/dashboard-dp.yaml.tmpl @@ -36,7 +36,7 @@ spec: spec: containers: - name: dashboard-metrics-scraper - image: {{default .Registries.MetricsScraper .ImageRepository}}/{{.Images.MetricsScraper}} + image: {{default .Registries.MetricsScraper .ImageRepository}}{{.Images.MetricsScraper}} ports: - containerPort: 8000 protocol: TCP @@ -91,7 +91,7 @@ spec: containers: - name: kubernetes-dashboard # WARNING: This must match pkg/minikube/bootstrapper/images/images.go - image: {{default .Registries.Dashboard .ImageRepository}}/{{.Images.Dashboard}} + image: {{default .Registries.Dashboard .ImageRepository}}{{.Images.Dashboard}} ports: - containerPort: 9090 protocol: TCP diff --git a/deploy/addons/efk/elasticsearch-rc.yaml.tmpl b/deploy/addons/efk/elasticsearch-rc.yaml.tmpl index d407ef9ed59f..59f5231f7d6d 100644 --- a/deploy/addons/efk/elasticsearch-rc.yaml.tmpl +++ b/deploy/addons/efk/elasticsearch-rc.yaml.tmpl @@ -34,7 +34,7 @@ spec: spec: containers: - name: elasticsearch-logging - image: {{default .Registries.Elasticsearch .ImageRepository}}/{{.Images.Elasticsearch}} + image: {{default .Registries.Elasticsearch .ImageRepository}}{{.Images.Elasticsearch}} resources: limits: cpu: 500m @@ -62,7 +62,7 @@ spec: - name: ES_JAVA_OPTS value: "-Xms1024m -Xmx1024m" initContainers: - - image: {{default .Registries.Alpine .ImageRepository}}/{{.Images.Alpine}} + - image: {{default .Registries.Alpine .ImageRepository}}{{.Images.Alpine}} command: ["/sbin/sysctl", "-w", "vm.max_map_count=262144"] name: elasticsearch-logging-init securityContext: diff --git a/deploy/addons/efk/fluentd-es-rc.yaml.tmpl b/deploy/addons/efk/fluentd-es-rc.yaml.tmpl index 5d196ff68671..a1669c253645 100644 --- a/deploy/addons/efk/fluentd-es-rc.yaml.tmpl +++ b/deploy/addons/efk/fluentd-es-rc.yaml.tmpl @@ -31,7 +31,7 @@ spec: spec: containers: - name: fluentd-es - image: {{default .Registries.FluentdElasticsearch .ImageRepository}}/{{.Images.FluentdElasticsearch}} + image: {{default .Registries.FluentdElasticsearch .ImageRepository}}{{.Images.FluentdElasticsearch}} env: - name: FLUENTD_ARGS value: --no-supervisor -q diff --git a/deploy/addons/efk/kibana-rc.yaml.tmpl b/deploy/addons/efk/kibana-rc.yaml.tmpl index 356bf30dacc8..e13faa98b16f 100644 --- a/deploy/addons/efk/kibana-rc.yaml.tmpl +++ b/deploy/addons/efk/kibana-rc.yaml.tmpl @@ -34,7 +34,7 @@ spec: spec: containers: - name: kibana-logging - image: {{default .Registries.Kibana .ImageRepository}}/{{.Images.Kibana}} + image: {{default .Registries.Kibana .ImageRepository}}{{.Images.Kibana}} resources: limits: cpu: 500m diff --git a/deploy/addons/freshpod/freshpod-rc.yaml.tmpl b/deploy/addons/freshpod/freshpod-rc.yaml.tmpl index 502db2418c2f..c5112c8c8c10 100644 --- a/deploy/addons/freshpod/freshpod-rc.yaml.tmpl +++ b/deploy/addons/freshpod/freshpod-rc.yaml.tmpl @@ -34,7 +34,7 @@ spec: spec: containers: - name: freshpod - image: {{default .Registries.FreshPod .ImageRepository}}/{{.Images.FreshPod}} + image: {{default .Registries.FreshPod .ImageRepository}}{{.Images.FreshPod}} imagePullPolicy: IfNotPresent volumeMounts: - name: docker diff --git a/deploy/addons/gcp-auth/gcp-auth-webhook.yaml.tmpl.tmpl b/deploy/addons/gcp-auth/gcp-auth-webhook.yaml.tmpl.tmpl index 5cf3f61ce24f..a2f24e6c8d93 100644 --- a/deploy/addons/gcp-auth/gcp-auth-webhook.yaml.tmpl.tmpl +++ b/deploy/addons/gcp-auth/gcp-auth-webhook.yaml.tmpl.tmpl @@ -68,7 +68,7 @@ spec: serviceAccountName: minikube-gcp-auth-certs containers: - name: create - image: {{default .Registries.KubeWebhookCertgen .ImageRepository}}/{{.Images.KubeWebhookCertgen}} + image: {{default .Registries.KubeWebhookCertgen .ImageRepository}}{{.Images.KubeWebhookCertgen}} imagePullPolicy: IfNotPresent args: - create @@ -94,7 +94,7 @@ spec: spec: containers: - name: gcp-auth - image: {{default .Registries.GCPAuthWebhook .ImageRepository}}/{{.Images.GCPAuthWebhook}} + image: {{default .Registries.GCPAuthWebhook .ImageRepository}}{{.Images.GCPAuthWebhook}} imagePullPolicy: IfNotPresent ports: - containerPort: 8443 @@ -127,7 +127,7 @@ spec: serviceAccountName: minikube-gcp-auth-certs containers: - name: patch - image: {{default .Registries.KubeWebhookCertgen .ImageRepository}}/{{.Images.KubeWebhookCertgen}} + image: {{default .Registries.KubeWebhookCertgen .ImageRepository}}{{.Images.KubeWebhookCertgen}} imagePullPolicy: IfNotPresent args: - patch diff --git a/deploy/addons/gpu/nvidia-driver-installer.yaml.tmpl b/deploy/addons/gpu/nvidia-driver-installer.yaml.tmpl index 338abd715574..27d4e99f5bcf 100644 --- a/deploy/addons/gpu/nvidia-driver-installer.yaml.tmpl +++ b/deploy/addons/gpu/nvidia-driver-installer.yaml.tmpl @@ -50,7 +50,7 @@ spec: hostPath: path: / initContainers: - - image: {{default .Registries.NvidiaDriverInstaller .ImageRepository}}/{{.Images.NvidiaDriverInstaller}} + - image: {{default .Registries.NvidiaDriverInstaller .ImageRepository}}{{.Images.NvidiaDriverInstaller}} name: nvidia-driver-installer resources: requests: diff --git a/deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl b/deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl index 62314b107ecc..a540fb77d732 100644 --- a/deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl +++ b/deploy/addons/gpu/nvidia-gpu-device-plugin.yaml.tmpl @@ -43,7 +43,7 @@ spec: hostPath: path: /var/lib/kubelet/device-plugins containers: - - image: {{default .Registries.NvidiaDevicePlugin .ImageRepository}}/{{.Images.NvidiaDevicePlugin}} + - image: {{default .Registries.NvidiaDevicePlugin .ImageRepository}}{{.Images.NvidiaDevicePlugin}} command: ["/usr/bin/nvidia-device-plugin", "-logtostderr"] name: nvidia-gpu-device-plugin resources: diff --git a/deploy/addons/gvisor/gvisor-pod.yaml.tmpl b/deploy/addons/gvisor/gvisor-pod.yaml.tmpl index a60ab3777666..7e9ad3666472 100644 --- a/deploy/addons/gvisor/gvisor-pod.yaml.tmpl +++ b/deploy/addons/gvisor/gvisor-pod.yaml.tmpl @@ -25,7 +25,7 @@ spec: hostPID: true containers: - name: gvisor - image: {{default .Registries.GvisorAddon .ImageRepository}}/{{.Images.GvisorAddon}} + image: {{default .Registries.GvisorAddon .ImageRepository}}{{.Images.GvisorAddon}} securityContext: privileged: true volumeMounts: diff --git a/deploy/addons/helm-tiller/helm-tiller-dp.tmpl b/deploy/addons/helm-tiller/helm-tiller-dp.tmpl index da06ae1c8b86..023d2feed4da 100644 --- a/deploy/addons/helm-tiller/helm-tiller-dp.tmpl +++ b/deploy/addons/helm-tiller/helm-tiller-dp.tmpl @@ -46,7 +46,7 @@ spec: value: kube-system - name: TILLER_HISTORY_MAX value: "0" - image: {{default .Registries.Tiller .ImageRepository}}/{{.Images.Tiller}} + image: {{default .Registries.Tiller .ImageRepository}}{{.Images.Tiller}} imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 diff --git a/deploy/addons/ingress-dns/ingress-dns-pod.yaml.tmpl b/deploy/addons/ingress-dns/ingress-dns-pod.yaml.tmpl index 4d07f1b7ce2f..abf54da11cc1 100644 --- a/deploy/addons/ingress-dns/ingress-dns-pod.yaml.tmpl +++ b/deploy/addons/ingress-dns/ingress-dns-pod.yaml.tmpl @@ -80,7 +80,7 @@ spec: hostNetwork: true containers: - name: minikube-ingress-dns - image: {{default .Registries.IngressDNS .ImageRepository}}/{{.Images.IngressDNS}} + image: {{default .Registries.IngressDNS .ImageRepository}}{{.Images.IngressDNS}} imagePullPolicy: IfNotPresent ports: - containerPort: 53 diff --git a/deploy/addons/ingress/ingress-dp.yaml.tmpl b/deploy/addons/ingress/ingress-dp.yaml.tmpl index 146025290e14..4b29c64c83be 100644 --- a/deploy/addons/ingress/ingress-dp.yaml.tmpl +++ b/deploy/addons/ingress/ingress-dp.yaml.tmpl @@ -49,7 +49,7 @@ spec: serviceAccountName: ingress-nginx containers: - name: controller - image: {{default .Registries.IngressController .ImageRepository}}/{{.Images.IngressController}} + image: {{default .Registries.IngressController .ImageRepository}}{{.Images.IngressController}} imagePullPolicy: IfNotPresent lifecycle: preStop: @@ -220,7 +220,7 @@ spec: spec: containers: - name: create - image: {{default .Registries.KubeWebhookCertgenCreate .ImageRepository}}/{{.Images.KubeWebhookCertgenCreate}} + image: {{default .Registries.KubeWebhookCertgenCreate .ImageRepository}}{{.Images.KubeWebhookCertgenCreate}} imagePullPolicy: IfNotPresent args: - create @@ -255,7 +255,7 @@ spec: spec: containers: - name: patch - image: {{default .Registries.KubeWebhookCertgenPatch .ImageRepository}}/{{.Images.KubeWebhookCertgenPatch}} + image: {{default .Registries.KubeWebhookCertgenPatch .ImageRepository}}{{.Images.KubeWebhookCertgenPatch}} imagePullPolicy: args: - patch diff --git a/deploy/addons/istio-provisioner/istio-operator.yaml.tmpl b/deploy/addons/istio-provisioner/istio-operator.yaml.tmpl index 8211d3933178..d907629316ab 100644 --- a/deploy/addons/istio-provisioner/istio-operator.yaml.tmpl +++ b/deploy/addons/istio-provisioner/istio-operator.yaml.tmpl @@ -218,7 +218,7 @@ spec: serviceAccountName: istio-operator containers: - name: istio-operator - image: {{default .Registries.IstioOperator .ImageRepository}}/{{.Images.IstioOperator}} + image: {{default .Registries.IstioOperator .ImageRepository}}{{.Images.IstioOperator}} command: - operator - server diff --git a/deploy/addons/kubevirt/pod.yaml.tmpl b/deploy/addons/kubevirt/pod.yaml.tmpl index d43502b5f932..50279f5badf2 100644 --- a/deploy/addons/kubevirt/pod.yaml.tmpl +++ b/deploy/addons/kubevirt/pod.yaml.tmpl @@ -50,7 +50,7 @@ spec: - /bin/bash - -c - /kubevirt-scripts/install.sh - image: {{default .Registries.Kubectl .ImageRepository}}/{{.Images.Kubectl}} + image: {{default .Registries.Kubectl .ImageRepository}}{{.Images.Kubectl}} imagePullPolicy: IfNotPresent name: kubevirt-provisioner lifecycle: diff --git a/deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl b/deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl index ac88a6e2618b..c4ff7100e424 100644 --- a/deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl +++ b/deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl @@ -42,7 +42,7 @@ spec: containers: - name: logviewer imagePullPolicy: Always - image: {{default .Registries.LogViewer .ImageRepository}}/{{.Images.LogViewer}} + image: {{default .Registries.LogViewer .ImageRepository}}{{.Images.LogViewer}} volumeMounts: - name: logs mountPath: /var/log/containers/ diff --git a/deploy/addons/metallb/metallb.yaml.tmpl b/deploy/addons/metallb/metallb.yaml.tmpl index 2dc0875468fe..911e170038ff 100644 --- a/deploy/addons/metallb/metallb.yaml.tmpl +++ b/deploy/addons/metallb/metallb.yaml.tmpl @@ -212,7 +212,7 @@ spec: valueFrom: fieldRef: fieldPath: status.hostIP - image: {{default .Registries.Speaker .ImageRepository}}/{{.Images.Speaker}} + image: {{default .Registries.Speaker .ImageRepository}}{{.Images.Speaker}} imagePullPolicy: IfNotPresent name: speaker ports: @@ -268,7 +268,7 @@ spec: - args: - --port=7472 - --config=config - image: {{default .Registries.Controller .ImageRepository}}/{{.Images.Controller}} + image: {{default .Registries.Controller .ImageRepository}}{{.Images.Controller}} imagePullPolicy: IfNotPresent name: controller ports: diff --git a/deploy/addons/metrics-server/metrics-server-deployment.yaml.tmpl b/deploy/addons/metrics-server/metrics-server-deployment.yaml.tmpl index e553c08cd770..630042fd2ce3 100644 --- a/deploy/addons/metrics-server/metrics-server-deployment.yaml.tmpl +++ b/deploy/addons/metrics-server/metrics-server-deployment.yaml.tmpl @@ -19,7 +19,7 @@ spec: spec: containers: - name: metrics-server - image: {{default .Registries.MetricsServer .ImageRepository}}/{{.Images.MetricsServer}} + image: {{default .Registries.MetricsServer .ImageRepository}}{{.Images.MetricsServer}} imagePullPolicy: IfNotPresent command: - /metrics-server diff --git a/deploy/addons/olm/olm.yaml.tmpl b/deploy/addons/olm/olm.yaml.tmpl index 5d1c8673de50..69344cc7141b 100644 --- a/deploy/addons/olm/olm.yaml.tmpl +++ b/deploy/addons/olm/olm.yaml.tmpl @@ -82,7 +82,7 @@ spec: - $(OPERATOR_NAMESPACE) - -writeStatusName - "" - image: {{default .Registries.OLM .ImageRepository}}/{{.Images.OLM}} + image: {{default .Registries.OLM .ImageRepository}}{{.Images.OLM}} imagePullPolicy: IfNotPresent ports: - containerPort: 8080 @@ -143,7 +143,7 @@ spec: - '-namespace' - olm - -configmapServerImage=quay.io/operator-framework/configmap-operator-registry:latest - image: {{default .Registries.OLM .ImageRepository}}/{{.Images.OLM}} + image: {{default .Registries.OLM .ImageRepository}}{{.Images.OLM}} imagePullPolicy: IfNotPresent ports: - containerPort: 8080 @@ -307,7 +307,7 @@ spec: - "5443" - --global-namespace - olm - image: {{default .Registries.OLM .ImageRepository}}/{{.Images.OLM}} + image: {{default .Registries.OLM .ImageRepository}}{{.Images.OLM}} imagePullPolicy: Always ports: - containerPort: 5443 @@ -346,6 +346,6 @@ metadata: namespace: olm spec: sourceType: grpc - image: {{default .Registries.UpstreamCommunityOperators .ImageRepository}}/{{.Images.UpstreamCommunityOperators}} + image: {{default .Registries.UpstreamCommunityOperators .ImageRepository}}{{.Images.UpstreamCommunityOperators}} displayName: Community Operators publisher: OperatorHub.io \ No newline at end of file diff --git a/deploy/addons/registry-aliases/node-etc-hosts-update.tmpl b/deploy/addons/registry-aliases/node-etc-hosts-update.tmpl index e03d7d77f17c..5ceee2ef695a 100644 --- a/deploy/addons/registry-aliases/node-etc-hosts-update.tmpl +++ b/deploy/addons/registry-aliases/node-etc-hosts-update.tmpl @@ -17,7 +17,7 @@ spec: spec: initContainers: - name: update - image: {{default .Registries.Alpine .ImageRepository}}/{{.Images.Alpine}} + image: {{default .Registries.Alpine .ImageRepository}}{{.Images.Alpine}} volumeMounts: - name: etchosts mountPath: /host-etc/hosts @@ -43,7 +43,7 @@ spec: echo "Done." containers: - name: pause-for-update - image: {{default .Registries.Pause .ImageRepository}}/{{.Images.Pause}} + image: {{default .Registries.Pause .ImageRepository}}{{.Images.Pause}} terminationGracePeriodSeconds: 30 volumes: - name: etchosts diff --git a/deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl b/deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl index 8ea8848a127f..729fc0c82ba9 100644 --- a/deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl +++ b/deploy/addons/registry-creds/registry-creds-rc.yaml.tmpl @@ -18,7 +18,7 @@ spec: addonmanager.kubernetes.io/mode: Reconcile spec: containers: - - image: {{default .Registries.RegistryCreds .ImageRepository}}/{{.Images.RegistryCreds}} + - image: {{default .Registries.RegistryCreds .ImageRepository}}{{.Images.RegistryCreds}} name: registry-creds imagePullPolicy: Always env: diff --git a/deploy/addons/registry/registry-proxy.yaml.tmpl b/deploy/addons/registry/registry-proxy.yaml.tmpl index 8842058adf23..4c083e4b48dc 100644 --- a/deploy/addons/registry/registry-proxy.yaml.tmpl +++ b/deploy/addons/registry/registry-proxy.yaml.tmpl @@ -19,7 +19,7 @@ spec: addonmanager.kubernetes.io/mode: Reconcile spec: containers: - - image: {{default .Registries.KubeRegistryProxy .ImageRepository}}/{{.Images.KubeRegistryProxy}} + - image: {{default .Registries.KubeRegistryProxy .ImageRepository}}{{.Images.KubeRegistryProxy}} imagePullPolicy: IfNotPresent name: registry-proxy ports: diff --git a/deploy/addons/registry/registry-rc.yaml.tmpl b/deploy/addons/registry/registry-rc.yaml.tmpl index 7db20a49e551..73cbb67147cc 100644 --- a/deploy/addons/registry/registry-rc.yaml.tmpl +++ b/deploy/addons/registry/registry-rc.yaml.tmpl @@ -18,7 +18,7 @@ spec: addonmanager.kubernetes.io/mode: Reconcile spec: containers: - - image: {{default .Registries.Registry .ImageRepository}}/{{.Images.Registry}} + - image: {{default .Registries.Registry .ImageRepository}}{{.Images.Registry}} imagePullPolicy: IfNotPresent name: registry ports: diff --git a/deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml.tmpl b/deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml.tmpl index d94287e17c99..f4c4a2a5c89e 100644 --- a/deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml.tmpl +++ b/deploy/addons/storage-provisioner-gluster/glusterfs-daemonset.yaml.tmpl @@ -31,7 +31,7 @@ spec: # kubernetes.io/hostname: minikube hostNetwork: true containers: - - image: {{default .Registries.GlusterfsServer .ImageRepository}}/{{.Images.GlusterfsServer}} + - image: {{default .Registries.GlusterfsServer .ImageRepository}}{{.Images.GlusterfsServer}} imagePullPolicy: IfNotPresent name: glusterfs env: diff --git a/deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml.tmpl b/deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml.tmpl index da4e3341d2e6..e604e810c2bd 100644 --- a/deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml.tmpl +++ b/deploy/addons/storage-provisioner-gluster/heketi-deployment.yaml.tmpl @@ -116,7 +116,7 @@ spec: spec: serviceAccountName: heketi-service-account containers: - - image: {{default .Registries.Heketi .ImageRepository}}/{{.Images.Heketi}} + - image: {{default .Registries.Heketi .ImageRepository}}{{.Images.Heketi}} imagePullPolicy: IfNotPresent name: heketi env: diff --git a/deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml.tmpl b/deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml.tmpl index af0ddc53ef6b..49b54b387ddc 100644 --- a/deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml.tmpl +++ b/deploy/addons/storage-provisioner-gluster/storage-provisioner-glusterfile.yaml.tmpl @@ -106,7 +106,7 @@ spec: serviceAccountName: glusterfile-provisioner containers: - name: glusterfile-provisioner - image: {{default .Registries.GlusterfileProvisioner .ImageRepository}}/{{.Images.GlusterfileProvisioner}} + image: {{default .Registries.GlusterfileProvisioner .ImageRepository}}{{.Images.GlusterfileProvisioner}} imagePullPolicy: Always env: - name: PROVISIONER_NAME diff --git a/deploy/addons/storage-provisioner/storage-provisioner.yaml.tmpl b/deploy/addons/storage-provisioner/storage-provisioner.yaml.tmpl index 1ec47136f70a..fff4bf89c842 100644 --- a/deploy/addons/storage-provisioner/storage-provisioner.yaml.tmpl +++ b/deploy/addons/storage-provisioner/storage-provisioner.yaml.tmpl @@ -100,7 +100,7 @@ spec: hostNetwork: true containers: - name: storage-provisioner - image: {{default .Registries.StorageProvisioner .ImageRepository}}/{{.Images.StorageProvisioner}} + image: {{default .Registries.StorageProvisioner .ImageRepository}}{{.Images.StorageProvisioner}} command: ["/storage-provisioner"] imagePullPolicy: IfNotPresent volumeMounts: diff --git a/deploy/addons/volumesnapshots/volume-snapshot-controller-deployment.yaml.tmpl b/deploy/addons/volumesnapshots/volume-snapshot-controller-deployment.yaml.tmpl index b0d44980bbb3..57bebeaba002 100644 --- a/deploy/addons/volumesnapshots/volume-snapshot-controller-deployment.yaml.tmpl +++ b/deploy/addons/volumesnapshots/volume-snapshot-controller-deployment.yaml.tmpl @@ -23,7 +23,7 @@ spec: containers: - name: volume-snapshot-controller # TODO(xyang): Replace with an official image when it is released - image: {{default .Registries.SnapshotController .ImageRepository}}/{{.Images.SnapshotController}} + image: {{default .Registries.SnapshotController .ImageRepository}}{{.Images.SnapshotController}} args: - "--v=5" imagePullPolicy: Always diff --git a/pkg/minikube/assets/addons.go b/pkg/minikube/assets/addons.go index de7151725085..699f0f18eae5 100644 --- a/pkg/minikube/assets/addons.go +++ b/pkg/minikube/assets/addons.go @@ -25,6 +25,7 @@ import ( "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/out" + "k8s.io/minikube/pkg/minikube/style" "k8s.io/minikube/pkg/minikube/vmpath" "k8s.io/minikube/pkg/version" ) @@ -86,10 +87,7 @@ var Addons = map[string]*Addon{ }, false, "dashboard", map[string]string{ "Dashboard": "kubernetesui/dashboard:v2.1.0", "MetricsScraper": "kubernetesui/metrics-scraper:v1.0.4", - }, map[string]string{ - "Dashboard": "docker.io", - "MetricsScraper": "docker.io", - }), + }, nil), "default-storageclass": NewAddon([]*BinAsset{ MustBinAsset( "deploy/addons/storageclass/storageclass.yaml.tmpl", @@ -141,9 +139,7 @@ var Addons = map[string]*Addon{ "GlusterfileProvisioner": "gluster/glusterfile-provisioner:latest", "GlusterfsServer": "nixpanic/glusterfs-server:pr_fake-disk", }, map[string]string{ - "Heketi": "docker.io", - "GlusterfileProvisioner": "docker.io", - "GlusterfsServer": "quay.io", + "GlusterfsServer": "quay.io", }), "efk": NewAddon([]*BinAsset{ MustBinAsset( @@ -184,7 +180,6 @@ var Addons = map[string]*Addon{ }, map[string]string{ "Elasticsearch": "k8s.gcr.io", "FluentdElasticsearch": "k8s.gcr.io", - "Alpine": "docker.io", "Kibana": "docker.elastic.co", }), "ingress": NewAddon([]*BinAsset{ @@ -208,9 +203,7 @@ var Addons = map[string]*Addon{ "KubeWebhookCertgenCreate": "jettech/kube-webhook-certgen:v1.2.2", "KubeWebhookCertgenPatch": "jettech/kube-webhook-certgen:v1.3.0", }, map[string]string{ - "IngressController": "us.gcr.io", - "KubeWebhookCertgenCreate": "docker.io", - "KubeWebhookCertgenPatch": "docker.io", + "IngressController": "us.gcr.io", }), "istio-provisioner": NewAddon([]*BinAsset{ MustBinAsset( @@ -220,9 +213,7 @@ var Addons = map[string]*Addon{ "0640"), }, false, "istio-provisioner", map[string]string{ "IstioOperator": "istio/operator:1.5.0", - }, map[string]string{ - "IstioOperator": "docker.io", - }), + }, nil), "istio": NewAddon([]*BinAsset{ MustBinAsset( "deploy/addons/istio/istio-default-profile.yaml.tmpl", @@ -238,9 +229,7 @@ var Addons = map[string]*Addon{ "0640"), }, false, "kubevirt", map[string]string{ "Kubectl": "bitnami/kubectl:1.17", - }, map[string]string{ - "Kubectl": "docker.io", - }), + }, nil), "metrics-server": NewAddon([]*BinAsset{ MustBinAsset( "deploy/addons/metrics-server/metrics-apiservice.yaml.tmpl", @@ -300,7 +289,6 @@ var Addons = map[string]*Addon{ "Registry": "registry:2.7.1", "KubeRegistryProxy": "google_containers/kube-registry-proxy:0.4", }, map[string]string{ - "Registry": "docker.io", "KubeRegistryProxy": "gcr.io", }), "registry-creds": NewAddon([]*BinAsset{ @@ -311,9 +299,7 @@ var Addons = map[string]*Addon{ "0640"), }, false, "registry-creds", map[string]string{ "RegistryCreds": "upmcenterprises/registry-creds:1.10", - }, map[string]string{ - "RegistryCreds": "docker.io", - }), + }, nil), "registry-aliases": NewAddon([]*BinAsset{ MustBinAsset( "deploy/addons/registry-aliases/registry-aliases-sa.tmpl", @@ -346,7 +332,6 @@ var Addons = map[string]*Addon{ "Pause": "google_containers/pause-amd64:3.1", }, map[string]string{ "CoreDNSPatcher": "quay.io", - "Alpine": "docker.io", "Pause": "gcr.io", }), "freshpod": NewAddon([]*BinAsset{ @@ -381,9 +366,7 @@ var Addons = map[string]*Addon{ "0640"), }, false, "nvidia-gpu-device-plugin", map[string]string{ "NvidiaDevicePlugin": "nvidia/k8s-device-plugin:1.0.0-beta4", - }, map[string]string{ - "NvidiaDevicePlugin": "docker.io", - }), + }, nil), "logviewer": NewAddon([]*BinAsset{ MustBinAsset( "deploy/addons/logviewer/logviewer-dp-and-svc.yaml.tmpl", @@ -397,9 +380,7 @@ var Addons = map[string]*Addon{ "0640"), }, false, "logviewer", map[string]string{ "LogViewer": "ivans3/minikube-log-viewer:latest", - }, map[string]string{ - "LogViewer": "docker.io", - }), + }, nil), "gvisor": NewAddon([]*BinAsset{ MustBinAsset( "deploy/addons/gvisor/gvisor-pod.yaml.tmpl", @@ -450,9 +431,7 @@ var Addons = map[string]*Addon{ "0640"), }, false, "ingress-dns", map[string]string{ "IngressDNS": "cryptexlabs/minikube-ingress-dns:0.3.0", - }, map[string]string{ - "IngressDNS": "docker.io", - }), + }, nil), "metallb": NewAddon([]*BinAsset{ MustBinAsset( "deploy/addons/metallb/metallb.yaml.tmpl", @@ -467,10 +446,7 @@ var Addons = map[string]*Addon{ }, false, "metallb", map[string]string{ "Speaker": "metallb/speaker:v0.8.2", "Controller": "metallb/controller:v0.8.2", - }, map[string]string{ - "Speaker": "docker.io", - "Controller": "docker.io", - }), + }, nil), "ambassador": NewAddon([]*BinAsset{ MustBinAsset( "deploy/addons/ambassador/ambassador-operator-crds.yaml.tmpl", @@ -512,8 +488,7 @@ var Addons = map[string]*Addon{ "KubeWebhookCertgen": "jettech/kube-webhook-certgen:v1.3.0", "GCPAuthWebhook": "k8s-minikube/gcp-auth-webhook:v0.0.3", }, map[string]string{ - "KubeWebhookCertgen": "docker.io", - "GCPAuthWebhook": "gcr.io", + "GCPAuthWebhook": "gcr.io", }), "volumesnapshots": NewAddon([]*BinAsset{ MustBinAsset( @@ -663,12 +638,47 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig) interface{} 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}) + if _, ok := opts.Images[vals[0]]; ok { + opts.Images[vals[0]] = vals[1] + } else { + out.WarningT("Ignoring unknown custom image {{.name}}", out.V{"name": vals[0]}) } - opts.Images[vals[0]] = vals[1] } } + if opts.Registries == nil { + opts.Registries = make(map[string]string) + } + + registries := viper.GetString(config.AddonRegistries) + if registries != "" { + for _, registry := range strings.Split(registries, ",") { + vals := strings.Split(registry, "=") + if len(vals) != 2 { + out.WarningT("Ignoring invalid custom registry {{.conf}}", out.V{"conf": registry}) + continue + } + if _, ok := opts.Registries[vals[0]]; ok { + opts.Registries[vals[0]] = vals[1] + } else { + out.WarningT("Ignoring unknown custom registry {{.name}}", out.V{"name": vals[0]}) + } + } + } + + // Append postfix "/" to registries + for k, v := range opts.Registries { + if !strings.HasSuffix(opts.Registries[k], "/") { + opts.Registries[k] = v + "/" + } + } + + for name, image := range opts.Images { + if _, ok := opts.Registries[name]; !ok { + opts.Registries[name] = "" // Avoid nil access when rendering + } + // 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}) + } return opts } diff --git a/pkg/minikube/config/config.go b/pkg/minikube/config/config.go index c7b6f1e4f817..44fec46565bd 100644 --- a/pkg/minikube/config/config.go +++ b/pkg/minikube/config/config.go @@ -50,6 +50,8 @@ const ( ShowBootstrapperDeprecationNotification = "ShowBootstrapperDeprecationNotification" // AddonImages stores custom addon images config AddonImages = "addon-images" + // AddonRegistries stores custom addon images config + AddonRegistries = "addon-registries" ) var ( diff --git a/site/content/en/docs/commands/addons.md b/site/content/en/docs/commands/addons.md index e2874bfb7c0b..4d0d44f4cd94 100644 --- a/site/content/en/docs/commands/addons.md +++ b/site/content/en/docs/commands/addons.md @@ -106,20 +106,27 @@ minikube addons disable ADDON_NAME [flags] ## minikube addons enable -Enables the addon w/ADDON_NAME within minikube (example: minikube addons enable dashboard). For a list of available addons use: minikube addons list +Enables the addon w/ADDON_NAME within minikube. For a list of available addons use: minikube addons list ### Synopsis -Enables the addon w/ADDON_NAME within minikube (example: minikube addons enable dashboard). For a list of available addons use: minikube addons list +Enables the addon w/ADDON_NAME within minikube. For a list of available addons use: minikube addons list ```shell minikube addons enable ADDON_NAME [flags] ``` +### Examples + +``` +minikube addons enable dashboard +``` + ### Options ``` - --images string Alpha feature. Image names used by this addon. Divided by comma. + --images string Images used by this addon. Divided by comma. + --registries string Registries used by this addon. Divided by comma. ``` ### Options inherited from parent commands