add operator config for ephemeral volumes
This commit is contained in:
		
							parent
							
								
									e71891e2bd
								
							
						
					
					
						commit
						8a5b6b1408
					
				|  | @ -692,6 +692,9 @@ spec: | |||
|                   enable_patroni_failsafe_mode: | ||||
|                     type: boolean | ||||
|                     default: false | ||||
|               allow_ephemeral_volumes: | ||||
|                 type: boolean | ||||
|                 default: false | ||||
|           status: | ||||
|             type: object | ||||
|             additionalProperties: | ||||
|  |  | |||
|  | @ -42,4 +42,5 @@ configuration: | |||
| {{ tpl (toYaml .Values.configConnectionPooler) . | indent 4 }} | ||||
|   patroni: | ||||
| {{ tpl (toYaml .Values.configPatroni) . | indent 4 }} | ||||
|   allow_ephemeral_volumes: {{ .Values.allowEphemeralVolumes }} | ||||
| {{- end }} | ||||
|  |  | |||
|  | @ -454,6 +454,9 @@ configPatroni: | |||
| # Zalando's internal CDC stream feature | ||||
| enableStreams: false | ||||
| 
 | ||||
| # Allow ephemeral instances | ||||
| allowEphemeralVolumes: false | ||||
| 
 | ||||
| rbac: | ||||
|   # Specifies whether RBAC resources should be created | ||||
|   create: true | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ data: | |||
|   # additional_pod_capabilities: "SYS_NICE" | ||||
|   # additional_secret_mount: "some-secret-name" | ||||
|   # additional_secret_mount_path: "/some/dir" | ||||
|   # allow_ephemeral_volumes: true | ||||
|   api_port: "8080" | ||||
|   aws_region: eu-central-1 | ||||
|   cluster_domain: cluster.local | ||||
|  |  | |||
|  | @ -690,6 +690,9 @@ spec: | |||
|                   enable_patroni_failsafe_mode: | ||||
|                     type: boolean | ||||
|                     default: false | ||||
|               allow_ephemeral_volumes: | ||||
|                 type: boolean | ||||
|                 default: false | ||||
|           status: | ||||
|             type: object | ||||
|             additionalProperties: | ||||
|  |  | |||
|  | @ -220,3 +220,4 @@ configuration: | |||
|     # connection_pooler_user: "pooler" | ||||
|   patroni: | ||||
|     enable_patroni_failsafe_mode: false | ||||
|   allow_ephemeral_volumes: false | ||||
|  | @ -1966,6 +1966,9 @@ var OperatorConfigCRDResourceValidation = apiextv1.CustomResourceValidation{ | |||
| 							}, | ||||
| 						}, | ||||
| 					}, | ||||
| 					"allow_ephemeral_volums": { | ||||
| 						Type: "boolean", | ||||
| 					}, | ||||
| 				}, | ||||
| 			}, | ||||
| 			"status": { | ||||
|  |  | |||
|  | @ -287,6 +287,8 @@ type OperatorConfigurationData struct { | |||
| 	MinInstances                      int32  `json:"min_instances,omitempty"` | ||||
| 	MaxInstances                      int32  `json:"max_instances,omitempty"` | ||||
| 	IgnoreInstanceLimitsAnnotationKey string `json:"ignore_instance_limits_annotation_key,omitempty"` | ||||
| 
 | ||||
| 	AllowEphemeralVolumes *bool `json:"allow_ephemeral_volumes,omitempty"` | ||||
| } | ||||
| 
 | ||||
| // Duration shortens this frequently used name
 | ||||
|  |  | |||
|  | @ -461,6 +461,11 @@ func (in *OperatorConfigurationData) DeepCopyInto(out *OperatorConfigurationData | |||
| 	out.LogicalBackup = in.LogicalBackup | ||||
| 	in.ConnectionPooler.DeepCopyInto(&out.ConnectionPooler) | ||||
| 	in.Patroni.DeepCopyInto(&out.Patroni) | ||||
| 	if in.AllowEphemeralVolumes != nil { | ||||
| 		in, out := &in.AllowEphemeralVolumes, &out.AllowEphemeralVolumes | ||||
| 		*out = new(bool) | ||||
| 		**out = **in | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -692,6 +692,7 @@ func generateContainer( | |||
| 	privilegedMode bool, | ||||
| 	privilegeEscalationMode *bool, | ||||
| 	additionalPodCapabilities *v1.Capabilities, | ||||
| 	useEphemeralVolumes *bool, | ||||
| ) *v1.Container { | ||||
| 	return &v1.Container{ | ||||
| 		Name:            name, | ||||
|  | @ -1394,6 +1395,7 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef | |||
| 		c.OpConfig.Resources.SpiloPrivileged, | ||||
| 		c.OpConfig.Resources.SpiloAllowPrivilegeEscalation, | ||||
| 		generateCapabilities(c.OpConfig.AdditionalPodCapabilities), | ||||
| 		nil, | ||||
| 	) | ||||
| 
 | ||||
| 	// Patroni responds 200 to probe only if it either owns the leader lock or postgres is running and DCS is accessible
 | ||||
|  | @ -2288,6 +2290,7 @@ func (c *Cluster) generateLogicalBackupJob() (*batchv1.CronJob, error) { | |||
| 		c.OpConfig.SpiloPrivileged, // use same value as for normal DB pods
 | ||||
| 		c.OpConfig.SpiloAllowPrivilegeEscalation, | ||||
| 		nil, | ||||
| 		nil, | ||||
| 	) | ||||
| 
 | ||||
| 	logicalBackupJobLabel := map[string]string{ | ||||
|  |  | |||
|  | @ -277,5 +277,8 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur | |||
| 		fromCRD.ConnectionPooler.MaxDBConnections, | ||||
| 		k8sutil.Int32ToPointer(constants.ConnectionPoolerMaxDBConnections)) | ||||
| 
 | ||||
| 	// Ephemeral config
 | ||||
| 	result.AllowEphemeralVolumes = util.CoalesceBool(fromCRD.AllowEphemeralVolumes, util.False()) | ||||
| 
 | ||||
| 	return result | ||||
| } | ||||
|  |  | |||
|  | @ -253,6 +253,7 @@ type Config struct { | |||
| 	EnableSecretsDeletion                    *bool             `name:"enable_secrets_deletion" default:"true"` | ||||
| 	EnablePersistentVolumeClaimDeletion      *bool             `name:"enable_persistent_volume_claim_deletion" default:"true"` | ||||
| 	PersistentVolumeClaimRetentionPolicy     map[string]string `name:"persistent_volume_claim_retention_policy" default:"when_deleted:retain,when_scaled:retain"` | ||||
| 	AllowEphemeralVolumes                    *bool             `json:"allow_ephemeral_volumes,omitempty"` | ||||
| } | ||||
| 
 | ||||
| // MustMarshal marshals the config or panics
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue