From 5e1db75db50fbb6e21d40588355ee943548eeb4a Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 13 Jun 2017 15:03:54 -0700 Subject: [PATCH] add registry addon This addon installs a docker registry into the cluster. --- cmd/minikube/cmd/config/config.go | 6 ++++++ cmd/minikube/cmd/start.go | 2 +- deploy/addons/registry/registry-rc.yaml | 24 ++++++++++++++++++++++++ deploy/addons/registry/registry-svc.yaml | 15 +++++++++++++++ pkg/minikube/assets/addons.go | 12 ++++++++++++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 deploy/addons/registry/registry-rc.yaml create mode 100644 deploy/addons/registry/registry-svc.yaml diff --git a/cmd/minikube/cmd/config/config.go b/cmd/minikube/cmd/config/config.go index 81633a89edcd..0a52c52e9be0 100644 --- a/cmd/minikube/cmd/config/config.go +++ b/cmd/minikube/cmd/config/config.go @@ -151,6 +151,12 @@ var settings = []Setting{ validations: []setFn{IsValidAddon}, callbacks: []setFn{EnableOrDisableAddon}, }, + { + name: "registry", + set: SetBool, + validations: []setFn{IsValidAddon}, + callbacks: []setFn{EnableOrDisableAddon}, + }, { name: "registry-creds", set: SetBool, diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index 46a78f533e2d..0b23c1f4901e 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -293,7 +293,7 @@ func init() { startCmd.Flags().StringArrayVar(&dockerOpt, "docker-opt", nil, "Specify arbitrary flags to pass to the Docker daemon. (format: key=value)") startCmd.Flags().String(apiServerName, constants.APIServerName, "The apiserver name which is used in the generated certificate for localkube/kubernetes. This can be used if you want to make the apiserver available from outside the machine") startCmd.Flags().String(dnsDomain, constants.ClusterDNSDomain, "The cluster dns domain name used in the kubernetes cluster") - startCmd.Flags().StringSliceVar(&insecureRegistry, "insecure-registry", nil, "Insecure Docker registries to pass to the Docker daemon") + startCmd.Flags().StringSliceVar(&insecureRegistry, "insecure-registry", []string{util.DefaultServiceClusterIP + "/24"}, "Insecure Docker registries to pass to the Docker daemon") startCmd.Flags().StringSliceVar(®istryMirror, "registry-mirror", nil, "Registry mirrors to pass to the Docker daemon") startCmd.Flags().String(kubernetesVersion, constants.DefaultKubernetesVersion, "The kubernetes version that the minikube VM will use (ex: v1.2.3) \n OR a URI which contains a localkube binary (ex: https://storage.googleapis.com/minikube/k8sReleases/v1.3.0/localkube-linux-amd64)") startCmd.Flags().String(containerRuntime, "", "The container runtime to be used") diff --git a/deploy/addons/registry/registry-rc.yaml b/deploy/addons/registry/registry-rc.yaml new file mode 100644 index 000000000000..cef4319fea7d --- /dev/null +++ b/deploy/addons/registry/registry-rc.yaml @@ -0,0 +1,24 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + labels: + kubernetes.io/minikube-addons: registry + addonmanager.kubernetes.io/mode: Reconcile + name: registry + namespace: kube-system +spec: + replicas: 1 + selector: + addonmanager.kubernetes.io/mode: Reconcile + template: + metadata: + labels: + addonmanager.kubernetes.io/mode: Reconcile + spec: + containers: + - image: registry:2.6.1 + imagePullPolicy: IfNotPresent + name: registry + ports: + - containerPort: 5000 + protocol: TCP diff --git a/deploy/addons/registry/registry-svc.yaml b/deploy/addons/registry/registry-svc.yaml new file mode 100644 index 000000000000..e9f618ae256d --- /dev/null +++ b/deploy/addons/registry/registry-svc.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + kubernetes.io/minikube-addons: registry + addonmanager.kubernetes.io/mode: Reconcile + name: registry + namespace: kube-system +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 5000 + selector: + kubernetes.io/minikube-addons: registry diff --git a/pkg/minikube/assets/addons.go b/pkg/minikube/assets/addons.go index 23434a145c8d..c689c3e51431 100644 --- a/pkg/minikube/assets/addons.go +++ b/pkg/minikube/assets/addons.go @@ -142,6 +142,18 @@ var Addons = map[string]*Addon{ "ingress-svc.yaml", "0640"), }, false, "ingress"), + "registry": NewAddon([]*MemoryAsset{ + NewMemoryAsset( + "deploy/addons/registry/registry-rc.yaml", + constants.AddonsPath, + "registry-rc.yaml", + "0640"), + NewMemoryAsset( + "deploy/addons/registry/registry-svc.yaml", + constants.AddonsPath, + "registry-svc.yaml", + "0640"), + }, false, "registry"), "registry-creds": NewAddon([]*MemoryAsset{ NewMemoryAsset( "deploy/addons/registry-creds/registry-creds-rc.yaml",