From 250d602085800cc9c5629aa491ed633300775a17 Mon Sep 17 00:00:00 2001 From: kairen Date: Fri, 12 Jan 2018 22:57:32 +0800 Subject: [PATCH 1/2] Add freshpod as a new addon --- cmd/minikube/cmd/config/config.go | 6 +++ deploy/addons/freshpod/freshpod-dp.yaml | 52 +++++++++++++++++++++++++ docs/addons.md | 8 ++-- pkg/minikube/assets/addons.go | 7 ++++ 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 deploy/addons/freshpod/freshpod-dp.yaml diff --git a/cmd/minikube/cmd/config/config.go b/cmd/minikube/cmd/config/config.go index 85d77f017327..067a4bfe72a1 100644 --- a/cmd/minikube/cmd/config/config.go +++ b/cmd/minikube/cmd/config/config.go @@ -184,6 +184,12 @@ var settings = []Setting{ validations: []setFn{IsValidAddon}, callbacks: []setFn{EnableOrDisableAddon}, }, + { + name: "freshpod", + set: SetBool, + validations: []setFn{IsValidAddon}, + callbacks: []setFn{EnableOrDisableAddon}, + }, { name: "default-storageclass", set: SetBool, diff --git a/deploy/addons/freshpod/freshpod-dp.yaml b/deploy/addons/freshpod/freshpod-dp.yaml new file mode 100644 index 000000000000..d8130fcec862 --- /dev/null +++ b/deploy/addons/freshpod/freshpod-dp.yaml @@ -0,0 +1,52 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: freshpod + namespace: kube-system + labels: + version: v0.0.1 + k8s-app: freshpod + tier: prod + kubernetes.io/minikube-addons: freshpod + addonmanager.kubernetes.io/mode: Reconcile +spec: + replicas: 1 + selector: + matchLabels: + version: v0.0.1 + k8s-app: freshpod + tier: prod + template: + metadata: + labels: + version: v0.0.1 + k8s-app: freshpod + tier: prod + spec: + containers: + - name: freshpod + image: gcr.io/google-samples/freshpod:v0.0.1 + imagePullPolicy: IfNotPresent + volumeMounts: + - name: docker + mountPath: /var/run/docker.sock + volumes: + - name: docker + hostPath: + type: Socket + path: /var/run/docker.sock + terminationGracePeriodSeconds: 1 diff --git a/docs/addons.md b/docs/addons.md index 7961a4f2d070..783acd0bdb4c 100644 --- a/docs/addons.md +++ b/docs/addons.md @@ -3,17 +3,18 @@ Minikube has a set of built in addons that can be used enabled, disabled, and opened inside of the local k8s environment. Below is an example of this functionality for the `heapster` addon: ```shell $ minikube addons list -- storage-provisioner: enabled - kube-dns: enabled - registry: disabled - registry-creds: disabled +- freshpod: disabled - addon-manager: enabled -- dashboard: disabled -- default-storageclass: enabled +- dashboard: enabled - coredns: disabled - heapster: disabled - efk: disabled - ingress: disabled +- default-storageclass: enabled +- storage-provisioner: enabled # minikube must be running for these commands to take effect $ minikube addons enable heapster @@ -34,6 +35,7 @@ The currently supported addons include: * [Registry Credentials](https://github.com/upmc-enterprises/registry-creds) * [CoreDNS](https://github.com/coredns/deployment/tree/master/kubernetes) * [Ingress](https://github.com/kubernetes/ingress-nginx) +* [Freshpod](https://github.com/GoogleCloudPlatform/freshpod) If you would like to have minikube properly start/restart custom addons, place the addon(s) you wish to be launched with minikube in the `.minikube/addons` directory. Addons in this folder will be moved to the minikube VM and launched each time minikube is started/restarted. diff --git a/pkg/minikube/assets/addons.go b/pkg/minikube/assets/addons.go index 8c0e2f251fcf..e4a230549413 100644 --- a/pkg/minikube/assets/addons.go +++ b/pkg/minikube/assets/addons.go @@ -233,6 +233,13 @@ var Addons = map[string]*Addon{ "registry-creds-rc.yaml", "0640"), }, false, "registry-creds"), + "freshpod": NewAddon([]*BinDataAsset{ + NewBinDataAsset( + "deploy/addons/freshpod/freshpod-dp.yaml", + constants.AddonsPath, + "freshpod-dp.yaml", + "0640"), + }, false, "freshpod"), } func AddMinikubeDirAssets(assets *[]CopyableFile) error { From 53d6e9d7a20e8389cba92abc888a9254c1993059 Mon Sep 17 00:00:00 2001 From: kairen Date: Sat, 13 Jan 2018 02:14:26 +0800 Subject: [PATCH 2/2] Change freshpod from Deployment to RC --- .../{freshpod-dp.yaml => freshpod-rc.yaml} | 15 +++++---------- pkg/minikube/assets/addons.go | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) rename deploy/addons/freshpod/{freshpod-dp.yaml => freshpod-rc.yaml} (86%) diff --git a/deploy/addons/freshpod/freshpod-dp.yaml b/deploy/addons/freshpod/freshpod-rc.yaml similarity index 86% rename from deploy/addons/freshpod/freshpod-dp.yaml rename to deploy/addons/freshpod/freshpod-rc.yaml index d8130fcec862..71680c7cf139 100644 --- a/deploy/addons/freshpod/freshpod-dp.yaml +++ b/deploy/addons/freshpod/freshpod-rc.yaml @@ -12,30 +12,25 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: apps/v1 -kind: Deployment +apiVersion: v1 +kind: ReplicationController metadata: name: freshpod namespace: kube-system labels: - version: v0.0.1 k8s-app: freshpod - tier: prod kubernetes.io/minikube-addons: freshpod addonmanager.kubernetes.io/mode: Reconcile spec: replicas: 1 selector: - matchLabels: - version: v0.0.1 - k8s-app: freshpod - tier: prod + k8s-app: freshpod + addonmanager.kubernetes.io/mode: Reconcile template: metadata: labels: - version: v0.0.1 k8s-app: freshpod - tier: prod + addonmanager.kubernetes.io/mode: Reconcile spec: containers: - name: freshpod diff --git a/pkg/minikube/assets/addons.go b/pkg/minikube/assets/addons.go index e4a230549413..abc7850307cc 100644 --- a/pkg/minikube/assets/addons.go +++ b/pkg/minikube/assets/addons.go @@ -235,9 +235,9 @@ var Addons = map[string]*Addon{ }, false, "registry-creds"), "freshpod": NewAddon([]*BinDataAsset{ NewBinDataAsset( - "deploy/addons/freshpod/freshpod-dp.yaml", + "deploy/addons/freshpod/freshpod-rc.yaml", constants.AddonsPath, - "freshpod-dp.yaml", + "freshpod-rc.yaml", "0640"), }, false, "freshpod"), }