enable controllerID for chart and allow configurable pod cluster role
This commit is contained in:
		
							parent
							
								
									07c5da35e3
								
							
						
					
					
						commit
						3683beec6f
					
				|  | @ -31,6 +31,20 @@ Create a service account name. | ||||||
| {{ default (include "postgres-operator.fullname" .) .Values.serviceAccount.name }} | {{ default (include "postgres-operator.fullname" .) .Values.serviceAccount.name }} | ||||||
| {{- end -}} | {{- end -}} | ||||||
| 
 | 
 | ||||||
|  | {{/* | ||||||
|  | Create a pod service account name. | ||||||
|  | */}} | ||||||
|  | {{- define "postgres-pod.serviceAccountName" -}} | ||||||
|  | {{ default (printf "%s-%v" (include "postgres-operator.fullname" .) "pod") .Values.podServiceAccount.name }} | ||||||
|  | {{- end -}} | ||||||
|  | 
 | ||||||
|  | {{/* | ||||||
|  | Create a controller ID. | ||||||
|  | */}} | ||||||
|  | {{- define "postgres-operator.controllerID" -}} | ||||||
|  | {{ default (include "postgres-operator.fullname" .) .Values.controllerID.name }} | ||||||
|  | {{- end -}} | ||||||
|  | 
 | ||||||
| {{/* | {{/* | ||||||
| Create chart name and version as used by the chart label. | Create chart name and version as used by the chart label. | ||||||
| */}} | */}} | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| apiVersion: rbac.authorization.k8s.io/v1 | apiVersion: rbac.authorization.k8s.io/v1 | ||||||
| kind: ClusterRole | kind: ClusterRole | ||||||
| metadata: | metadata: | ||||||
|   name: postgres-pod |   name: {{ include "postgres-pod.serviceAccountName" . }} | ||||||
|   labels: |   labels: | ||||||
|     app.kubernetes.io/name: {{ template "postgres-operator.name" . }} |     app.kubernetes.io/name: {{ template "postgres-operator.name" . }} | ||||||
|     helm.sh/chart: {{ template "postgres-operator.chart" . }} |     helm.sh/chart: {{ template "postgres-operator.chart" . }} | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ metadata: | ||||||
|     app.kubernetes.io/managed-by: {{ .Release.Service }} |     app.kubernetes.io/managed-by: {{ .Release.Service }} | ||||||
|     app.kubernetes.io/instance: {{ .Release.Name }} |     app.kubernetes.io/instance: {{ .Release.Name }} | ||||||
| data: | data: | ||||||
|  |   pod_service_account_name: {{ include "postgres-pod.serviceAccountName" . }} | ||||||
| {{ toYaml .Values.configGeneral | indent 2 }} | {{ toYaml .Values.configGeneral | indent 2 }} | ||||||
| {{ toYaml .Values.configUsers | indent 2 }} | {{ toYaml .Values.configUsers | indent 2 }} | ||||||
| {{ toYaml .Values.configKubernetes | indent 2 }} | {{ toYaml .Values.configKubernetes | indent 2 }} | ||||||
|  |  | ||||||
|  | @ -43,6 +43,10 @@ spec: | ||||||
|       {{- else }} |       {{- else }} | ||||||
|         - name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT |         - name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT | ||||||
|           value: {{ template "postgres-operator.fullname" . }} |           value: {{ template "postgres-operator.fullname" . }} | ||||||
|  |       {{- end }} | ||||||
|  |       {{- if .Values.controllerID.create }} | ||||||
|  |         - name: CONTROLLER_ID | ||||||
|  |           value: {{ template "postgres-operator.controllerID" . }} | ||||||
|       {{- end }} |       {{- end }} | ||||||
|         resources: |         resources: | ||||||
| {{ toYaml .Values.resources | indent 10 }} | {{ toYaml .Values.resources | indent 10 }} | ||||||
|  |  | ||||||
|  | @ -13,6 +13,7 @@ configuration: | ||||||
|   users: |   users: | ||||||
| {{ toYaml .Values.configUsers | indent 4 }} | {{ toYaml .Values.configUsers | indent 4 }} | ||||||
|   kubernetes: |   kubernetes: | ||||||
|  |     pod_service_account_name: {{ include "postgres-pod.serviceAccountName" . }} | ||||||
|     oauth_token_secret_name: {{ template "postgres-operator.fullname" . }} |     oauth_token_secret_name: {{ template "postgres-operator.fullname" . }} | ||||||
| {{ toYaml .Values.configKubernetes | indent 4 }} | {{ toYaml .Values.configKubernetes | indent 4 }} | ||||||
|   postgres_pod_resources: |   postgres_pod_resources: | ||||||
|  |  | ||||||
|  | @ -103,8 +103,6 @@ configKubernetes: | ||||||
|   # service account definition as JSON/YAML string to be used by postgres cluster pods |   # service account definition as JSON/YAML string to be used by postgres cluster pods | ||||||
|   # pod_service_account_definition: "" |   # pod_service_account_definition: "" | ||||||
| 
 | 
 | ||||||
|   # name of service account to be used by postgres cluster pods |  | ||||||
|   pod_service_account_name: "postgres-pod" |  | ||||||
|   # role binding definition as JSON/YAML string to be used by pod service account |   # role binding definition as JSON/YAML string to be used by pod service account | ||||||
|   # pod_service_account_role_binding_definition: "" |   # pod_service_account_role_binding_definition: "" | ||||||
| 
 | 
 | ||||||
|  | @ -284,6 +282,11 @@ serviceAccount: | ||||||
|   # If not set and create is true, a name is generated using the fullname template |   # If not set and create is true, a name is generated using the fullname template | ||||||
|   name: |   name: | ||||||
| 
 | 
 | ||||||
|  | podServiceAccount: | ||||||
|  |   # The name of the ServiceAccount to be used by postgres cluster pods | ||||||
|  |   # If not set a name is generated using the fullname template and "-pod" suffix | ||||||
|  |   name: "postgres-pod" | ||||||
|  | 
 | ||||||
| priorityClassName: "" | priorityClassName: "" | ||||||
| 
 | 
 | ||||||
| resources: | resources: | ||||||
|  | @ -305,3 +308,12 @@ tolerations: [] | ||||||
| # Node labels for pod assignment | # Node labels for pod assignment | ||||||
| # Ref: https://kubernetes.io/docs/user-guide/node-selection/ | # Ref: https://kubernetes.io/docs/user-guide/node-selection/ | ||||||
| nodeSelector: {} | nodeSelector: {} | ||||||
|  | 
 | ||||||
|  | controllerID: | ||||||
|  |   # Specifies whether a controller ID should be defined for the operator | ||||||
|  |   # Note, all postgres manifest must then contain the following annotation to be found by this operator | ||||||
|  |   # "acid.zalan.do/controller": <controller-ID-of-the-operator> | ||||||
|  |   create: false | ||||||
|  |   # The name of the controller ID to use. | ||||||
|  |   # If not set and create is true, a name is generated using the fullname template | ||||||
|  |   name: | ||||||
|  |  | ||||||
|  | @ -96,8 +96,6 @@ configKubernetes: | ||||||
|   # service account definition as JSON/YAML string to be used by postgres cluster pods |   # service account definition as JSON/YAML string to be used by postgres cluster pods | ||||||
|   # pod_service_account_definition: "" |   # pod_service_account_definition: "" | ||||||
| 
 | 
 | ||||||
|   # name of service account to be used by postgres cluster pods |  | ||||||
|   pod_service_account_name: "postgres-pod" |  | ||||||
|   # role binding definition as JSON/YAML string to be used by pod service account |   # role binding definition as JSON/YAML string to be used by pod service account | ||||||
|   # pod_service_account_role_binding_definition: "" |   # pod_service_account_role_binding_definition: "" | ||||||
| 
 | 
 | ||||||
|  | @ -260,6 +258,11 @@ serviceAccount: | ||||||
|   # If not set and create is true, a name is generated using the fullname template |   # If not set and create is true, a name is generated using the fullname template | ||||||
|   name: |   name: | ||||||
| 
 | 
 | ||||||
|  | podServiceAccount: | ||||||
|  |   # The name of the ServiceAccount to be used by postgres cluster pods | ||||||
|  |   # If not set a name is generated using the fullname template and "-pod" suffix | ||||||
|  |   name: "postgres-pod" | ||||||
|  | 
 | ||||||
| priorityClassName: "" | priorityClassName: "" | ||||||
| 
 | 
 | ||||||
| resources: | resources: | ||||||
|  | @ -281,3 +284,12 @@ tolerations: [] | ||||||
| # Node labels for pod assignment | # Node labels for pod assignment | ||||||
| # Ref: https://kubernetes.io/docs/user-guide/node-selection/ | # Ref: https://kubernetes.io/docs/user-guide/node-selection/ | ||||||
| nodeSelector: {} | nodeSelector: {} | ||||||
|  | 
 | ||||||
|  | controllerID: | ||||||
|  |   # Specifies whether a controller ID should be defined for the operator | ||||||
|  |   # Note, all postgres manifest must then contain the following annotation to be found by this operator | ||||||
|  |   # "acid.zalan.do/controller": <controller-ID-of-the-operator> | ||||||
|  |   create: false | ||||||
|  |   # The name of the controller ID to use. | ||||||
|  |   # If not set and create is true, a name is generated using the fullname template | ||||||
|  |   name: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue