You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Licensed under the Apache License, Version 2.0 (the "License");
5
+
you may not use this file except in compliance with the License.
6
+
You may obtain a copy of the License at
7
+
8
+
http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+
Unless required by applicable law or agreed to in writing, software
11
+
distributed under the License is distributed on an "AS IS" BASIS,
12
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+
See the License for the specific language governing permissions and
14
+
limitations under the License.
15
+
*/
16
+
17
+
package v4
18
+
19
+
import (
20
+
corev1 "k8s.io/api/core/v1"
21
+
"k8s.io/apimachinery/pkg/api/resource"
22
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23
+
)
24
+
25
+
// PostgresClusterSpec defines the desired state of PostgresCluster.
26
+
// Validation rules ensure immutability of Class, and that Storage and PostgresVersion can only be set once and cannot be removed or downgraded.
27
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.postgresVersion) || semver(self.postgresVersion, true).compareTo(semver(oldSelf.postgresVersion, true)) >= 0",message="Postgres version cannot be downgraded"
28
+
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.storage) || (has(self.storage) && quantity(self.storage).compareTo(quantity(oldSelf.storage)) >= 0)",message="Storage size cannot be removed and can only be increased"
29
+
typePostgresClusterSpecstruct {
30
+
// This field is IMMUTABLE after creation.
31
+
// +kubebuilder:validation:Required
32
+
// +kubebuilder:validation:MinLength=1
33
+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="class is immutable"
34
+
Classstring`json:"class"`
35
+
36
+
// Storage overrides the storage size from ClusterClass.
0 commit comments