diff --git a/Chart.yaml b/Chart.yaml index 35967a4..c05c631 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -15,7 +15,7 @@ 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.2.2 +version: 0.3.3 # 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 diff --git a/README.md b/README.md index aebee70..d536ae1 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,34 @@ # Helmchart for generic python application -[![Packahe Helm Chart](https://github.com/zcsadmin/ml-pyhchart-helmchart/actions/workflows/helm-package.yml/badge.svg)](https://github.com/zcsadmin/ml-pyhchart-helmchart/actions/workflows/helm-package.yml) +[![Package Helm Chart](https://github.com/zcsadmin/ml-pyhchart-helmchart/actions/workflows/helm-package.yml/badge.svg)](https://github.com/zcsadmin/ml-pyhchart-helmchart/actions/workflows/helm-package.yml) [![Push Helm Chart to Artifact Registry](https://github.com/zcsadmin/ml-pyhchart-helmchart/actions/workflows/helm-push.yml/badge.svg)](https://github.com/zcsadmin/ml-pyhchart-helmchart/actions/workflows/helm-push.yml) - ## Changelog -### 0.2.2 +### 0.3.3 + +Set rolling update strategy, pod disruption budget and replicaCount to 1. + +### 0.3.0 + +Set rolling update strategy, pod disruption budget and replicaCount to 3 for production environments. +For Sandbox and Development environments we must set replicaCount in values.yaml to 1 and pdb.enabled to false. + +### 0.2.2 + Set container name for deployment. ### 0.2.1 + Enhance secrets support. ### 0.2.0 + Add support for secret values. ### 0.1.0 + Initial chart release. ## Artifact Repository @@ -24,6 +36,7 @@ Initial chart release. `oci://europe-west1-docker.pkg.dev/ai-accounting-405809/ml-helm-charts/pyhchart` List docker images from cli: + ```bash gcloud artifacts docker images list europe-west1-docker.pkg.dev/ai-accounting-405809/ml-helm-charts ``` @@ -33,10 +46,11 @@ gcloud artifacts docker images list europe-west1-docker.pkg.dev/ai-accounting-40 You need to download the chart locally and `appVersion` value in `Chart.yaml` file. Also, you need a `values-app.yaml` file with the specific values for your application. Then, you can install the application with the following command: + ```bash helm install YOUR_APP -f values-app.yaml . ``` ## Useful links - - [Artifact repository](https://console.cloud.google.com/artifacts/docker/ai-accounting-405809/europe-west1/ml-helm-charts/pyhchart?project=ai-accounting-405809) +- [Artifact repository](https://console.cloud.google.com/artifacts/docker/ai-accounting-405809/europe-west1/ml-helm-charts/pyhchart?project=ai-accounting-405809) diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 32bf3fe..2ba5a0e 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -9,6 +9,11 @@ spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} + strategy: + type: RollingUpdate + rollingUpdate: + maxUnavailable: {{ .Values.rollingUpdate.maxUnavailable | default 1 }} + maxSurge: {{ .Values.rollingUpdate.maxSurge | default 1 }} selector: matchLabels: {{- include "pyhchart.selectorLabels" . | nindent 6 }} diff --git a/templates/pdb.yaml b/templates/pdb.yaml new file mode 100644 index 0000000..d439fbf --- /dev/null +++ b/templates/pdb.yaml @@ -0,0 +1,12 @@ +{{- if .Values.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "pyhchart.fullname" . }}-pdb + namespace: {{ include "common.names.namespace" . | quote }} +spec: + minAvailable: {{ .Values.pdb.minAvailable | default 2 }} + selector: + matchLabels: + {{- include "pyhchart.selectorLabels" . | nindent 6 }} +{{- end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index 5fd5b84..2fed505 100644 --- a/values.yaml +++ b/values.yaml @@ -4,6 +4,18 @@ replicaCount: 1 +# https://www.baeldung.com/ops/deployment-rollout-kubernetes +# https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-update-deployment +rollingUpdate: + maxUnavailable: 25% + maxSurge: 25% + +# https://www.baeldung.com/ops/kubernetes-pod-disruption-budget +# https://kubernetes.io/docs/tasks/run-application/configure-pdb/ +pdb: + enabled: true + minAvailable: 1 + image: repository: pullPolicy: Always