diff --git a/bitnami/chainloop/templates/cas/networkpolicy.yaml b/bitnami/chainloop/templates/cas/networkpolicy.yaml index e409cf438339a6..9d2153160fb25e 100644 --- a/bitnami/chainloop/templates/cas/networkpolicy.yaml +++ b/bitnami/chainloop/templates/cas/networkpolicy.yaml @@ -10,7 +10,7 @@ metadata: name: {{ printf "%s-cas" (include "common.names.fullname" .) }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} - app.kubernetes.io/component: web + app.kubernetes.io/component: cas {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -18,7 +18,7 @@ spec: {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.cas.podLabels .Values.commonLabels ) "context" . ) }} podSelector: matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} - app.kubernetes.io/component: web + app.kubernetes.io/component: cas policyTypes: - Ingress - Egress @@ -52,7 +52,7 @@ spec: from: - podSelector: matchLabels: - {{ printf "%s-web" (include "common.names.fullname" .) }}-client: "true" + {{ printf "%s-cas" (include "common.names.fullname" .) }}: "true" {{- if .Values.cas.networkPolicy.ingressNSMatchLabels }} - namespaceSelector: matchLabels: diff --git a/bitnami/chainloop/templates/cas/pdb.yaml b/bitnami/chainloop/templates/cas/pdb.yaml new file mode 100644 index 00000000000000..827c03b40df307 --- /dev/null +++ b/bitnami/chainloop/templates/cas/pdb.yaml @@ -0,0 +1,26 @@ +{{- /* +Copyright Broadcom, Inc. All Rights Reserved. +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{- if .Values.cas.pdb.enabled }} +apiVersion: {{ include "common.capabilities.policy.apiVersion" . }} +kind: PodDisruptionBudget +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + {{- if .Values.cas.pdb.minAvailable }} + minAvailable: {{ .Values.cas.pdb.minAvailable }} + {{- end }} + {{- if or .Values.cas.pdb.maxUnavailable ( not .Values.cas.pdb.minAvailable ) }} + maxUnavailable: {{ .Values.cas.pdb.maxUnavailable | default 1 }} + {{- end }} + {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.cas.podLabels .Values.commonLabels ) "context" . ) }} + selector: + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} +{{- end }} diff --git a/bitnami/chainloop/templates/controlplane/networkpolicy.yaml b/bitnami/chainloop/templates/controlplane/networkpolicy.yaml index baf781ef8fff05..d1452093a9e75b 100644 --- a/bitnami/chainloop/templates/controlplane/networkpolicy.yaml +++ b/bitnami/chainloop/templates/controlplane/networkpolicy.yaml @@ -10,7 +10,7 @@ metadata: name: {{ printf "%s-controlplane" (include "common.names.fullname" .) }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} - app.kubernetes.io/component: web + app.kubernetes.io/component: controlplane {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -18,7 +18,7 @@ spec: {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.controlplane.podLabels .Values.commonLabels ) "context" . ) }} podSelector: matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} - app.kubernetes.io/component: web + app.kubernetes.io/component: controlplane policyTypes: - Ingress - Egress @@ -52,7 +52,7 @@ spec: from: - podSelector: matchLabels: - {{ printf "%s-web" (include "common.names.fullname" .) }}-client: "true" + {{ printf "%s-controlplane" (include "common.names.fullname" .) }}: "true" {{- if .Values.controlplane.networkPolicy.ingressNSMatchLabels }} - namespaceSelector: matchLabels: diff --git a/bitnami/chainloop/templates/controlplane/pdb.yaml b/bitnami/chainloop/templates/controlplane/pdb.yaml new file mode 100644 index 00000000000000..79af838e3dd97b --- /dev/null +++ b/bitnami/chainloop/templates/controlplane/pdb.yaml @@ -0,0 +1,26 @@ +{{- /* +Copyright Broadcom, Inc. All Rights Reserved. +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{- if .Values.controlplane.pdb.enabled }} +apiVersion: {{ include "common.capabilities.policy.apiVersion" . }} +kind: PodDisruptionBudget +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + {{- if .Values.controlplane.pdb.minAvailable }} + minAvailable: {{ .Values.controlplane.pdb.minAvailable }} + {{- end }} + {{- if or .Values.controlplane.pdb.maxUnavailable ( not .Values.controlplane.pdb.minAvailable ) }} + maxUnavailable: {{ .Values.controlplane.pdb.maxUnavailable | default 1 }} + {{- end }} + {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.controlplane.podLabels .Values.commonLabels ) "context" . ) }} + selector: + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} +{{- end }} diff --git a/bitnami/chainloop/values.yaml b/bitnami/chainloop/values.yaml index 6ceb6fd309c70f..74b692de05a9c0 100644 --- a/bitnami/chainloop/values.yaml +++ b/bitnami/chainloop/values.yaml @@ -937,6 +937,17 @@ controlplane: targetCPU: "" targetMemory: "" + ## Pod disruption budget configuration + ## Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ + ## @param server.pdb.enabled Create Pod Disruption Budget for the server component + ## @param server.pdb.minAvailable Sets the min number of pods availables for the Pod Disruption Budget + ## @param server.pdb.maxUnavailable Sets the max number of pods unavailable for the Pod Disruption Budget + ## + pdb: + enabled: true + minAvailable: "" + maxUnavailable: "" + ## @section Artifact Content Addressable (CAS) API ################################## # Artifacts CAS # @@ -1607,6 +1618,17 @@ cas: targetCPU: "" targetMemory: "" + ## Pod disruption budget configuration + ## Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ + ## @param server.pdb.enabled Create Pod Disruption Budget for the server component + ## @param server.pdb.minAvailable Sets the min number of pods availables for the Pod Disruption Budget + ## @param server.pdb.maxUnavailable Sets the max number of pods unavailable for the Pod Disruption Budget + ## + pdb: + enabled: true + minAvailable: "" + maxUnavailable: "" + ## @section Dependencies # ##################################