diff --git a/docs/developer.md b/docs/developer.md index 26fb0bb2b..f8351e28a 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -284,6 +284,7 @@ manifest files: Postgres manifest parameters are defined in the [api package](../pkg/apis/acid.zalan.do/v1/postgresql_type.go). The operator behavior has to be implemented at least in [k8sres.go](../pkg/cluster/k8sres.go). +Validation of CRD parameters is controlled in [crd.go](../pkg/apis/acid.zalan.do/v1/crds.go). Please, reflect your changes in tests, for example in: * [config_test.go](../pkg/util/config/config_test.go) * [k8sres_test.go](../pkg/cluster/k8sres_test.go) @@ -294,6 +295,7 @@ Please, reflect your changes in tests, for example in: For the CRD-based configuration, please update the following files: * the default [OperatorConfiguration](../manifests/postgresql-operator-default-configuration.yaml) * the Helm chart's [values-crd file](../charts/postgres-operator/values.yaml) +* the CRD's [validation](../manifests/operatorconfiguration.crd.yaml) Reflect the changes in the ConfigMap configuration as well (note that numeric and boolean parameters have to use double quotes here): diff --git a/pkg/apis/acid.zalan.do/v1/crds.go b/pkg/apis/acid.zalan.do/v1/crds.go index 8fd820fe8..0b18319d8 100644 --- a/pkg/apis/acid.zalan.do/v1/crds.go +++ b/pkg/apis/acid.zalan.do/v1/crds.go @@ -107,7 +107,8 @@ var min0 = 0.0 var min1 = 1.0 var minDisable = -1.0 -var postgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ +// PostgresCRDResourceValidation to check applied manifest parameters +var PostgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ Type: "object", Required: []string{"spec"}, Properties: map[string]apiextv1beta1.JSONSchemaProps{ @@ -520,7 +521,8 @@ var postgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ }, } -var operatorConfigCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ +// OperatorConfigCRDResourceValidation to check applied manifest parameters +var OperatorConfigCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ Type: "object", Required: []string{"configuration"}, Properties: map[string]apiextv1beta1.JSONSchemaProps{ @@ -920,7 +922,7 @@ func PostgresCRD() *apiextv1beta1.CustomResourceDefinition { PostgresCRDResourcePlural, PostgresCRDResourceShort, PostgresCRDResourceColumns, - postgresCRDResourceValidation) + PostgresCRDResourceValidation) } // ConfigurationCRD returns CustomResourceDefinition built from OperatorConfigCRDResource @@ -930,5 +932,5 @@ func ConfigurationCRD() *apiextv1beta1.CustomResourceDefinition { OperatorConfigCRDResourcePlural, OperatorConfigCRDResourceShort, OperatorConfigCRDResourceColumns, - operatorConfigCRDResourceValidation) + OperatorConfigCRDResourceValidation) }