From 985e0dc2a873d48b287ace7ee12247cea21101f9 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Mon, 6 Nov 2017 12:41:34 -0800 Subject: [PATCH] Make voyager chart namespaced (#2661) --- stable/voyager/Chart.yaml | 4 +-- stable/voyager/README.md | 19 ++++++---- stable/voyager/templates/NOTES.txt | 2 +- stable/voyager/templates/_helpers.tpl | 10 +++--- .../templates/cluster-role-binding.yaml | 8 ++--- stable/voyager/templates/cluster-role.yaml | 33 +++++++++++------ stable/voyager/templates/deployment.yaml | 35 +++++++++++++++---- stable/voyager/templates/service-account.yaml | 4 +-- stable/voyager/templates/service.yaml | 13 ++++--- stable/voyager/values.yaml | 32 +++++++++++++++-- 10 files changed, 115 insertions(+), 45 deletions(-) diff --git a/stable/voyager/Chart.yaml b/stable/voyager/Chart.yaml index 436fbfc7b5..7e93d8eb26 100755 --- a/stable/voyager/Chart.yaml +++ b/stable/voyager/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v1 description: 'Voyager by AppsCode - Secure Ingress Controller for Kubernetes' icon: https://cdn.appscode.com/images/icon/voyager.png name: voyager -version: 1.2.0 -appVersion: 3.2.1 +version: 2.0.0 +appVersion: 5.0.0-rc.3 sources: - https://github.com/appscode/voyager maintainers: diff --git a/stable/voyager/README.md b/stable/voyager/README.md index 79368c000a..d0c7314986 100644 --- a/stable/voyager/README.md +++ b/stable/voyager/README.md @@ -14,7 +14,7 @@ This chart bootstraps an [ingress controller](https://github.com/appscode/voyage ## Prerequisites -- Kubernetes 1.3+ +- Kubernetes 1.7+ ## Installing the Chart To install the chart with the release name `my-release`: @@ -42,16 +42,24 @@ The following tables lists the configurable parameters of the Voyager chart and | Parameter | Description | Default | | --------------------------| ------------------------------------------------------------- | ------------------ | -| `image` | Container image to run | `appscode/voyager` | -| `imageTag` | Image tag of container | `3.2.1` | +| `operator.image` | Name of Voyager operator image | `appscode/voyager` | +| `operator.imageTag` | Tag of Voyager operator image | `5.0.0-rc.3` | +| `haproxy.image` | Name of HAProxy container image | `appscode/haproxy` | +| `haproxy.imageTag` | Tag of HAProxy container image | `1.7.9-5.0.0-rc.3` | +| `exporter.image` | Name of Prometheus exporter sidecar image | `appscode/voyager` | +| `exporter.imageTag` | Tag of Prometheus exporter sidecar image | `5.0.0-rc.3` | +| `imagePullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) | +| `imagePullPolicy` | Image pull policy | `IfNotPresent` | | `cloudProvider` | Name of cloud provider | `nil` | -| `cloudConfig` | Path to cloud config | `nil` | +| `cloudConfig` | Path to cloud config | `` | +| `criticalAddon` | If true, installs voyager operator as critical addon | `false` | | `logLevel` | Log level for operator | `3` | | `persistence.enabled` | Enable mounting cloud config | `false` | | `persistence.hostPath` | Host mount path for cloud config | `/etc/kubernetes` | -| `nodeSelector` | Node labels for pod assignment | `{}` | +| `nodeSelector` | Node labels for pod assignment | `{}` | | `rbac.create` | install required rbac service account, roles and rolebindings | `false` | | `rbac.serviceAccountName` | ServiceAccount Voyager will use (ignored if rbac.create=true) | `default` | +| `ingressClass` | Ingress class to watch for. If empty, it handles all ingress | `` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example: @@ -87,4 +95,3 @@ To enable the creation of RBAC resources (On clusters with RBAC). Do the followi ```console $ helm install --name my-release stable/voyager --set rbac.create=true ``` - diff --git a/stable/voyager/templates/NOTES.txt b/stable/voyager/templates/NOTES.txt index 442db2da4c..256b85956c 100644 --- a/stable/voyager/templates/NOTES.txt +++ b/stable/voyager/templates/NOTES.txt @@ -2,4 +2,4 @@ Set cloudProvider for installing Voyager To verify that Voyager has started, run: - kubectl --namespace={{ .Release.Namespace }} get deployments -l "release={{ .Release.Name }}, app={{ template "name" . }}" + kubectl --namespace={{ .Release.Namespace }} get deployments -l "release={{ .Release.Name }}, app={{ template "voyager.name" . }}" diff --git a/stable/voyager/templates/_helpers.tpl b/stable/voyager/templates/_helpers.tpl index 29aa46c86e..fac1747be1 100644 --- a/stable/voyager/templates/_helpers.tpl +++ b/stable/voyager/templates/_helpers.tpl @@ -2,15 +2,15 @@ {{/* Expand the name of the chart. */}} -{{- define "name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 24 -}} +{{- define "voyager.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* Create a default fully qualified app name. -We truncate at 45 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} -{{- define "fullname" -}} +{{- define "voyager.fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} -{{- printf "%s-%s" $name .Release.Name | trunc 45 -}} +{{- printf "%s-%s" $name .Release.Name | trunc 63 -}} {{- end -}} diff --git a/stable/voyager/templates/cluster-role-binding.yaml b/stable/voyager/templates/cluster-role-binding.yaml index 4f6873064c..cec56a6ba9 100644 --- a/stable/voyager/templates/cluster-role-binding.yaml +++ b/stable/voyager/templates/cluster-role-binding.yaml @@ -2,18 +2,18 @@ apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: - name: {{ template "fullname" . }} + name: {{ template "voyager.fullname" . }} labels: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - app: "{{ template "name" . }}" + app: "{{ template "voyager.name" . }}" heritage: "{{ .Release.Service }}" release: "{{ .Release.Name }}" roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: {{ template "fullname" . }} + name: {{ template "voyager.fullname" . }} subjects: - kind: ServiceAccount - name: {{ template "fullname" . }} + name: {{ template "voyager.fullname" . }} namespace: {{ .Release.Namespace }} {{ end }} diff --git a/stable/voyager/templates/cluster-role.yaml b/stable/voyager/templates/cluster-role.yaml index 26af91c129..2ad78d39a2 100644 --- a/stable/voyager/templates/cluster-role.yaml +++ b/stable/voyager/templates/cluster-role.yaml @@ -2,18 +2,25 @@ apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRole metadata: - name: {{ template "fullname" . }} + name: {{ template "voyager.fullname" . }} labels: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - app: "{{ template "name" . }}" + app: "{{ template "voyager.name" . }}" heritage: "{{ .Release.Service }}" release: "{{ .Release.Name }}" rules: +- apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - "*" - apiGroups: - extensions resources: - thirdpartyresources - verbs: ["get", "create", "list"] + verbs: + - "*" - apiGroups: - voyager.appscode.com resources: ["*"] @@ -22,7 +29,12 @@ rules: - monitoring.coreos.com resources: - servicemonitors - verbs: ["get", "create", "update"] + verbs: ["get", "create", "update", "patch"] +- apiGroups: + - apps + resources: + - deployments + verbs: ["*"] - apiGroups: - extensions resources: @@ -40,7 +52,7 @@ rules: - apiGroups: [""] resources: - secrets - verbs: ["get", "list", "watch", "create", "update"] + verbs: ["get", "list", "watch", "create", "update", "patch"] - apiGroups: [""] resources: - namespaces @@ -52,7 +64,7 @@ rules: - apiGroups: [""] resources: - pods - verbs: ["list", "watch", "delete"] + verbs: ["list", "watch", "delete", "deletecollection"] - apiGroups: [""] resources: - nodes @@ -60,10 +72,11 @@ rules: - apiGroups: [""] resources: - serviceaccounts - verbs: ["get", "create", "delete"] -- apiGroups: ["rbac.authorization.k8s.io"] + verbs: ["get", "create", "delete", "patch"] +- apiGroups: + - rbac.authorization.k8s.io resources: - - roles - rolebindings - verbs: ["get", "create", "delete"] + - roles + verbs: ["get", "create", "delete", "patch"] {{ end }} diff --git a/stable/voyager/templates/deployment.yaml b/stable/voyager/templates/deployment.yaml index 24220520b6..d85a336ab9 100644 --- a/stable/voyager/templates/deployment.yaml +++ b/stable/voyager/templates/deployment.yaml @@ -1,10 +1,10 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: {{ template "fullname" . }} + name: {{ template "voyager.fullname" . }} labels: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - app: "{{ template "name" . }}" + app: "{{ template "voyager.name" . }}" heritage: "{{ .Release.Service }}" release: "{{ .Release.Name }}" spec: @@ -12,22 +12,38 @@ spec: template: metadata: labels: - app: "{{ template "name" . }}" + app: "{{ template "voyager.name" . }}" release: "{{ .Release.Name }}" +{{- if and .Values.criticalAddon (eq .Release.Namespace "kube-system") }} + annotations: + scheduler.alpha.kubernetes.io/critical-pod: '' +{{- end }} spec: - serviceAccountName: {{ if .Values.rbac.create }}{{ template "fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }} + serviceAccountName: {{ if .Values.rbac.create }}{{ template "voyager.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }} containers: - name: operator - image: {{ .Values.image }}:{{ .Values.imageTag }} + image: {{ .Values.operator.image }}:{{ .Values.operator.imageTag }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} args: - run - --cloud-provider={{ .Values.cloudProvider }} - --cloud-config={{ .Values.cloudConfig }} - --v={{ .Values.logLevel }} - --rbac={{ .Values.rbac.create }} + - --ingress-class={{ .Values.ingressClass }} + - --operator-service={{ template "voyager.fullname" . }} + - --haproxy-image={{ .Values.haproxy.image }}:{{ .Values.haproxy.imageTag }} + - --exporter-sidecar-image={{ .Values.exporter.image }}:{{ .Values.exporter.imageTag }} ports: - containerPort: 56790 - name: http + name: ops + protocol: TCP + - containerPort: 56791 + name: acme protocol: TCP {{- if .Values.persistence.enabled }} volumeMounts: @@ -39,7 +55,12 @@ spec: path: {{ .Values.persistence.hostPath | quote }} name: cloudconfig {{- end -}} - {{- if .Values.nodeSelector }} +{{- if and .Values.criticalAddon (eq .Release.Namespace "kube-system") }} + tolerations: + - key: "CriticalAddonsOnly" + operator: "Exists" +{{- end -}} +{{- if .Values.nodeSelector }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }} {{- end -}} diff --git a/stable/voyager/templates/service-account.yaml b/stable/voyager/templates/service-account.yaml index 94390a5262..e0da2652ed 100644 --- a/stable/voyager/templates/service-account.yaml +++ b/stable/voyager/templates/service-account.yaml @@ -2,10 +2,10 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ template "fullname" . }} + name: {{ template "voyager.fullname" . }} labels: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - app: "{{ template "name" . }}" + app: "{{ template "voyager.name" . }}" heritage: "{{ .Release.Service }}" release: "{{ .Release.Name }}" {{ end }} diff --git a/stable/voyager/templates/service.yaml b/stable/voyager/templates/service.yaml index b0196e9570..5c15d416d9 100644 --- a/stable/voyager/templates/service.yaml +++ b/stable/voyager/templates/service.yaml @@ -1,17 +1,20 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "fullname" . }} + name: {{ template "voyager.fullname" . }} labels: - app: "{{ template "name" . }}" + app: "{{ template "voyager.name" . }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" spec: ports: - - name: http + - name: ops port: 56790 - targetPort: http + targetPort: ops + - name: acme + port: 56791 + targetPort: acme selector: - app: "{{ template "name" . }}" + app: "{{ template "voyager.name" . }}" release: "{{ .Release.Name }}" diff --git a/stable/voyager/values.yaml b/stable/voyager/values.yaml index f8ec861155..98e9e28010 100644 --- a/stable/voyager/values.yaml +++ b/stable/voyager/values.yaml @@ -1,13 +1,35 @@ ## ## Voyager chart configuration ## -image: appscode/voyager -imageTag: 3.2.1 +operator: + image: appscode/voyager + imageTag: 5.0.0-rc.3 +## Docker image containing HAProxy binary +haproxy: + image: appscode/haproxy + imageTag: 1.7.9-5.0.0-rc.3 +## Docker image containing Prometheus exporter +exporter: + image: appscode/voyager + imageTag: 5.0.0-rc.3 +## Optionally specify an array of imagePullSecrets. +## Secrets must be manually created in the namespace. +## ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod +## +# imagePullSecrets: +# - name: myRegistryKeySecretName +## Specify a imagePullPolicy +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +imagePullPolicy: IfNotPresent ## Use cloud provider here. Read details https://github.com/appscode/voyager/blob/master/docs/user-guide/README.md cloudProvider: ## The path to the cloud provider configuration file. Empty string for no configuration file. ## ie. for azure use /etc/kubernetes/azure.json -# cloudConfig: /etc/kubernetes/azure.json +cloudConfig: '' +## Installs voyager operator as critical addon +## https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/ +criticalAddon: false ## Log level for voyager logLevel: 3 persistence: @@ -25,3 +47,7 @@ rbac: create: false ## Ignored if rbac.create is true serviceAccountName: default + +# this flag can be set to 'voyager' to handle only ingress +# with annotation kubernetes.io/ingress.class=voyager. +ingressClass: