deprecate snake_case manifest parameters
This commit is contained in:
		
							parent
							
								
									d69211032e
								
							
						
					
					
						commit
						1fba71fb07
					
				|  | @ -351,7 +351,7 @@ metadata: | ||||||
|   name: acid-minimal-cluster |   name: acid-minimal-cluster | ||||||
| spec: | spec: | ||||||
|   ... |   ... | ||||||
|   init_containers: |   initContainers: | ||||||
|     - name: "container-name" |     - name: "container-name" | ||||||
|       image: "company/image:tag" |       image: "company/image:tag" | ||||||
|       env: |       env: | ||||||
|  | @ -359,7 +359,7 @@ spec: | ||||||
|           value: "any-k8s-env-things" |           value: "any-k8s-env-things" | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| `init_containers` accepts full `v1.Container` definition. | `initContainers` accepts full `v1.Container` definition. | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| ## Increase volume size | ## Increase volume size | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ kind: postgresql | ||||||
| metadata: | metadata: | ||||||
|   name: acid-test-cluster |   name: acid-test-cluster | ||||||
| spec: | spec: | ||||||
|   init_containers: |   initContainers: | ||||||
|   - name: date |   - name: date | ||||||
|     image: busybox |     image: busybox | ||||||
|     command: [ "/bin/date" ] |     command: [ "/bin/date" ] | ||||||
|  | @ -58,7 +58,7 @@ spec: | ||||||
|     loop_wait: &loop_wait 10 |     loop_wait: &loop_wait 10 | ||||||
|     retry_timeout: 10 |     retry_timeout: 10 | ||||||
|     maximum_lag_on_failover: 33554432 |     maximum_lag_on_failover: 33554432 | ||||||
|   # restore a Postgres DB with point-in-time-recovery  |   # restore a Postgres DB with point-in-time-recovery | ||||||
|   # with a non-empty timestamp, clone from an S3 bucket using the latest backup before the timestamp |   # with a non-empty timestamp, clone from an S3 bucket using the latest backup before the timestamp | ||||||
|   # with an empty/absent timestamp, clone from an existing alive cluster using pg_basebackup |   # with an empty/absent timestamp, clone from an existing alive cluster using pg_basebackup | ||||||
|   # clone: |   # clone: | ||||||
|  |  | ||||||
|  | @ -120,6 +120,15 @@ func (p *Postgresql) UnmarshalJSON(data []byte) error { | ||||||
| 		tmp2.Spec.ClusterName = clusterName | 		tmp2.Spec.ClusterName = clusterName | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	if tmp2.Spec.InitContainersOld != nil && tmp2.Spec.InitContainers == nil { | ||||||
|  | 		tmp2.Spec.InitContainers = tmp2.Spec.InitContainersOld | ||||||
|  | 		tmp2.Spec.InitContainersOld = nil | ||||||
|  | 	} | ||||||
|  | 	if tmp2.Spec.PodPriorityClassNameOld != "" && tmp2.Spec.PodPriorityClassName == "" { | ||||||
|  | 		tmp2.Spec.PodPriorityClassName = tmp2.Spec.PodPriorityClassNameOld | ||||||
|  | 		tmp2.Spec.PodPriorityClassNameOld = "" | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	*p = tmp2 | 	*p = tmp2 | ||||||
| 
 | 
 | ||||||
| 	return nil | 	return nil | ||||||
|  |  | ||||||
|  | @ -53,12 +53,16 @@ type PostgresSpec struct { | ||||||
| 	Databases             map[string]string    `json:"databases,omitempty"` | 	Databases             map[string]string    `json:"databases,omitempty"` | ||||||
| 	Tolerations           []v1.Toleration      `json:"tolerations,omitempty"` | 	Tolerations           []v1.Toleration      `json:"tolerations,omitempty"` | ||||||
| 	Sidecars              []Sidecar            `json:"sidecars,omitempty"` | 	Sidecars              []Sidecar            `json:"sidecars,omitempty"` | ||||||
| 	InitContainers        []v1.Container       `json:"init_containers,omitempty"` | 	InitContainers        []v1.Container       `json:"initContainers,omitempty"` | ||||||
| 	PodPriorityClassName  string               `json:"pod_priority_class_name,omitempty"` | 	PodPriorityClassName  string               `json:"podPriorityClassName,omitempty"` | ||||||
| 	ShmVolume             *bool                `json:"enableShmVolume,omitempty"` | 	ShmVolume             *bool                `json:"enableShmVolume,omitempty"` | ||||||
| 	EnableLogicalBackup   bool                 `json:"enableLogicalBackup,omitempty"` | 	EnableLogicalBackup   bool                 `json:"enableLogicalBackup,omitempty"` | ||||||
| 	LogicalBackupSchedule string               `json:"logicalBackupSchedule,omitempty"` | 	LogicalBackupSchedule string               `json:"logicalBackupSchedule,omitempty"` | ||||||
| 	StandbyCluster        *StandbyDescription  `json:"standby"` | 	StandbyCluster        *StandbyDescription  `json:"standby"` | ||||||
|  | 
 | ||||||
|  | 	// deprectaed json tags
 | ||||||
|  | 	InitContainersOld       []v1.Container `json:"init_containers,omitempty"` | ||||||
|  | 	PodPriorityClassNameOld string         `json:"pod_priority_class_name,omitempty"` | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
 | ||||||
|  |  | ||||||
|  | @ -179,6 +179,7 @@ var unmarshalCluster = []struct { | ||||||
| 	  }, | 	  }, | ||||||
| 	  "spec": { | 	  "spec": { | ||||||
| 	    "teamId": "ACID", | 	    "teamId": "ACID", | ||||||
|  | 		"pod_priority_class_name": "spilo-pod-priority", | ||||||
| 	    "volume": { | 	    "volume": { | ||||||
| 	      "size": "5Gi", | 	      "size": "5Gi", | ||||||
| 	      "storageClass": "SSD", | 	      "storageClass": "SSD", | ||||||
|  | @ -261,6 +262,7 @@ var unmarshalCluster = []struct { | ||||||
| 						"log_statement":   "all", | 						"log_statement":   "all", | ||||||
| 					}, | 					}, | ||||||
| 				}, | 				}, | ||||||
|  | 				PodPriorityClassName: "spilo-pod-priority", | ||||||
| 				Volume: Volume{ | 				Volume: Volume{ | ||||||
| 					Size:         "5Gi", | 					Size:         "5Gi", | ||||||
| 					StorageClass: "SSD", | 					StorageClass: "SSD", | ||||||
|  | @ -313,7 +315,7 @@ var unmarshalCluster = []struct { | ||||||
| 			}, | 			}, | ||||||
| 			Error: "", | 			Error: "", | ||||||
| 		}, | 		}, | ||||||
| 		marshal: []byte(`{"kind":"Postgresql","apiVersion":"acid.zalan.do/v1","metadata":{"name":"acid-testcluster1","creationTimestamp":null},"spec":{"postgresql":{"version":"9.6","parameters":{"log_statement":"all","max_connections":"10","shared_buffers":"32MB"}},"volume":{"size":"5Gi","storageClass":"SSD", "subPath": "subdir"},"patroni":{"initdb":{"data-checksums":"true","encoding":"UTF8","locale":"en_US.UTF-8"},"pg_hba":["hostssl all all 0.0.0.0/0 md5","host    all all 0.0.0.0/0 md5"],"ttl":30,"loop_wait":10,"retry_timeout":10,"maximum_lag_on_failover":33554432,"slots":{"permanent_logical_1":{"database":"foo","plugin":"pgoutput","type":"logical"}}},"resources":{"requests":{"cpu":"10m","memory":"50Mi"},"limits":{"cpu":"300m","memory":"3000Mi"}},"teamId":"ACID","allowedSourceRanges":["127.0.0.1/32"],"numberOfInstances":2,"users":{"zalando":["superuser","createdb"]},"maintenanceWindows":["Mon:01:00-06:00","Sat:00:00-04:00","05:00-05:15"],"clone":{"cluster":"acid-batman"}},"status":{"PostgresClusterStatus":""}}`), | 		marshal: []byte(`{"kind":"Postgresql","apiVersion":"acid.zalan.do/v1","metadata":{"name":"acid-testcluster1","creationTimestamp":null},"spec":{"postgresql":{"version":"9.6","parameters":{"log_statement":"all","max_connections":"10","shared_buffers":"32MB"}},"podPriorityClassName":"spilo-pod-priority","volume":{"size":"5Gi","storageClass":"SSD", "subPath": "subdir"},"patroni":{"initdb":{"data-checksums":"true","encoding":"UTF8","locale":"en_US.UTF-8"},"pg_hba":["hostssl all all 0.0.0.0/0 md5","host    all all 0.0.0.0/0 md5"],"ttl":30,"loop_wait":10,"retry_timeout":10,"maximum_lag_on_failover":33554432,"slots":{"permanent_logical_1":{"database":"foo","plugin":"pgoutput","type":"logical"}}},"resources":{"requests":{"cpu":"10m","memory":"50Mi"},"limits":{"cpu":"300m","memory":"3000Mi"}},"teamId":"ACID","allowedSourceRanges":["127.0.0.1/32"],"numberOfInstances":2,"users":{"zalando":["superuser","createdb"]},"maintenanceWindows":["Mon:01:00-06:00","Sat:00:00-04:00","05:00-05:15"],"clone":{"cluster":"acid-batman"}},"status":{"PostgresClusterStatus":""}}`), | ||||||
| 		err:     nil}, | 		err:     nil}, | ||||||
| 	// example with teamId set in input
 | 	// example with teamId set in input
 | ||||||
| 	{ | 	{ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue