More validations on the LoginDiscoveryConfig CRD

Signed-off-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
Andrew Keesler 2020-07-29 13:14:50 -07:00 committed by Ryan Richard
parent b70f3aefe5
commit 7ba43e0c3f

View File

@ -1,5 +1,21 @@
#@ load("@ytt:data", "data") #@ load("@ytt:data", "data")
#! Example of valid LoginDiscoveryConfig object:
#! ---
#! apiVersion: suzerain-io.github.io/v1alpha1
#! kind: LoginDiscoveryConfig
#! metadata:
#! name: login-discovery
#! namespace: integration
#! spec:
#! server: https://foo
#! certificateAuthorityData: bar
#! identityProviders:
#! - name: baz
#! type: token
#! - name: bat
#! type: token
--- ---
apiVersion: apiextensions.k8s.io/v1 apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition kind: CustomResourceDefinition
@ -8,20 +24,24 @@ metadata:
spec: spec:
group: suzerain-io.github.io group: suzerain-io.github.io
versions: versions:
#! Any changes to these schemas should also be reflected in the types.go file(s)
#! in https://github.com/suzerain-io/placeholder-name-api/tree/main/pkg/apis/placeholder
- name: v1alpha1 - name: v1alpha1
served: true served: true
storage: true storage: true
schema: schema:
openAPIV3Schema: openAPIV3Schema:
type: object type: object
required: [spec]
properties: properties:
spec: spec:
type: object type: object
required: [server, certificateAuthorityData] required: [server, certificateAuthorityData, identityProviders]
properties: properties:
server: server:
type: string type: string
minLength: 1 minLength: 1
pattern: '^https://'
certificateAuthorityData: certificateAuthorityData:
type: string type: string
minLength: 1 minLength: 1
@ -29,12 +49,15 @@ spec:
type: array type: array
items: items:
type: object type: object
required: [name, type]
properties: properties:
name: name:
type: string type: string
idpType: minLength: 1
pattern: '^[a-zA-Z0-9]+(?:(-|_)?[a-zA-Z0-9]+)+$'
type: #! The name of this property is "type" (not declaring the type of a property).
type: string type: string
pattern: '^token$' #! validation via regexp pattern match pattern: '^token$'
scope: Namespaced scope: Namespaced
names: names:
plural: logindiscoveryconfigs plural: logindiscoveryconfigs