diff --git a/src/incubator/f5-bigip-ctlr/Chart.yaml b/src/incubator/f5-bigip-ctlr/Chart.yaml index 7d76edc89..18493bc9e 100644 --- a/src/incubator/f5-bigip-ctlr/Chart.yaml +++ b/src/incubator/f5-bigip-ctlr/Chart.yaml @@ -1,4 +1,9 @@ apiVersion: v1 description: Deploy the F5 Networks BIG-IP Controller for Kubernetes and OpenShift (k8s-bigip-ctlr). name: f5-bigip-ctlr -version: 0.0.4 +version: 0.0.5 +home: https://github.com/F5Networks/charts +keywords: + - f5-bigip +sources: + - https://clouddocs.f5.com/containers/v2/kubernetes/kctlr-k8s-ingress-ctlr.html diff --git a/src/incubator/f5-bigip-ctlr/templates/_helpers.tpl b/src/incubator/f5-bigip-ctlr/templates/_helpers.tpl index f5e1ca8c5..7b18eb30e 100644 --- a/src/incubator/f5-bigip-ctlr/templates/_helpers.tpl +++ b/src/incubator/f5-bigip-ctlr/templates/_helpers.tpl @@ -9,8 +9,35 @@ Expand the name of the chart. {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. */}} {{- define "f5-bigip-ctlr.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} {{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "f5-bigip-ctlr.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "f5-bigip-ctlr.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "f5-bigip-ctlr.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-clusterrole.yaml b/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-clusterrole.yaml index 33d482593..aae22f577 100644 --- a/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-clusterrole.yaml +++ b/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-clusterrole.yaml @@ -1,10 +1,11 @@ +{{- if .Values.rbac.create -}} kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: - name: f5-bigip-ctlr-clusterrole + name: {{ template "f5-bigip-ctlr.fullname" . }} labels: app: {{ template "f5-bigip-ctlr.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + chart: {{ template "f5-bigip-ctlr.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} rules: @@ -37,3 +38,4 @@ rules: - update - create - patch +{{- end -}} diff --git a/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-clusterrolebinding.yaml b/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-clusterrolebinding.yaml index 898aa1014..bc5e19a41 100644 --- a/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-clusterrolebinding.yaml +++ b/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-clusterrolebinding.yaml @@ -1,18 +1,19 @@ +{{- if .Values.rbac.create -}} kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1beta1 metadata: - name: f5-bigip-ctlr-clusterrolebinding - namespace: kube-system + name: {{ template "f5-bigip-ctlr.fullname" . }} labels: app: {{ template "f5-bigip-ctlr.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + chart: {{ template "f5-bigip-ctlr.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: f5-bigip-ctlr-clusterrole + name: {{ template "f5-bigip-ctlr.fullname" . }} subjects: - kind: ServiceAccount - name: f5-bigip-ctlr-serviceaccount - namespace: kube-system + name: {{ template "f5-bigip-ctlr.serviceAccountName" . }} + namespace: {{ .Release.Namespace | quote }} +{{- end -}} diff --git a/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-deploy.yaml b/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-deploy.yaml index 3a8acba98..109298600 100644 --- a/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-deploy.yaml +++ b/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-deploy.yaml @@ -9,10 +9,9 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: name: {{ template "f5-bigip-ctlr.fullname" . }} - namespace: {{ .Values.namespace }} labels: app: {{ template "f5-bigip-ctlr.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "-" }} + chart: {{ template "f5-bigip-ctlr.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: @@ -23,7 +22,7 @@ spec: app: {{ template "f5-bigip-ctlr.name" . }} release: {{ .Release.Name }} spec: - serviceAccountName: {{ .Values.serviceaccount }} + serviceAccountName: {{ template "f5-bigip-ctlr.serviceAccountName" . }} {{- if .Values.image.pullSecrets }} imagePullSecrets: {{- range $pullSecret := .Values.image.pullSecrets }} diff --git a/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-serviceaccount.yaml b/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-serviceaccount.yaml index 5c9e869e7..82cf570a9 100644 --- a/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-serviceaccount.yaml +++ b/src/incubator/f5-bigip-ctlr/templates/f5-bigip-ctlr-serviceaccount.yaml @@ -1,10 +1,13 @@ +{{- if .Values.rbac.create -}} +{{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount metadata: - name: f5-bigip-ctlr-serviceaccount - namespace: kube-system + name: {{ template "f5-bigip-ctlr.fullname" . }} labels: app: {{ template "f5-bigip-ctlr.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + chart: {{ template "f5-bigip-ctlr.chart" . }} release: {{ .Release.Name }} - heritage: {{ .Release.Service }} + heritage: {{ .Release.Service }} +{{- end -}} +{{- end -}} diff --git a/src/incubator/f5-bigip-ctlr/values.yaml b/src/incubator/f5-bigip-ctlr/values.yaml index f888276cd..d24828bcd 100644 --- a/src/incubator/f5-bigip-ctlr/values.yaml +++ b/src/incubator/f5-bigip-ctlr/values.yaml @@ -6,9 +6,18 @@ # To create a secret using kubectl see # http://clouddocs.f5.com/containers/latest/kubernetes/kctlr-secrets.html#secret-bigip-login bigip_login_secret: f5-bigip-ctlr-login -serviceaccount: f5-bigip-ctlr-serviceaccount -# This namespace is where the Controller lives; -namespace: kube-system + +rbac: + # Specifies whether RBAC resources should be created + create: true + +serviceAccount: + # Specifies whether a service account should be created + create: true + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: + args: # See http://clouddocs.f5.com/products/connectors/k8s-bigip-ctlr/latest/#controller-configuration-parameters # NOTE: helm has difficulty with values using `-`; `_` are used for naming