add maxLength constraint for CRD (#1175)
* add maxLength constraint for CRD
This commit is contained in:
parent
a8bfe4eb87
commit
22fa0875e2
|
|
@ -57,6 +57,7 @@ spec:
|
||||||
required:
|
required:
|
||||||
- kind
|
- kind
|
||||||
- apiVersion
|
- apiVersion
|
||||||
|
- metadata
|
||||||
- spec
|
- spec
|
||||||
properties:
|
properties:
|
||||||
kind:
|
kind:
|
||||||
|
|
@ -67,6 +68,14 @@ spec:
|
||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
- acid.zalan.do/v1
|
- acid.zalan.do/v1
|
||||||
|
metadata:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
maxLength: 53
|
||||||
spec:
|
spec:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ Note, that the name of the cluster must start with the `teamId` and `-`. At
|
||||||
Zalando we use team IDs (nicknames) to lower the chance of duplicate cluster
|
Zalando we use team IDs (nicknames) to lower the chance of duplicate cluster
|
||||||
names and colliding entities. The team ID would also be used to query an API to
|
names and colliding entities. The team ID would also be used to query an API to
|
||||||
get all members of a team and create [database roles](#teams-api-roles) for
|
get all members of a team and create [database roles](#teams-api-roles) for
|
||||||
them.
|
them. Besides, the maximum cluster name length is 53 characters.
|
||||||
|
|
||||||
## Watch pods being created
|
## Watch pods being created
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ spec:
|
||||||
required:
|
required:
|
||||||
- kind
|
- kind
|
||||||
- apiVersion
|
- apiVersion
|
||||||
|
- metadata
|
||||||
- spec
|
- spec
|
||||||
properties:
|
properties:
|
||||||
kind:
|
kind:
|
||||||
|
|
@ -63,6 +64,14 @@ spec:
|
||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
- acid.zalan.do/v1
|
- acid.zalan.do/v1
|
||||||
|
metadata:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
maxLength: 53
|
||||||
spec:
|
spec:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
|
|
||||||
|
|
@ -107,12 +107,13 @@ var min0 = 0.0
|
||||||
var min1 = 1.0
|
var min1 = 1.0
|
||||||
var min2 = 2.0
|
var min2 = 2.0
|
||||||
var minDisable = -1.0
|
var minDisable = -1.0
|
||||||
|
var maxLength = int64(53)
|
||||||
|
|
||||||
// PostgresCRDResourceValidation to check applied manifest parameters
|
// PostgresCRDResourceValidation to check applied manifest parameters
|
||||||
var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
|
var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
|
||||||
OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{
|
OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{
|
||||||
Type: "object",
|
Type: "object",
|
||||||
Required: []string{"kind", "apiVersion", "spec"},
|
Required: []string{"kind", "apiVersion", "metadata", "spec"},
|
||||||
Properties: map[string]apiextv1beta1.JSONSchemaProps{
|
Properties: map[string]apiextv1beta1.JSONSchemaProps{
|
||||||
"kind": {
|
"kind": {
|
||||||
Type: "string",
|
Type: "string",
|
||||||
|
|
@ -130,6 +131,16 @@ var PostgresCRDResourceValidation = apiextv1beta1.CustomResourceValidation{
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"metadata": {
|
||||||
|
Type: "object",
|
||||||
|
Required: []string{"name"},
|
||||||
|
Properties: map[string]apiextv1beta1.JSONSchemaProps{
|
||||||
|
"name": {
|
||||||
|
Type: "string",
|
||||||
|
MaxLength: &maxLength,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
"spec": {
|
"spec": {
|
||||||
Type: "object",
|
Type: "object",
|
||||||
Required: []string{"numberOfInstances", "teamId", "postgresql", "volume"},
|
Required: []string{"numberOfInstances", "teamId", "postgresql", "volume"},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue