diff --git a/templates/core/core-pdb.yaml b/templates/core/core-pdb.yaml new file mode 100644 index 000000000..2cd2dadff --- /dev/null +++ b/templates/core/core-pdb.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.core.podDisruptionBudget.enabled (gt (int .Values.core.replicas) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ template "harbor.core" . }} + labels: +{{ include "harbor.labels" . | indent 4 }} +spec: + {{- if .Values.core.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.core.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.core.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.core.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: +{{ include "harbor.matchLabels" . | indent 6 }} + component: core +{{- end }} \ No newline at end of file diff --git a/templates/exporter/exporter-pdb.yaml b/templates/exporter/exporter-pdb.yaml new file mode 100644 index 000000000..12e1268a0 --- /dev/null +++ b/templates/exporter/exporter-pdb.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.exporter.podDisruptionBudget.enabled (gt (int .Values.exporter.replicas) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ template "harbor.exporter" . }} + labels: +{{ include "harbor.labels" . | indent 4 }} +spec: + {{- if .Values.exporter.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.exporter.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.exporter.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.exporter.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: +{{ include "harbor.matchLabels" . | indent 6 }} + component: exporter +{{- end }} \ No newline at end of file diff --git a/templates/jobservice/jobservice-pdb.yaml b/templates/jobservice/jobservice-pdb.yaml new file mode 100644 index 000000000..8278c1ffb --- /dev/null +++ b/templates/jobservice/jobservice-pdb.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.jobservice.podDisruptionBudget.enabled (gt (int .Values.jobservice.replicas) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ template "harbor.jobservice" . }} + labels: +{{ include "harbor.labels" . | indent 4 }} +spec: + {{- if .Values.jobservice.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.jobservice.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.jobservice.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.jobservice.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: +{{ include "harbor.matchLabels" . | indent 6 }} + component: jobservice +{{- end }} \ No newline at end of file diff --git a/templates/nginx/nginx-pdb.yaml b/templates/nginx/nginx-pdb.yaml new file mode 100644 index 000000000..2f8a10ac4 --- /dev/null +++ b/templates/nginx/nginx-pdb.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.nginx.podDisruptionBudget.enabled (gt (int .Values.nginx.replicas) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ template "harbor.nginx" . }} + labels: +{{ include "harbor.labels" . | indent 4 }} +spec: + {{- if .Values.nginx.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.nginx.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.nginx.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.nginx.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: +{{ include "harbor.matchLabels" . | indent 6 }} + component: nginx +{{- end }} \ No newline at end of file diff --git a/templates/portal/portal-pdb.yaml b/templates/portal/portal-pdb.yaml new file mode 100644 index 000000000..60fbdc520 --- /dev/null +++ b/templates/portal/portal-pdb.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.portal.podDisruptionBudget.enabled (gt (int .Values.portal.replicas) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ template "harbor.portal" . }} + labels: +{{ include "harbor.labels" . | indent 4 }} +spec: + {{- if .Values.portal.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.portal.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.portal.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.portal.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: +{{ include "harbor.matchLabels" . | indent 6 }} + component: portal +{{- end }} \ No newline at end of file diff --git a/templates/registry/registry-pdb.yaml b/templates/registry/registry-pdb.yaml new file mode 100644 index 000000000..fe96f37fd --- /dev/null +++ b/templates/registry/registry-pdb.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.registry.podDisruptionBudget.enabled (gt (int .Values.registry.replicas) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ template "harbor.registry" . }} + labels: +{{ include "harbor.labels" . | indent 4 }} +spec: + {{- if .Values.registry.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.registry.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.registry.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.registry.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: +{{ include "harbor.matchLabels" . | indent 6 }} + component: registry +{{- end }} \ No newline at end of file diff --git a/templates/trivy/trivy-pdb.yaml b/templates/trivy/trivy-pdb.yaml new file mode 100644 index 000000000..25fde40ee --- /dev/null +++ b/templates/trivy/trivy-pdb.yaml @@ -0,0 +1,19 @@ +{{- if and .Values.trivy.podDisruptionBudget.enabled (gt (int .Values.trivy.replicas) 1) }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ template "harbor.trivy" . }} + labels: +{{ include "harbor.labels" . | indent 4 }} +spec: + {{- if .Values.trivy.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.trivy.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.trivy.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.trivy.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: +{{ include "harbor.matchLabels" . | indent 6 }} + component: trivy +{{- end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index 98206b0f4..19d0ec558 100644 --- a/values.yaml +++ b/values.yaml @@ -489,6 +489,10 @@ nginx: # mount the service account token automountServiceAccountToken: false replicas: 1 + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 revisionHistoryLimit: 10 # resources: # requests: @@ -520,6 +524,10 @@ portal: # mount the service account token automountServiceAccountToken: false replicas: 1 + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 revisionHistoryLimit: 10 # resources: # requests: @@ -560,6 +568,10 @@ core: # mount the service account token automountServiceAccountToken: false replicas: 1 + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 revisionHistoryLimit: 10 ## Startup probe values startupProbe: @@ -644,6 +656,13 @@ jobservice: image: repository: goharbor/harbor-jobservice tag: dev + replicas: 1 + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 + revisionHistoryLimit: 10 + # set the service account to be used, default if left empty serviceAccountName: "" # mount the service account token @@ -726,6 +745,10 @@ registry: # mount the service account token automountServiceAccountToken: false replicas: 1 + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 revisionHistoryLimit: 10 nodeSelector: {} tolerations: [] @@ -803,6 +826,11 @@ trivy: automountServiceAccountToken: false # replicas the number of Pod replicas replicas: 1 + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 + resources: requests: cpu: 200m @@ -1036,6 +1064,10 @@ exporter: # mount the service account token automountServiceAccountToken: false replicas: 1 + podDisruptionBudget: + enabled: false + minAvailable: 1 + # maxUnavailable: 1 revisionHistoryLimit: 10 # resources: # requests: