From c5b39d180ad80673b5cbf176bda1ce3558b213ae Mon Sep 17 00:00:00 2001 From: Tae Park Date: Fri, 24 Jan 2025 10:51:17 -0500 Subject: [PATCH] Add isApplication functionality for openbao pods Adding the isApplication function described in https://wiki.openstack.org/wiki/StarlingX/Containers/Applications/HowToAddNewFluxCDAppInSTX#7.4_Select_CPU_Cores_for_pods. to Openbao pods. The function will have dedicated values in values.yaml to switch the server pod, injector pod, and csi pod between application and platform cores. Signed-off-by: Tae Park --- charts/openbao/templates/_helpers.tpl | 11 +++++++---- charts/openbao/templates/csi-daemonset.yaml | 1 + .../openbao/templates/injector-deployment.yaml | 1 + .../openbao/templates/server-statefulset.yaml | 1 + charts/openbao/values.yaml | 18 ++++++++++++++++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/charts/openbao/templates/_helpers.tpl b/charts/openbao/templates/_helpers.tpl index 08c71ee..a61042d 100644 --- a/charts/openbao/templates/_helpers.tpl +++ b/charts/openbao/templates/_helpers.tpl @@ -448,6 +448,7 @@ Sets extra pod annotations */}} {{- define "openbao.annotations" }} annotations: + app.starlingx.io/config-checksum: {{ toYaml .Values.server.labels | sha256sum }} {{- if .Values.server.configAnnotation }} openbao.hashicorp.com/config-checksum: {{ include "openbao.config" . | sha256sum }} {{- end }} @@ -464,9 +465,10 @@ Sets extra pod annotations {{/* Sets extra injector pod annotations */}} -{{- define "injector.annotations" -}} - {{- if .Values.injector.annotations }} +{{- define "injector.annotations" }} annotations: + app.starlingx.io/config-checksum: {{ toYaml .Values.injector.labels | sha256sum }} + {{- if .Values.injector.annotations }} {{- $tp := typeOf .Values.injector.annotations }} {{- if eq $tp "string" }} {{- tpl .Values.injector.annotations . | nindent 8 }} @@ -953,9 +955,10 @@ Sets the CSI provider affinity for pod placement. {{/* Sets extra CSI provider pod annotations */}} -{{- define "csi.pod.annotations" -}} - {{- if .Values.csi.pod.annotations }} +{{- define "csi.pod.annotations" }} annotations: + app.starlingx.io/config-checksum: {{ toYaml .Values.csi.labels | sha256sum }} + {{- if .Values.csi.pod.annotations }} {{- $tp := typeOf .Values.csi.pod.annotations }} {{- if eq $tp "string" }} {{- tpl .Values.csi.pod.annotations . | nindent 8 }} diff --git a/charts/openbao/templates/csi-daemonset.yaml b/charts/openbao/templates/csi-daemonset.yaml index 1ace436..53b51f6 100644 --- a/charts/openbao/templates/csi-daemonset.yaml +++ b/charts/openbao/templates/csi-daemonset.yaml @@ -34,6 +34,7 @@ spec: labels: app.kubernetes.io/name: {{ template "openbao.name" . }}-csi-provider app.kubernetes.io/instance: {{ .Release.Name }} + app.starlingx.io/component: {{ ternary "application" "platform" .Values.csi.labels.isApplication }} {{- if .Values.csi.pod.extraLabels -}} {{- toYaml .Values.csi.pod.extraLabels | nindent 8 -}} {{- end -}} diff --git a/charts/openbao/templates/injector-deployment.yaml b/charts/openbao/templates/injector-deployment.yaml index d66f6d1..d4a1a53 100644 --- a/charts/openbao/templates/injector-deployment.yaml +++ b/charts/openbao/templates/injector-deployment.yaml @@ -29,6 +29,7 @@ spec: labels: app.kubernetes.io/name: {{ template "openbao.name" . }}-agent-injector app.kubernetes.io/instance: {{ .Release.Name }} + app.starlingx.io/component: {{ ternary "application" "platform" .Values.injector.labels.isApplication }} component: webhook {{- if .Values.injector.extraLabels -}} {{- toYaml .Values.injector.extraLabels | nindent 8 -}} diff --git a/charts/openbao/templates/server-statefulset.yaml b/charts/openbao/templates/server-statefulset.yaml index c4f0840..3c704cd 100644 --- a/charts/openbao/templates/server-statefulset.yaml +++ b/charts/openbao/templates/server-statefulset.yaml @@ -38,6 +38,7 @@ spec: helm.sh/chart: {{ template "openbao.chart" . }} app.kubernetes.io/name: {{ template "openbao.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} + app.starlingx.io/component: {{ ternary "application" "platform" .Values.server.labels.isApplication }} component: server {{- if .Values.server.extraLabels -}} {{- toYaml .Values.server.extraLabels | nindent 8 -}} diff --git a/charts/openbao/values.yaml b/charts/openbao/values.yaml index bc82fc8..6d34869 100644 --- a/charts/openbao/values.yaml +++ b/charts/openbao/values.yaml @@ -369,6 +369,12 @@ injector: # maxUnavailable: 25% # type: RollingUpdate + # For setting the "app.starlingx.io/component" label for Openbao injector pod + # Setting this to "true" will make the pod run on "application" cores, + # While setting this to "false" will make the pod run on "platform" cores. + labels: + isApplication: false + server: # If true, or "-" with global.enabled true, OpenBao server will be installed. # See openbao.mode in _helpers.tpl for implementation details. @@ -1038,6 +1044,12 @@ server: # Should the server pods run on the host network hostNetwork: false + # For setting the "app.starlingx.io/component" label for Openbao server pod + # Setting this to "true" will make the pod run on "application" cores, + # While setting this to "false" will make the pod run on "platform" cores. + labels: + isApplication: false + # OpenBao UI ui: # True if you want to create a Service entry for the OpenBao UI. @@ -1256,6 +1268,12 @@ csi: # for the available command line flags. extraArgs: [] + # For setting the "app.starlingx.io/component" label for Openbao csi pod + # Setting this to "true" will make the pod run on "application" cores, + # While setting this to "false" will make the pod run on "platform" cores. + labels: + isApplication: false + # OpenBao is able to collect and publish various runtime metrics. # Enabling this feature requires setting adding `telemetry{}` stanza to # the OpenBao configuration. There are a few examples included in the `config` sections above. -- 2.34.1