Skip to content

Commit

Permalink
feat: Add PDB
Browse files Browse the repository at this point in the history
Signed-off-by: Ilan Zerath <contact@fuegobyp.business>
  • Loading branch information
Ilan Zerath committed Feb 5, 2025
1 parent 165d184 commit a25df58
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/backstage/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ sources:
# 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: 2.3.0
version: 2.3.1
3 changes: 2 additions & 1 deletion charts/backstage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Backstage Helm Chart

[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/backstage)](https://artifacthub.io/packages/search?repo=backstage)
![Version: 2.3.0](https://img.shields.io/badge/Version-2.3.0-informational?style=flat-square)
![Version: 2.3.1](https://img.shields.io/badge/Version-2.3.1-informational?style=flat-square)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

A Helm chart for deploying a Backstage application
Expand Down Expand Up @@ -139,6 +139,7 @@ Kubernetes: `>= 1.19.0-0`
| backstage.installDir | Directory containing the backstage installation | string | `"/app"` |
| backstage.livenessProbe | Liveness Probe Ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes <!-- E.g. livenessProbe: failureThreshold: 3 httpGet: path: /.backstage/health/v1/liveness port: 7007 scheme: HTTP initialDelaySeconds: 60 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 2 | object | `{"httpGet":{"path":"/.backstage/health/v1/liveness","port":7007,"scheme":"HTTP"}}` |
| backstage.nodeSelector | Node labels for pod assignment <br /> Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector | object | `{}` |
| backstage.pdb | Pod Disruption Budget configuration ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ | object | `{"create":false,"maxUnavailable":"","minAvailable":""}` |
| backstage.podAnnotations | Annotations to add to the backend deployment pods | object | `{}` |
| backstage.podLabels | Labels to add to the backend deployment pods | object | `{}` |
| backstage.podSecurityContext | Security settings for a Pod. The security settings that you specify for a Pod apply to all Containers in the Pod. <br /> Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod | object | `{}` |
Expand Down
29 changes: 29 additions & 0 deletions charts/backstage/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if .Values.backstage.pdb.create }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{ include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/component: backstage
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
annotations:
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.backstage.annotations }}
{{- include "common.tplvalues.render" ( dict "value" .Values.backstage.annotations "context" $) | nindent 4 }}
{{- end }}
spec:
{{- if .Values.backstage.pdb.minAvailable }}
minAvailable: {{ .Values.backstage.pdb.minAvailable }}
{{- end }}
{{- if or .Values.backstage.pdb.maxUnavailable ( not .Values.backstage.pdb.minAvailable ) }}
maxUnavailable: {{ .Values.backstage.pdb.maxUnavailable | default 1 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/component: backstage
{{- end }}
37 changes: 33 additions & 4 deletions charts/backstage/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@
"envFrom": {
"description": "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
"items": {
"description": "EnvFromSource represents the source of a set of ConfigMaps",
"description": "EnvFromSource represents the source of a set of ConfigMaps or Secrets",
"properties": {
"configMapRef": {
"description": "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.",
Expand All @@ -1148,7 +1148,7 @@
"type": "object"
},
"prefix": {
"description": "An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.",
"description": "Optional text to prepend to the name of each environment variable. Must be a C_IDENTIFIER.",
"type": "string"
},
"secretRef": {
Expand Down Expand Up @@ -4248,7 +4248,7 @@
"envFrom": {
"description": "List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence. Cannot be updated.",
"items": {
"description": "EnvFromSource represents the source of a set of ConfigMaps",
"description": "EnvFromSource represents the source of a set of ConfigMaps or Secrets",
"properties": {
"configMapRef": {
"description": "ConfigMapEnvSource selects a ConfigMap to populate the environment variables with.\n\nThe contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables.",
Expand All @@ -4265,7 +4265,7 @@
"type": "object"
},
"prefix": {
"description": "An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER.",
"description": "Optional text to prepend to the name of each environment variable. Must be a C_IDENTIFIER.",
"type": "string"
},
"secretRef": {
Expand Down Expand Up @@ -5511,6 +5511,35 @@
"title": "Node labels for pod assignment",
"type": "object"
},
"pdb": {
"additionalProperties": false,
"properties": {
"create": {
"default": false,
"description": "Create a PDB",
"title": "Backstage PDB",
"type": "boolean"
},
"maxUnavailable": {
"default": "",
"title": "Backstage PDB maxUnavailable",
"type": [
"string",
"integer"
]
},
"minAvailable": {
"default": "",
"title": "Backstage PDB minAvailable",
"type": [
"string",
"integer"
]
}
},
"title": "PDB parameters",
"type": "object"
},
"podAnnotations": {
"additionalProperties": {
"type": "string"
Expand Down
29 changes: 29 additions & 0 deletions charts/backstage/values.schema.tmpl.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,35 @@
}
}
},
"pdb": {
"title": "PDB parameters",
"type": "object",
"additionalProperties": false,
"properties": {
"create": {
"description": "Create a PDB",
"title": "Backstage PDB",
"type": "boolean",
"default": false
},
"minAvailable": {
"title": "Backstage PDB minAvailable",
"type": [
"string",
"integer"
],
"default": ""
},
"maxUnavailable": {
"title": "Backstage PDB maxUnavailable",
"type": [
"string",
"integer"
],
"default": ""
}
}
},
"containerPorts": {
"title": "Container ports on the Deployment",
"type": "object",
Expand Down
7 changes: 7 additions & 0 deletions charts/backstage/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ backstage:
# <br /> E.g: `pullSecrets: [myRegistryKeySecretName]`
pullSecrets: []

# -- Pod Disruption Budget configuration
# ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
pdb:
create: false
minAvailable: ""
maxUnavailable: ""

# -- Container ports on the Deployment
containerPorts:
backend: 7007
Expand Down

0 comments on commit a25df58

Please sign in to comment.