From 7d5f991538b2cf784645e7f1de71ff72800f8160 Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Tue, 23 Feb 2021 09:28:48 -0800 Subject: Add cmk addon helm chart The chart follows the instructions laid out in the CMK operator manual, with the following notes: - The nodes are prepared by running each CMK subcommand as a Pod instead of running cmk cluster-init. The first reason for this is that the existing addon only deploys CMK to the worker nodes in the cluster. This is not possible using cluster-init without explicitly providing the list of worker nodes to cluster-init, and this list is unknown by helm. Instead it is sufficient to rely on the node-role.kubernetes.io/master:NoSchedule taint. The second reason is that cluster-init creates resources which are unknown to helm, thus uninstall does not behave as expected. - The v1.4.1 version of CMK is chosen. In v1.5.2, the description key of the cmk-nodereport resource is not correct. - All values listed as possibly requiring modification are exposed in values.yaml Issue-ID: MULTICLOUD-1324 Signed-off-by: Todd Malsbary Change-Id: Ibc75462de3729cd88edeb4b15602d57fe12791ca --- .../helm/cpu-manager/templates/_helpers.tpl | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 kud/deployment_infra/helm/cpu-manager/templates/_helpers.tpl (limited to 'kud/deployment_infra/helm/cpu-manager/templates/_helpers.tpl') diff --git a/kud/deployment_infra/helm/cpu-manager/templates/_helpers.tpl b/kud/deployment_infra/helm/cpu-manager/templates/_helpers.tpl new file mode 100644 index 00000000..a0f94dc0 --- /dev/null +++ b/kud/deployment_infra/helm/cpu-manager/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "cpu-manager.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +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 "cpu-manager.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 "cpu-manager.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "cpu-manager.labels" -}} +helm.sh/chart: {{ include "cpu-manager.chart" . }} +{{ include "cpu-manager.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "cpu-manager.selectorLabels" -}} +app.kubernetes.io/name: {{ include "cpu-manager.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "cpu-manager.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default ( printf "%s-serviceaccount" (include "cpu-manager.fullname" .) ) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} -- cgit 1.2.3-korg