make Postgres 14 available
This commit is contained in:
		
							parent
							
								
									d3183604a7
								
							
						
					
					
						commit
						3debbe2749
					
				
							
								
								
									
										11
									
								
								README.md
								
								
								
								
							
							
						
						
									
										11
									
								
								README.md
								
								
								
								
							|  | @ -35,7 +35,7 @@ pipelines with no access to Kubernetes API directly, promoting infrastructure as | |||
| [pg_basebackup](https://www.postgresql.org/docs/11/app-pgbasebackup.html) / | ||||
| [WAL-E](https://github.com/wal-e/wal-e) via [Spilo](https://github.com/zalando/spilo) | ||||
| * Preload libraries: [bg_mon](https://github.com/CyberDem0n/bg_mon), | ||||
| [pg_stat_statements](https://www.postgresql.org/docs/9.4/pgstatstatements.html), | ||||
| [pg_stat_statements](https://www.postgresql.org/docs/14/pgstatstatements.html), | ||||
| [pgextwlist](https://github.com/dimitri/pgextwlist), | ||||
| [pg_auth_mon](https://github.com/RafiaSabih/pg_auth_mon) | ||||
| * Incl. popular Postgres extensions such as | ||||
|  | @ -53,15 +53,10 @@ pipelines with no access to Kubernetes API directly, promoting infrastructure as | |||
| The Postgres Operator has been developed at Zalando and is being used in | ||||
| production for over three years. | ||||
| 
 | ||||
| ## Notes on Postgres 13 support | ||||
| 
 | ||||
| If you are new to the operator, you can skip this and just start using the Postgres operator as is, Postgres 13 is ready to go. | ||||
| 
 | ||||
| The Postgres operator supports Postgres 13 with the new Spilo Image that includes also the recent Patroni version to support PG13 settings. | ||||
| More work on optimizing restarts and rolling upgrades is pending. | ||||
| ## Using Spilo 12 images or lower | ||||
| 
 | ||||
| If you are already using the Postgres operator in older version with a Spilo 12 Docker image you need to be aware of the changes for the backup path. | ||||
| We introduce the major version into the backup path to smoothen the [major version upgrade](docs/administrator.md#minor-and-major-version-upgrade) that is now supported manually. | ||||
| We introduce the major version into the backup path to smoothen the [major version upgrade](docs/administrator.md#minor-and-major-version-upgrade) that is now supported. | ||||
| 
 | ||||
| The new operator configuration can set a compatibility flag *enable_spilo_wal_path_compat* to make Spilo look for wal segments in the current path but also old format paths. | ||||
| This comes at potential performance costs and should be disabled after a few days. | ||||
|  |  | |||
|  | @ -71,6 +71,7 @@ spec: | |||
|                   "resources_visible": true, | ||||
|                   "users_visible": true, | ||||
|                   "postgresql_versions": [ | ||||
|                     "14", | ||||
|                     "13", | ||||
|                     "12", | ||||
|                     "11" | ||||
|  |  | |||
|  | @ -135,10 +135,10 @@ spec: | |||
|                     default: "off" | ||||
|                   minimal_major_version: | ||||
|                     type: string | ||||
|                     default: "9.5" | ||||
|                     default: "9.6" | ||||
|                   target_major_version: | ||||
|                     type: string | ||||
|                     default: "13" | ||||
|                     default: "14" | ||||
|               kubernetes: | ||||
|                 type: object | ||||
|                 properties: | ||||
|  |  | |||
|  | @ -362,14 +362,12 @@ spec: | |||
|                   version: | ||||
|                     type: string | ||||
|                     enum: | ||||
|                       - "9.3" | ||||
|                       - "9.4" | ||||
|                       - "9.5" | ||||
|                       - "9.6" | ||||
|                       - "10" | ||||
|                       - "11" | ||||
|                       - "12" | ||||
|                       - "13" | ||||
|                       - "14" | ||||
|                   parameters: | ||||
|                     type: object | ||||
|                     additionalProperties: | ||||
|  |  | |||
|  | @ -65,9 +65,9 @@ configMajorVersionUpgrade: | |||
|   # "off": no upgrade, "manual": manifest triggers action, "full": minimal version violation triggers too | ||||
|   major_version_upgrade_mode: "off" | ||||
|   # minimal Postgres major version that will not automatically be upgraded | ||||
|   minimal_major_version: "9.5" | ||||
|   minimal_major_version: "9.6" | ||||
|   # target Postgres major version when upgrading clusters automatically | ||||
|   target_major_version: "13" | ||||
|   target_major_version: "14" | ||||
| 
 | ||||
| configKubernetes: | ||||
|   # list of additional capabilities for postgres container | ||||
|  |  | |||
|  | @ -186,12 +186,12 @@ CRD-configuration, they are grouped under the `major_version_upgrade` key. | |||
| 
 | ||||
| * **minimal_major_version** | ||||
|   The minimal Postgres major version that will not automatically be upgraded | ||||
|   when `major_version_upgrade_mode` is set to `"full"`. The default is `"9.5"`. | ||||
|   when `major_version_upgrade_mode` is set to `"full"`. The default is `"9.6"`. | ||||
| 
 | ||||
| * **target_major_version** | ||||
|   The target Postgres major version when upgrading clusters automatically | ||||
|   which violate the configured allowed `minimal_major_version` when | ||||
|   `major_version_upgrade_mode` is set to `"full"`. The default is `"13"`. | ||||
|   `major_version_upgrade_mode` is set to `"full"`. The default is `"14"`. | ||||
| 
 | ||||
| ## Kubernetes resources | ||||
| 
 | ||||
|  |  | |||
|  | @ -30,7 +30,7 @@ spec: | |||
|   databases: | ||||
|     foo: zalando | ||||
|   postgresql: | ||||
|     version: "13" | ||||
|     version: "14" | ||||
| ``` | ||||
| 
 | ||||
| Once you cloned the Postgres Operator [repository](https://github.com/zalando/postgres-operator) | ||||
|  |  | |||
|  | @ -766,7 +766,7 @@ class EndToEndTestCase(unittest.TestCase): | |||
|         pg_patch_version = { | ||||
|             "spec": { | ||||
|                 "postgres": { | ||||
|                     "version": "13" | ||||
|                     "version": "14" | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ spec: | |||
|           defaultRoles: true | ||||
|           defaultUsers: false | ||||
|   postgresql: | ||||
|     version: "13" | ||||
|     version: "14" | ||||
|     parameters:  # Expert section | ||||
|       shared_buffers: "32MB" | ||||
|       max_connections: "10" | ||||
|  |  | |||
|  | @ -83,7 +83,7 @@ data: | |||
|   # min_instances: "-1" | ||||
|   # min_cpu_limit: 250m | ||||
|   # min_memory_limit: 250Mi | ||||
|   # minimal_major_version: "9.5" | ||||
|   # minimal_major_version: "9.6" | ||||
|   # node_readiness_label: "" | ||||
|   # oauth_token_secret_name: postgresql-operator | ||||
|   # pam_configuration: | | ||||
|  | @ -124,7 +124,7 @@ data: | |||
|   spilo_privileged: "false" | ||||
|   storage_resize_mode: "pvc" | ||||
|   super_username: postgres | ||||
|   # target_major_version: "13" | ||||
|   # target_major_version: "14" | ||||
|   # team_admin_role: "admin" | ||||
|   # team_api_role_configuration: "log_statement:all" | ||||
|   # teams_api_url: http://fake-teams-api.default.svc.cluster.local | ||||
|  |  | |||
|  | @ -18,4 +18,4 @@ spec: | |||
|   preparedDatabases: | ||||
|     bar: {} | ||||
|   postgresql: | ||||
|     version: "13" | ||||
|     version: "14" | ||||
|  |  | |||
|  | @ -131,10 +131,10 @@ spec: | |||
|                     default: "off" | ||||
|                   minimal_major_version: | ||||
|                     type: string | ||||
|                     default: "9.5" | ||||
|                     default: "9.6" | ||||
|                   target_major_version: | ||||
|                     type: string | ||||
|                     default: "13" | ||||
|                     default: "14" | ||||
|               kubernetes: | ||||
|                 type: object | ||||
|                 properties: | ||||
|  |  | |||
|  | @ -28,8 +28,8 @@ configuration: | |||
|     super_username: postgres | ||||
|   major_version_upgrade: | ||||
|     major_version_upgrade_mode: "off" | ||||
|     minimal_major_version: "9.5" | ||||
|     target_major_version: "13" | ||||
|     minimal_major_version: "9.6" | ||||
|     target_major_version: "14" | ||||
|   kubernetes: | ||||
|     # additional_pod_capabilities: | ||||
|     # - "SYS_NICE" | ||||
|  |  | |||
|  | @ -358,14 +358,12 @@ spec: | |||
|                   version: | ||||
|                     type: string | ||||
|                     enum: | ||||
|                       - "9.3" | ||||
|                       - "9.4" | ||||
|                       - "9.5" | ||||
|                       - "9.6" | ||||
|                       - "10" | ||||
|                       - "11" | ||||
|                       - "12" | ||||
|                       - "13" | ||||
|                       - "14" | ||||
|                   parameters: | ||||
|                     type: object | ||||
|                     additionalProperties: | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ spec: | |||
|     size: 1Gi | ||||
|   numberOfInstances: 1 | ||||
|   postgresql: | ||||
|     version: "13" | ||||
|     version: "14" | ||||
| # Make this a standby cluster and provide the s3 bucket path of source cluster for continuous streaming. | ||||
|   standby: | ||||
|     s3_wal_path: "s3://path/to/bucket/containing/wal/of/source/cluster/" | ||||
|  |  | |||
|  | @ -504,15 +504,6 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{ | |||
| 							"version": { | ||||
| 								Type: "string", | ||||
| 								Enum: []apiextv1.JSON{ | ||||
| 									{ | ||||
| 										Raw: []byte(`"9.3"`), | ||||
| 									}, | ||||
| 									{ | ||||
| 										Raw: []byte(`"9.4"`), | ||||
| 									}, | ||||
| 									{ | ||||
| 										Raw: []byte(`"9.5"`), | ||||
| 									}, | ||||
| 									{ | ||||
| 										Raw: []byte(`"9.6"`), | ||||
| 									}, | ||||
|  | @ -528,6 +519,9 @@ var PostgresCRDResourceValidation = apiextv1.CustomResourceValidation{ | |||
| 									{ | ||||
| 										Raw: []byte(`"13"`), | ||||
| 									}, | ||||
| 									{ | ||||
| 										Raw: []byte(`"14"`), | ||||
| 									}, | ||||
| 								}, | ||||
| 							}, | ||||
| 							"parameters": { | ||||
|  |  | |||
|  | @ -44,8 +44,8 @@ type PostgresUsersConfiguration struct { | |||
| // MajorVersionUpgradeConfiguration defines how to execute major version upgrades of Postgres.
 | ||||
| type MajorVersionUpgradeConfiguration struct { | ||||
| 	MajorVersionUpgradeMode string `json:"major_version_upgrade_mode" default:"off"` // off - no actions, manual - manifest triggers action, full - manifest and minimal version violation trigger upgrade
 | ||||
| 	MinimalMajorVersion     string `json:"minimal_major_version" default:"9.5"` | ||||
| 	TargetMajorVersion      string `json:"target_major_version" default:"13"` | ||||
| 	MinimalMajorVersion     string `json:"minimal_major_version" default:"9.6"` | ||||
| 	TargetMajorVersion      string `json:"target_major_version" default:"14"` | ||||
| } | ||||
| 
 | ||||
| // KubernetesMetaConfiguration defines k8s conf required for all Postgres clusters and the operator itself
 | ||||
|  |  | |||
|  | @ -9,12 +9,12 @@ import ( | |||
| 
 | ||||
| // VersionMap Map of version numbers
 | ||||
| var VersionMap = map[string]int{ | ||||
| 	"9.5": 90500, | ||||
| 	"9.6": 90600, | ||||
| 	"10":  100000, | ||||
| 	"11":  110000, | ||||
| 	"12":  120000, | ||||
| 	"13":  130000, | ||||
| 	"14":  140000, | ||||
| } | ||||
| 
 | ||||
| // IsBiggerPostgresVersion Compare two Postgres version numbers
 | ||||
|  | @ -33,7 +33,7 @@ func (c *Cluster) GetDesiredMajorVersionAsInt() int { | |||
| func (c *Cluster) GetDesiredMajorVersion() string { | ||||
| 
 | ||||
| 	if c.Config.OpConfig.MajorVersionUpgradeMode == "full" { | ||||
| 		// current is 9.5, minimal is 11 allowing 11 to 13 clusters, everything below is upgraded
 | ||||
| 		// current is 9.6, minimal is 11 allowing 11 to 14 clusters, everything below is upgraded
 | ||||
| 		if IsBiggerPostgresVersion(c.Spec.PgVersion, c.Config.OpConfig.MinimalMajorVersion) { | ||||
| 			c.logger.Infof("overwriting configured major version %s to %s", c.Spec.PgVersion, c.Config.OpConfig.TargetMajorVersion) | ||||
| 			return c.Config.OpConfig.TargetMajorVersion | ||||
|  |  | |||
|  | @ -56,8 +56,8 @@ func (c *Controller) importConfigurationFromCRD(fromCRD *acidv1.OperatorConfigur | |||
| 
 | ||||
| 	// major version upgrade config
 | ||||
| 	result.MajorVersionUpgradeMode = util.Coalesce(fromCRD.MajorVersionUpgrade.MajorVersionUpgradeMode, "off") | ||||
| 	result.MinimalMajorVersion = util.Coalesce(fromCRD.MajorVersionUpgrade.MinimalMajorVersion, "9.5") | ||||
| 	result.TargetMajorVersion = util.Coalesce(fromCRD.MajorVersionUpgrade.TargetMajorVersion, "13") | ||||
| 	result.MinimalMajorVersion = util.Coalesce(fromCRD.MajorVersionUpgrade.MinimalMajorVersion, "9.6") | ||||
| 	result.TargetMajorVersion = util.Coalesce(fromCRD.MajorVersionUpgrade.TargetMajorVersion, "14") | ||||
| 
 | ||||
| 	// kubernetes config
 | ||||
| 	result.CustomPodAnnotations = fromCRD.Kubernetes.CustomPodAnnotations | ||||
|  |  | |||
|  | @ -212,8 +212,8 @@ type Config struct { | |||
| 	EnablePgVersionEnvVar                  bool              `name:"enable_pgversion_env_var" default:"true"` | ||||
| 	EnableSpiloWalPathCompat               bool              `name:"enable_spilo_wal_path_compat" default:"false"` | ||||
| 	MajorVersionUpgradeMode                string            `name:"major_version_upgrade_mode" default:"off"` | ||||
| 	MinimalMajorVersion                    string            `name:"minimal_major_version" default:"9.5"` | ||||
| 	TargetMajorVersion                     string            `name:"target_major_version" default:"13"` | ||||
| 	MinimalMajorVersion                    string            `name:"minimal_major_version" default:"9.6"` | ||||
| 	TargetMajorVersion                     string            `name:"target_major_version" default:"14"` | ||||
| } | ||||
| 
 | ||||
| // MustMarshal marshals the config or panics
 | ||||
|  |  | |||
|  | @ -66,6 +66,7 @@ spec: | |||
|                   "cost_core": 0.0575, | ||||
|                   "cost_memory": 0.014375, | ||||
|                   "postgresql_versions": [ | ||||
|                     "14", | ||||
|                     "13", | ||||
|                     "12", | ||||
|                     "11" | ||||
|  |  | |||
|  | @ -308,7 +308,7 @@ def read_versions( | |||
|         if uid == 'wal' or defaulting(lambda: UUID(uid)) | ||||
|     ] | ||||
| 
 | ||||
| BACKUP_VERSION_PREFIXES = ['','9.5/', '9.6/', '10/','11/', '12/', '13/'] | ||||
| BACKUP_VERSION_PREFIXES = ['', '9.6/', '10/', '11/', '12/', '13/', '14/'] | ||||
| 
 | ||||
| def read_basebackups( | ||||
|     pg_cluster, | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ default_operator_ui_config='{ | |||
|   "cost_core": 0.0575, | ||||
|   "cost_memory": 0.014375, | ||||
|   "postgresql_versions": [ | ||||
|     "14", | ||||
|     "13", | ||||
|     "12", | ||||
|     "11" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue