Skip to content

Commit 211150f

Browse files
authored
Merge branch 'devel' into add-seccomp
2 parents 82875ad + f4a8d50 commit 211150f

40 files changed

+2190
-85
lines changed

helm/install/.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://github.com/github/linguist/issues/4905
2+
# https://github.com/github/linguist/issues/5092#issuecomment-730262298
3+
/templates/*.tpl linguist-language=handlebars

helm/install/.helmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git*

helm/install/Chart.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apiVersion: v2
22
name: pgo
33
description: Installer for PGO, the open source Postgres Operator from Crunchy Data
4+
45
type: application
5-
version: 0.2.5
6+
version: 0.3.0
67
appVersion: 5.1.0

helm/install/crds/postgres-operator.crunchydata.com_pgupgrades.yaml

Lines changed: 850 additions & 0 deletions
Large diffs are not rendered by default.

helm/install/crds/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9409,9 +9409,3 @@ spec:
94099409
storage: true
94109410
subresources:
94119411
status: {}
9412-
status:
9413-
acceptedNames:
9414-
kind: ""
9415-
plural: ""
9416-
conditions: []
9417-
storedVersions: []

helm/install/templates/_helpers.tpl

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,26 @@ Create chart name and version as used by the chart label.
88
{{/*
99
Crunchy labels
1010
*/}}
11-
{{- define "install.crunchyLabels" -}}
11+
{{- define "install.clusterLabels" -}}
1212
postgres-operator.crunchydata.com/control-plane: {{ .Chart.Name }}
1313
{{- end }}
14+
{{- define "install.upgradeLabels" -}}
15+
postgres-operator.crunchydata.com/control-plane: {{ .Chart.Name }}-upgrade
16+
{{- end }}
1417

1518
{{/*
1619
Common labels
1720
*/}}
1821
{{- define "install.labels" -}}
1922
helm.sh/chart: {{ include "install.chart" . }}
20-
{{ include "install.selectorLabels" . }}
23+
app.kubernetes.io/name: {{ .Chart.Name }}
24+
app.kubernetes.io/instance: {{ .Release.Name }}
2125
{{- if .Chart.AppVersion }}
2226
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
2327
{{- end }}
2428
app.kubernetes.io/managed-by: {{ .Release.Service }}
2529
{{- end }}
2630

27-
{{/*
28-
Selector labels
29-
*/}}
30-
{{- define "install.selectorLabels" -}}
31-
app.kubernetes.io/name: {{ .Chart.Name }}
32-
app.kubernetes.io/instance: {{ .Release.Name }}
33-
{{ include "install.crunchyLabels" .}}
34-
{{- end }}
35-
3631
{{/*
3732
Create the name of the service account to use
3833
*/}}
@@ -77,3 +72,23 @@ Role
7772
ClusterRole
7873
{{- end }}
7974
{{- end }}
75+
76+
{{- define "install.imagePullSecrets" -}}
77+
{{/* Earlier versions required the full structure of PodSpec.ImagePullSecrets */}}
78+
{{- if .Values.imagePullSecrets }}
79+
imagePullSecrets:
80+
{{ toYaml .Values.imagePullSecrets }}
81+
{{- else if .Values.imagePullSecretNames }}
82+
imagePullSecrets:
83+
{{- range .Values.imagePullSecretNames }}
84+
- name: {{ . | quote }}
85+
{{- end }}{{/* range */}}
86+
{{- end }}{{/* if */}}
87+
{{- end }}{{/* define */}}
88+
89+
{{- define "install.relatedImages" -}}
90+
{{- range $id, $object := .Values.relatedImages }}
91+
- name: RELATED_IMAGE_{{ $id | upper }}
92+
value: {{ $object.image | quote }}
93+
{{- end }}
94+
{{- end }}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: {{ .Chart.Name }}-upgrade
6+
labels:
7+
{{- include "install.labels" . | nindent 4 }}
8+
{{- include "install.upgradeLabels" . | nindent 4 }}
9+
spec:
10+
replicas: 1
11+
strategy: { type: Recreate }
12+
selector:
13+
matchLabels:
14+
{{- include "install.upgradeLabels" . | nindent 6 }}
15+
template:
16+
metadata:
17+
labels:
18+
{{- include "install.upgradeLabels" . | nindent 8 }}
19+
spec:
20+
{{- include "install.imagePullSecrets" . | indent 6 }}
21+
serviceAccountName: {{ include "install.serviceAccountName" . }}-upgrade
22+
containers:
23+
- name: operator
24+
image: {{ required ".Values.controllerImages.upgrade is required" .Values.controllerImages.upgrade | quote }}
25+
env:
26+
- name: CRUNCHY_DEBUG
27+
value: {{ .Values.debug | ne false | quote }}
28+
{{- if .Values.singleNamespace }}
29+
- name: PGO_TARGET_NAMESPACE
30+
valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } }
31+
{{- end }}
32+
{{- if .Values.workers }}
33+
- name: PGO_WORKERS
34+
value: {{ .Values.workers | quote }}
35+
{{- end }}
36+
{{- include "install.relatedImages" . | indent 8 }}
37+
securityContext:
38+
allowPrivilegeEscalation: false
39+
readOnlyRootFilesystem: true
40+
runAsNonRoot: true
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1+
---
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
45
name: {{ .Chart.Name }}
56
labels:
67
{{- include "install.labels" . | nindent 4 }}
8+
{{- include "install.clusterLabels" . | nindent 4 }}
79
spec:
810
replicas: 1
911
strategy: { type: Recreate }
1012
selector:
1113
matchLabels:
12-
{{- include "install.crunchyLabels" . | nindent 6 }}
14+
{{- include "install.clusterLabels" . | nindent 6 }}
1315
template:
1416
metadata:
1517
labels:
16-
{{- include "install.crunchyLabels" . | nindent 8 }}
18+
{{- include "install.clusterLabels" . | nindent 8 }}
1719
spec:
20+
{{- include "install.imagePullSecrets" . | indent 6 }}
21+
serviceAccountName: {{ include "install.serviceAccountName" . }}
1822
containers:
1923
- name: operator
20-
image: "{{ .Values.image.image }}"
24+
image: {{ required ".Values.controllerImages.cluster is required" .Values.controllerImages.cluster | quote }}
2125
env:
22-
- name: PGO_NAMESPACE
23-
valueFrom:
24-
fieldRef:
25-
fieldPath: metadata.namespace
2626
- name: CRUNCHY_DEBUG
27-
value: {{ if eq .Values.debug false }}"false"{{- else }}"true"{{- end }}
28-
{{- range $image_name, $image_val := .Values.relatedImages }}
29-
- name: RELATED_IMAGE_{{ $image_name | upper }}
30-
value: "{{ $image_val.image }}"
31-
{{- end }}
27+
value: {{ .Values.debug | ne false | quote }}
28+
- name: PGO_NAMESPACE
29+
valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } }
3230
{{- if .Values.singleNamespace }}
3331
- name: PGO_TARGET_NAMESPACE
3432
valueFrom: { fieldRef: { apiVersion: v1, fieldPath: metadata.namespace } }
@@ -37,7 +35,8 @@ spec:
3735
- name: PGO_WORKERS
3836
value: {{ .Values.workers | quote }}
3937
{{- end }}
40-
{{- if (default false .Values.disable_check_for_upgrades) }}
38+
{{- include "install.relatedImages" . | indent 8 }}
39+
{{- if .Values.disable_check_for_upgrades }}
4140
- name: CHECK_FOR_UPGRADES
4241
value: "false"
4342
{{- end }}
@@ -47,4 +46,3 @@ spec:
4746
runAsNonRoot: true
4847
seccompProfile:
4948
type: RuntimeDefault
50-
serviceAccount: {{ include "install.serviceAccountName" . }}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: {{ include "install.roleKind" . }}
4+
metadata:
5+
name: {{ include "install.roleName" . }}-upgrade
6+
labels:
7+
{{- include "install.labels" . | nindent 4 }}
8+
{{- include "install.upgradeLabels" . | nindent 4 }}
9+
rules:
10+
- apiGroups:
11+
- ""
12+
resources:
13+
- endpoints
14+
verbs:
15+
- delete
16+
- get
17+
- list
18+
- watch
19+
- apiGroups:
20+
- apps
21+
resources:
22+
- statefulsets
23+
verbs:
24+
- list
25+
- watch
26+
- apiGroups:
27+
- batch
28+
resources:
29+
- jobs
30+
verbs:
31+
- create
32+
- delete
33+
- list
34+
- patch
35+
- watch
36+
- apiGroups:
37+
- postgres-operator.crunchydata.com
38+
resources:
39+
- pgupgrades
40+
verbs:
41+
- get
42+
- list
43+
- watch
44+
- apiGroups:
45+
- postgres-operator.crunchydata.com
46+
resources:
47+
- pgupgrades/finalizers
48+
verbs:
49+
- patch
50+
- update
51+
- apiGroups:
52+
- postgres-operator.crunchydata.com
53+
resources:
54+
- pgupgrades/status
55+
verbs:
56+
- get
57+
- patch
58+
- apiGroups:
59+
- postgres-operator.crunchydata.com
60+
resources:
61+
- postgresclusters
62+
verbs:
63+
- get
64+
- list
65+
- watch
66+
- apiGroups:
67+
- postgres-operator.crunchydata.com
68+
resources:
69+
- postgresclusters/status
70+
verbs:
71+
- patch

helm/install/templates/role.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
---
12
apiVersion: rbac.authorization.k8s.io/v1
23
kind: {{ include "install.roleKind" . }}
34
metadata:
45
name: {{ include "install.roleName" . }}
56
labels:
67
{{- include "install.labels" . | nindent 4 }}
8+
{{- include "install.clusterLabels" . | nindent 4 }}
79
rules:
810
- apiGroups:
911
- ''

0 commit comments

Comments
 (0)