From 2adb1cf6f62fd224b71031f40a07c694b8c048a4 Mon Sep 17 00:00:00 2001 From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de> Date: Sat, 27 Mar 2021 18:28:38 +0100 Subject: [PATCH] Introduce a simple helm chart for the theodlite operator --- .../.helmignore | 0 .../Chart.yaml | 0 .../{ => theodolite-infrastructure}/README.md | 0 .../build-package.sh | 0 .../preconfigs/one-broker-values.yaml | 0 .../templates/NOTES.txt | 0 .../templates/_helpers.tpl | 0 .../templates/cluster-role-binding.yaml | 0 .../templates/cluster-role.yaml | 0 .../templates/dashboard-config-map.yaml | 0 .../templates/kafka-client.yaml | 0 .../prometheus-datasource-config-map.yaml | 0 .../templates/prometheus.yaml | 0 .../templates/service-account.yaml | 0 .../templates/service-monitor.yaml | 0 .../templates/tests/test-connection.yaml | 0 .../update-index.sh | 0 .../values.yaml | 0 .../helm/theodolite-operator/.helmignore | 23 +++++++ execution/helm/theodolite-operator/Chart.yaml | 24 +++++++ .../theodolite-operator/templates/NOTES.txt | 5 ++ .../templates/_helpers.tpl | 62 +++++++++++++++++++ .../templates/benchmarkCRD.yaml | 15 +++++ .../templates/executionCRD.yaml | 15 +++++ .../templates/role-binding.yaml | 15 +++++ .../theodolite-operator/templates/role.yaml | 56 +++++++++++++++++ .../templates/serviceaccount.yaml | 12 ++++ .../templates/thedolite-operator.yaml | 26 ++++++++ .../helm/theodolite-operator/values.yaml | 15 +++++ 29 files changed, 268 insertions(+) rename execution/helm/{ => theodolite-infrastructure}/.helmignore (100%) rename execution/helm/{ => theodolite-infrastructure}/Chart.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/README.md (100%) rename execution/helm/{ => theodolite-infrastructure}/build-package.sh (100%) rename execution/helm/{ => theodolite-infrastructure}/preconfigs/one-broker-values.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/NOTES.txt (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/_helpers.tpl (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/cluster-role-binding.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/cluster-role.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/dashboard-config-map.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/kafka-client.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/prometheus-datasource-config-map.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/prometheus.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/service-account.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/service-monitor.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/templates/tests/test-connection.yaml (100%) rename execution/helm/{ => theodolite-infrastructure}/update-index.sh (100%) rename execution/helm/{ => theodolite-infrastructure}/values.yaml (100%) create mode 100644 execution/helm/theodolite-operator/.helmignore create mode 100644 execution/helm/theodolite-operator/Chart.yaml create mode 100644 execution/helm/theodolite-operator/templates/NOTES.txt create mode 100644 execution/helm/theodolite-operator/templates/_helpers.tpl create mode 100644 execution/helm/theodolite-operator/templates/benchmarkCRD.yaml create mode 100644 execution/helm/theodolite-operator/templates/executionCRD.yaml create mode 100644 execution/helm/theodolite-operator/templates/role-binding.yaml create mode 100644 execution/helm/theodolite-operator/templates/role.yaml create mode 100644 execution/helm/theodolite-operator/templates/serviceaccount.yaml create mode 100644 execution/helm/theodolite-operator/templates/thedolite-operator.yaml create mode 100644 execution/helm/theodolite-operator/values.yaml diff --git a/execution/helm/.helmignore b/execution/helm/theodolite-infrastructure/.helmignore similarity index 100% rename from execution/helm/.helmignore rename to execution/helm/theodolite-infrastructure/.helmignore diff --git a/execution/helm/Chart.yaml b/execution/helm/theodolite-infrastructure/Chart.yaml similarity index 100% rename from execution/helm/Chart.yaml rename to execution/helm/theodolite-infrastructure/Chart.yaml diff --git a/execution/helm/README.md b/execution/helm/theodolite-infrastructure/README.md similarity index 100% rename from execution/helm/README.md rename to execution/helm/theodolite-infrastructure/README.md diff --git a/execution/helm/build-package.sh b/execution/helm/theodolite-infrastructure/build-package.sh similarity index 100% rename from execution/helm/build-package.sh rename to execution/helm/theodolite-infrastructure/build-package.sh diff --git a/execution/helm/preconfigs/one-broker-values.yaml b/execution/helm/theodolite-infrastructure/preconfigs/one-broker-values.yaml similarity index 100% rename from execution/helm/preconfigs/one-broker-values.yaml rename to execution/helm/theodolite-infrastructure/preconfigs/one-broker-values.yaml diff --git a/execution/helm/templates/NOTES.txt b/execution/helm/theodolite-infrastructure/templates/NOTES.txt similarity index 100% rename from execution/helm/templates/NOTES.txt rename to execution/helm/theodolite-infrastructure/templates/NOTES.txt diff --git a/execution/helm/templates/_helpers.tpl b/execution/helm/theodolite-infrastructure/templates/_helpers.tpl similarity index 100% rename from execution/helm/templates/_helpers.tpl rename to execution/helm/theodolite-infrastructure/templates/_helpers.tpl diff --git a/execution/helm/templates/cluster-role-binding.yaml b/execution/helm/theodolite-infrastructure/templates/cluster-role-binding.yaml similarity index 100% rename from execution/helm/templates/cluster-role-binding.yaml rename to execution/helm/theodolite-infrastructure/templates/cluster-role-binding.yaml diff --git a/execution/helm/templates/cluster-role.yaml b/execution/helm/theodolite-infrastructure/templates/cluster-role.yaml similarity index 100% rename from execution/helm/templates/cluster-role.yaml rename to execution/helm/theodolite-infrastructure/templates/cluster-role.yaml diff --git a/execution/helm/templates/dashboard-config-map.yaml b/execution/helm/theodolite-infrastructure/templates/dashboard-config-map.yaml similarity index 100% rename from execution/helm/templates/dashboard-config-map.yaml rename to execution/helm/theodolite-infrastructure/templates/dashboard-config-map.yaml diff --git a/execution/helm/templates/kafka-client.yaml b/execution/helm/theodolite-infrastructure/templates/kafka-client.yaml similarity index 100% rename from execution/helm/templates/kafka-client.yaml rename to execution/helm/theodolite-infrastructure/templates/kafka-client.yaml diff --git a/execution/helm/templates/prometheus-datasource-config-map.yaml b/execution/helm/theodolite-infrastructure/templates/prometheus-datasource-config-map.yaml similarity index 100% rename from execution/helm/templates/prometheus-datasource-config-map.yaml rename to execution/helm/theodolite-infrastructure/templates/prometheus-datasource-config-map.yaml diff --git a/execution/helm/templates/prometheus.yaml b/execution/helm/theodolite-infrastructure/templates/prometheus.yaml similarity index 100% rename from execution/helm/templates/prometheus.yaml rename to execution/helm/theodolite-infrastructure/templates/prometheus.yaml diff --git a/execution/helm/templates/service-account.yaml b/execution/helm/theodolite-infrastructure/templates/service-account.yaml similarity index 100% rename from execution/helm/templates/service-account.yaml rename to execution/helm/theodolite-infrastructure/templates/service-account.yaml diff --git a/execution/helm/templates/service-monitor.yaml b/execution/helm/theodolite-infrastructure/templates/service-monitor.yaml similarity index 100% rename from execution/helm/templates/service-monitor.yaml rename to execution/helm/theodolite-infrastructure/templates/service-monitor.yaml diff --git a/execution/helm/templates/tests/test-connection.yaml b/execution/helm/theodolite-infrastructure/templates/tests/test-connection.yaml similarity index 100% rename from execution/helm/templates/tests/test-connection.yaml rename to execution/helm/theodolite-infrastructure/templates/tests/test-connection.yaml diff --git a/execution/helm/update-index.sh b/execution/helm/theodolite-infrastructure/update-index.sh similarity index 100% rename from execution/helm/update-index.sh rename to execution/helm/theodolite-infrastructure/update-index.sh diff --git a/execution/helm/values.yaml b/execution/helm/theodolite-infrastructure/values.yaml similarity index 100% rename from execution/helm/values.yaml rename to execution/helm/theodolite-infrastructure/values.yaml diff --git a/execution/helm/theodolite-operator/.helmignore b/execution/helm/theodolite-operator/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/execution/helm/theodolite-operator/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/execution/helm/theodolite-operator/Chart.yaml b/execution/helm/theodolite-operator/Chart.yaml new file mode 100644 index 000000000..3e029303c --- /dev/null +++ b/execution/helm/theodolite-operator/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: theodolite-operator +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/execution/helm/theodolite-operator/templates/NOTES.txt b/execution/helm/theodolite-operator/templates/NOTES.txt new file mode 100644 index 000000000..495545db9 --- /dev/null +++ b/execution/helm/theodolite-operator/templates/NOTES.txt @@ -0,0 +1,5 @@ +Welcome to Theodolite! + +This is the Theodolite operator. Deploy executions and benchmarks to start benchmarks. + +Visit https://cau-se.github.io/theodolite for getting started and more information. diff --git a/execution/helm/theodolite-operator/templates/_helpers.tpl b/execution/helm/theodolite-operator/templates/_helpers.tpl new file mode 100644 index 000000000..a495f0e81 --- /dev/null +++ b/execution/helm/theodolite-operator/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "theodolite-operator.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 "theodolite-operator.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 "theodolite-operator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "theodolite-operator.labels" -}} +helm.sh/chart: {{ include "theodolite-operator.chart" . }} +{{ include "theodolite-operator.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "theodolite-operator.selectorLabels" -}} +app.kubernetes.io/name: {{ include "theodolite-operator.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "theodolite-operator.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "theodolite-operator.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/execution/helm/theodolite-operator/templates/benchmarkCRD.yaml b/execution/helm/theodolite-operator/templates/benchmarkCRD.yaml new file mode 100644 index 000000000..9d7468b49 --- /dev/null +++ b/execution/helm/theodolite-operator/templates/benchmarkCRD.yaml @@ -0,0 +1,15 @@ +{{- if .Values.benchmarkCRD.create -}} +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: benchmarks.theodolite.com +spec: + group: theodolite.com + version: v1alpha1 + names: + kind: benchmark + plural: benchmarks + scope: Namespaced + subresources: + status: {} +{{- end }} \ No newline at end of file diff --git a/execution/helm/theodolite-operator/templates/executionCRD.yaml b/execution/helm/theodolite-operator/templates/executionCRD.yaml new file mode 100644 index 000000000..73b58397b --- /dev/null +++ b/execution/helm/theodolite-operator/templates/executionCRD.yaml @@ -0,0 +1,15 @@ +{{- if .Values.executionCRD.create -}} +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: executions.theodolite.com +spec: + group: theodolite.com + version: v1alpha1 + names: + kind: execution + plural: executions + scope: Namespaced + subresources: + status: {} +{{- end }} \ No newline at end of file diff --git a/execution/helm/theodolite-operator/templates/role-binding.yaml b/execution/helm/theodolite-operator/templates/role-binding.yaml new file mode 100644 index 000000000..ee13c45ee --- /dev/null +++ b/execution/helm/theodolite-operator/templates/role-binding.yaml @@ -0,0 +1,15 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: RoleBinding +metadata: + name: {{ include "theodolite-operator.fullname" . }} + labels: + app: {{ include "theodolite-operator.name" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ include "theodolite-operator.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ include "theodolite-operator.serviceAccountName" . }} +{{- end }} \ No newline at end of file diff --git a/execution/helm/theodolite-operator/templates/role.yaml b/execution/helm/theodolite-operator/templates/role.yaml new file mode 100644 index 000000000..2ce70d282 --- /dev/null +++ b/execution/helm/theodolite-operator/templates/role.yaml @@ -0,0 +1,56 @@ +{{- if .Values.rbac.create -}} +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ include "theodolite-operator.fullname" . }} +rules: + - apiGroups: + - apps + resources: + - deployments + verbs: + - delete + - list + - get + - create + - apiGroups: + - "" + resources: + - services + - pods + - servicemonitors + - configmaps + verbs: + - delete + - list + - get + - create + - apiGroups: + - "" + resources: + - pods/exec + verbs: + - create + - get + - apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - delete + - list + - create + - apiGroups: + - theodolite.com + resources: + - executions + - benchmarks + verbs: + - delete + - list + - get + - create + - watch + - update + - patch +{{- end }} \ No newline at end of file diff --git a/execution/helm/theodolite-operator/templates/serviceaccount.yaml b/execution/helm/theodolite-operator/templates/serviceaccount.yaml new file mode 100644 index 000000000..5f6596932 --- /dev/null +++ b/execution/helm/theodolite-operator/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "theodolite-operator.serviceAccountName" . }} + labels: + {{- include "theodolite-operator.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/execution/helm/theodolite-operator/templates/thedolite-operator.yaml b/execution/helm/theodolite-operator/templates/thedolite-operator.yaml new file mode 100644 index 000000000..6f9a57198 --- /dev/null +++ b/execution/helm/theodolite-operator/templates/thedolite-operator.yaml @@ -0,0 +1,26 @@ +{{- if .Values.operator.enabled -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "theodolite-operator.fullname" . }} +spec: + selector: + matchLabels: + app: theodolite + replicas: 1 + template: + metadata: + labels: + app: theodolite + spec: + terminationGracePeriodSeconds: 0 + serviceAccountName: {{ include "theodolite-operator.serviceAccountName" . }} + containers: + - name: thedolite + image: lorenzboguhn/thedolite:latest + env: + - name: KUBECONFIG + value: "~/.kube/config" + - name: NAMESPACE + value: {{ .Values.operator.namespace}} +{{- end }} diff --git a/execution/helm/theodolite-operator/values.yaml b/execution/helm/theodolite-operator/values.yaml new file mode 100644 index 000000000..b0f8cc0bf --- /dev/null +++ b/execution/helm/theodolite-operator/values.yaml @@ -0,0 +1,15 @@ +operator: + enabled: true + namespace: "default" + +executionCRD: + create: true + +benchmarkCRD: + create: true + +serviceAccount: + create: true + +rbac: + create: true \ No newline at end of file -- GitLab