update docs and change order in config
This commit is contained in:
		
							parent
							
								
									b8453e6075
								
							
						
					
					
						commit
						df338cc03d
					
				|  | @ -161,6 +161,13 @@ configuration they are grouped under the `kubernetes` key. | |||
|   replaced by the cluster name. Only the `{cluster}` placeholders is allowed in | ||||
|   the template. | ||||
| 
 | ||||
| * **enable_pod_disruption_budget** | ||||
|   if disabled `MinAvailable` in the PDB's spec will be set to `0`. That means | ||||
|   the PDB will get created anyway. The PDB is also relaxed when scaling down the | ||||
|   Postgres cluster to `"numberOfInstances": 0`. When scaling up or enabling this | ||||
|   configuration parameter delete the operator Pod to get the PDB synced. By | ||||
|   default PDB is enabled which results in `"MinAvailable": 1` | ||||
| 
 | ||||
| * **secret_name_template** | ||||
|   a template for the name of the database user secrets generated by the | ||||
|   operator. `{username}` is replaced with name of the secret, `{cluster}` with | ||||
|  |  | |||
|  | @ -20,6 +20,7 @@ configuration: | |||
|     pod_service_account_name: operator | ||||
|     pod_terminate_grace_period: 5m | ||||
|     pdb_name_format: "postgres-{cluster}-pdb" | ||||
|     enable_pod_disruption_budget: true | ||||
|     secret_name_template: "{username}.{cluster}.credentials.{tprkind}.{tprgroup}" | ||||
|     cluster_domain: cluster.local | ||||
|     oauth_token_secret_name: postgresql-operator | ||||
|  | @ -40,7 +41,6 @@ configuration: | |||
|     pod_management_policy: "ordered_ready" | ||||
|     enable_pod_antiaffinity: false | ||||
|     pod_antiaffinity_topology_key: "kubernetes.io/hostname" | ||||
|     enable_pod_disruption_budget: true | ||||
|   postgres_pod_resources: | ||||
|     default_cpu_request: 100m | ||||
|     default_memory_request: 100Mi | ||||
|  |  | |||
|  | @ -49,6 +49,7 @@ type KubernetesMetaConfiguration struct { | |||
| 	SpiloFSGroup                           *int64                `json:"spilo_fsgroup,omitempty"` | ||||
| 	WatchedNamespace                       string                `json:"watched_namespace,omitempty"` | ||||
| 	PDBNameFormat                          config.StringTemplate `json:"pdb_name_format,omitempty"` | ||||
| 	EnablePodDisruptionBudget              *bool                 `json:"enable_pod_disruption_budget,omitempty"` | ||||
| 	SecretNameTemplate                     config.StringTemplate `json:"secret_name_template,omitempty"` | ||||
| 	ClusterDomain                          string                `json:"cluster_domain"` | ||||
| 	OAuthTokenSecretName                   spec.NamespacedName   `json:"oauth_token_secret_name,omitempty"` | ||||
|  | @ -67,7 +68,6 @@ type KubernetesMetaConfiguration struct { | |||
| 	EnablePodAntiAffinity      bool          `json:"enable_pod_antiaffinity,omitempty"` | ||||
| 	PodAntiAffinityTopologyKey string        `json:"pod_antiaffinity_topology_key,omitempty"` | ||||
| 	PodManagementPolicy        string        `json:"pod_management_policy,omitempty"` | ||||
| 	EnablePodDisruptionBudget  bool          `json:"enable_pod_disruption_budget,omitempty"` | ||||
| } | ||||
| 
 | ||||
| // PostgresPodResourcesDefaults defines the spec of default resources
 | ||||
|  |  | |||
|  | @ -1273,9 +1273,10 @@ func (c *Cluster) generateCloneEnvironment(description *acidv1.CloneDescription) | |||
| 
 | ||||
| func (c *Cluster) generatePodDisruptionBudget() *policybeta1.PodDisruptionBudget { | ||||
| 	minAvailable := intstr.FromInt(1) | ||||
| 	pdbEnabled := c.OpConfig.EnablePodDisruptionBudget | ||||
| 
 | ||||
| 	// Is PodDisruptionBudget is disabled or if there is no master, set the budget to 0.
 | ||||
| 	if (c.OpConfig.EnablePodDisruptionBudget != nil && !*c.OpConfig.EnablePodDisruptionBudget) || c.Spec.NumberOfInstances <= 0 { | ||||
| 	if (pdbEnabled != nil && !*pdbEnabled) || c.Spec.NumberOfInstances <= 0 { | ||||
| 		minAvailable = intstr.FromInt(0) | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -41,12 +41,12 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur | |||
| 	result.PodServiceAccountRoleBindingDefinition = fromCRD.Kubernetes.PodServiceAccountRoleBindingDefinition | ||||
| 	result.PodEnvironmentConfigMap = fromCRD.Kubernetes.PodEnvironmentConfigMap | ||||
| 	result.PodTerminateGracePeriod = time.Duration(fromCRD.Kubernetes.PodTerminateGracePeriod) | ||||
| 	result.EnablePodDisruptionBudget = fromCRD.Kubernetes.EnablePodDisruptionBudget | ||||
| 	result.SpiloPrivileged = fromCRD.Kubernetes.SpiloPrivileged | ||||
| 	result.SpiloFSGroup = fromCRD.Kubernetes.SpiloFSGroup | ||||
| 	result.ClusterDomain = fromCRD.Kubernetes.ClusterDomain | ||||
| 	result.WatchedNamespace = fromCRD.Kubernetes.WatchedNamespace | ||||
| 	result.PDBNameFormat = fromCRD.Kubernetes.PDBNameFormat | ||||
| 	result.EnablePodDisruptionBudget = fromCRD.Kubernetes.EnablePodDisruptionBudget | ||||
| 	result.SecretNameTemplate = fromCRD.Kubernetes.SecretNameTemplate | ||||
| 	result.OAuthTokenSecretName = fromCRD.Kubernetes.OAuthTokenSecretName | ||||
| 	result.InfrastructureRolesSecretName = fromCRD.Kubernetes.InfrastructureRolesSecretName | ||||
|  |  | |||
|  | @ -114,6 +114,7 @@ type Config struct { | |||
| 	MasterDNSNameFormat       StringTemplate    `name:"master_dns_name_format" default:"{cluster}.{team}.{hostedzone}"` | ||||
| 	ReplicaDNSNameFormat      StringTemplate    `name:"replica_dns_name_format" default:"{cluster}-repl.{team}.{hostedzone}"` | ||||
| 	PDBNameFormat             StringTemplate    `name:"pdb_name_format" default:"postgres-{cluster}-pdb"` | ||||
| 	EnablePodDisruptionBudget *bool             `name:"enable_pod_disruption_budget" default:"true"` | ||||
| 	Workers                   uint32            `name:"workers" default:"4"` | ||||
| 	APIPort                   int               `name:"api_port" default:"8080"` | ||||
| 	RingLogLines              int               `name:"ring_log_lines" default:"100"` | ||||
|  | @ -121,7 +122,6 @@ type Config struct { | |||
| 	TeamAPIRoleConfiguration  map[string]string `name:"team_api_role_configuration" default:"log_statement:all"` | ||||
| 	PodTerminateGracePeriod   time.Duration     `name:"pod_terminate_grace_period" default:"5m"` | ||||
| 	PodManagementPolicy       string            `name:"pod_management_policy" default:"ordered_ready"` | ||||
| 	EnablePodDisruptionBudget *bool             `name:"enable_pod_disruption_budget" default:"true"` | ||||
| 	ProtectedRoles            []string          `name:"protected_role_names" default:"admin"` | ||||
| 	PostgresSuperuserTeams    []string          `name:"postgres_superuser_teams" default:""` | ||||
| 	SetMemoryRequestToLimit   bool              `name:"set_memory_request_to_limit" default:"false"` | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue