Add CRD validation to KuryrNet and KuryrNetPolicy

This commits adds validation to important fields of KuryrNet and
KuryrNetPolicy CRDs.

Change-Id: I0262d60291e8f163e72f6c078c341984b5e5020c
This commit is contained in:
Maysa Macedo 2019-06-14 15:09:36 +00:00
parent e26da782aa
commit a85a7bc8b1
2 changed files with 134 additions and 0 deletions

View File

@ -10,3 +10,33 @@ spec:
plural: kuryrnets
singular: kuryrnet
kind: KuryrNet
additionalPrinterColumns:
- name: SUBNET-CIDR
type: string
description: The subnet CIDR allocated to the namespace
JSONPath: .spec.subnetCIDR
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
validation:
openAPIV3Schema:
properties:
spec:
required:
- netId
- routerId
- subnetCIDR
- subnetId
properties:
netId:
type: string
populated:
type: boolean
routerId:
type: string
sgId:
type: string
subnetCIDR:
type: string
subnetId:
type: string

View File

@ -12,3 +12,107 @@ spec:
kind: KuryrNetPolicy
shortNames:
- knp
additionalPrinterColumns:
- name: SG-ID
type: string
description: The ID of the SG associated to the policy
JSONPath: .spec.securityGroupId
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
validation:
openAPIV3Schema:
properties:
spec:
required:
- egressSgRules
- ingressSgRules
- networkpolicy_spec
- podSelector
- securityGroupId
properties:
egressSgRules:
type: array
items:
type: object
required:
- security_group_rule
properties:
remote_ip_prefixes:
type: object
namespace:
type: string
security_group_rule:
type: object
required:
- id
properties:
description:
type: string
direction:
type: string
ethertype:
type: string
id:
type: string
port_range_max:
type: integer
port_range_min:
type: integer
protocol:
type: string
remote_ip_prefix:
type: string
security_group_id:
type: string
ingressSgRules:
type: array
items:
type: object
required:
- security_group_rule
properties:
remote_ip_prefixes:
type: object
namespace:
type: string
security_group_rule:
type: object
required:
- id
properties:
description:
type: string
direction:
type: string
ethertype:
type: string
id:
type: string
port_range_max:
type: integer
port_range_min:
type: integer
protocol:
type: string
remote_ip_prefix:
type: string
security_group_id:
type: string
networkpolicy_spec:
type: object
properties:
podSelector:
type: object
policyTypes:
type: array
ingress:
type: array
egress:
type: array
podSelector:
type: object
securityGroupId:
type: string
securityGroupName:
type: string