cover validation in docs and export it in crds.go

This commit is contained in:
Felix Kunde 2019-10-29 16:33:20 +01:00
parent 4d3dce2968
commit 37f7b542f3
2 changed files with 8 additions and 4 deletions

View File

@ -284,6 +284,7 @@ manifest files:
Postgres manifest parameters are defined in the [api package](../pkg/apis/acid.zalan.do/v1/postgresql_type.go). 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). 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: Please, reflect your changes in tests, for example in:
* [config_test.go](../pkg/util/config/config_test.go) * [config_test.go](../pkg/util/config/config_test.go)
* [k8sres_test.go](../pkg/cluster/k8sres_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: For the CRD-based configuration, please update the following files:
* the default [OperatorConfiguration](../manifests/postgresql-operator-default-configuration.yaml) * the default [OperatorConfiguration](../manifests/postgresql-operator-default-configuration.yaml)
* the Helm chart's [values-crd file](../charts/postgres-operator/values.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 Reflect the changes in the ConfigMap configuration as well (note that numeric
and boolean parameters have to use double quotes here): and boolean parameters have to use double quotes here):

View File

@ -107,7 +107,8 @@ var min0 = 0.0
var min1 = 1.0 var min1 = 1.0
var minDisable = -1.0 var minDisable = -1.0
var postgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{ // PostgresCRDResourceValidation to check applied manifest parameters
var PostgresCRDResourceValidation = apiextv1beta1.JSONSchemaProps{
Type: "object", Type: "object",
Required: []string{"spec"}, Required: []string{"spec"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ 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", Type: "object",
Required: []string{"configuration"}, Required: []string{"configuration"},
Properties: map[string]apiextv1beta1.JSONSchemaProps{ Properties: map[string]apiextv1beta1.JSONSchemaProps{
@ -920,7 +922,7 @@ func PostgresCRD() *apiextv1beta1.CustomResourceDefinition {
PostgresCRDResourcePlural, PostgresCRDResourcePlural,
PostgresCRDResourceShort, PostgresCRDResourceShort,
PostgresCRDResourceColumns, PostgresCRDResourceColumns,
postgresCRDResourceValidation) PostgresCRDResourceValidation)
} }
// ConfigurationCRD returns CustomResourceDefinition built from OperatorConfigCRDResource // ConfigurationCRD returns CustomResourceDefinition built from OperatorConfigCRDResource
@ -930,5 +932,5 @@ func ConfigurationCRD() *apiextv1beta1.CustomResourceDefinition {
OperatorConfigCRDResourcePlural, OperatorConfigCRDResourcePlural,
OperatorConfigCRDResourceShort, OperatorConfigCRDResourceShort,
OperatorConfigCRDResourceColumns, OperatorConfigCRDResourceColumns,
operatorConfigCRDResourceValidation) OperatorConfigCRDResourceValidation)
} }