Skip to content

Commit

Permalink
Add missing enum validations
Browse files Browse the repository at this point in the history
Add enum validations to types which should have them.
  • Loading branch information
ironcladlou committed Feb 11, 2020
1 parent a0e53e9 commit 6c7683d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
10 changes: 10 additions & 0 deletions config/v1/0000_10_config-operator_01_apiserver.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ spec:
\n minTLSVersion: TLSv1.1 \n NOTE: currently the highest
minTLSVersion allowed is VersionTLS12"
type: string
enum:
- VersionTLS10
- VersionTLS11
- VersionTLS12
- VersionTLS13
nullable: true
intermediate:
description: "intermediate is a TLS security profile based on: \n
Expand Down Expand Up @@ -215,5 +220,10 @@ spec:
profile is currently not supported because it is not yet well
adopted by common software libraries."
type: string
enum:
- Old
- Intermediate
- Modern
- Custom
status:
type: object
2 changes: 2 additions & 0 deletions config/v1/types_tlssecurityprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ type CustomTLSProfile struct {
}

// TLSProfileType defines a TLS security profile type.
// +kubebuilder:validation:Enum=Old;Intermediate;Modern;Custom
type TLSProfileType string

const (
Expand Down Expand Up @@ -180,6 +181,7 @@ type TLSProfileSpec struct {
//
// Note that SSLv3.0 is not a supported protocol version due to well known
// vulnerabilities such as POODLE: https://en.wikipedia.org/wiki/POODLE
// +kubebuilder:validation:Enum=VersionTLS10;VersionTLS11;VersionTLS12;VersionTLS13
type TLSProtocolVersion string

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ spec:
description: scope indicates the scope at which the load balancer
is exposed. Possible values are "External" and "Internal".
type: string
enum:
- Internal
- External
nodePort:
description: nodePort holds parameters for the NodePortService endpoint
publishing strategy. Present only if type is NodePortService.
Expand Down Expand Up @@ -143,6 +146,11 @@ spec:
changes to the node port field of the managed NodePort Service
will preserved."
type: string
enum:
- LoadBalancerService
- HostNetwork
- Private
- NodePortService
namespaceSelector:
description: "namespaceSelector is used to filter the set of namespaces
serviced by the ingress controller. This is useful for implementing
Expand Down Expand Up @@ -303,6 +311,9 @@ spec:
different paths of the same host name across namespaces. \n
If empty, the default is Strict."
type: string
enum:
- InterNamespaceAllowed
- Strict
routeSelector:
description: "routeSelector is used to filter the set of Routes serviced
by the ingress controller. This is useful for implementing shards.
Expand Down Expand Up @@ -386,6 +397,11 @@ spec:
\n minTLSVersion: TLSv1.1 \n NOTE: currently the highest
minTLSVersion allowed is VersionTLS12"
type: string
enum:
- VersionTLS10
- VersionTLS11
- VersionTLS12
- VersionTLS13
nullable: true
intermediate:
description: "intermediate is a TLS security profile based on: \n
Expand Down Expand Up @@ -436,6 +452,11 @@ spec:
profile is currently not supported because it is not yet well
adopted by common software libraries."
type: string
enum:
- Old
- Intermediate
- Modern
- Custom
status:
description: status is the most recently observed status of the IngressController.
type: object
Expand Down Expand Up @@ -504,6 +525,9 @@ spec:
description: scope indicates the scope at which the load balancer
is exposed. Possible values are "External" and "Internal".
type: string
enum:
- Internal
- External
nodePort:
description: nodePort holds parameters for the NodePortService endpoint
publishing strategy. Present only if type is NodePortService.
Expand Down Expand Up @@ -541,6 +565,11 @@ spec:
changes to the node port field of the managed NodePort Service
will preserved."
type: string
enum:
- LoadBalancerService
- HostNetwork
- Private
- NodePortService
observedGeneration:
description: observedGeneration is the most recent generation observed.
type: integer
Expand Down Expand Up @@ -570,6 +599,11 @@ spec:
TLSv1.1 \n NOTE: currently the highest minTLSVersion allowed is
VersionTLS12"
type: string
enum:
- VersionTLS10
- VersionTLS11
- VersionTLS12
- VersionTLS13
version: v1
versions:
- name: v1
Expand Down
3 changes: 3 additions & 0 deletions operator/v1/types_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ type NodePlacement struct {
}

// EndpointPublishingStrategyType is a way to publish ingress controller endpoints.
// +kubebuilder:validation:Enum=LoadBalancerService;HostNetwork;Private;NodePortService
type EndpointPublishingStrategyType string

const (
Expand All @@ -204,6 +205,7 @@ const (
)

// LoadBalancerScope is the scope at which a load balancer is exposed.
// +kubebuilder:validation:Enum=Internal;External
type LoadBalancerScope string

var (
Expand Down Expand Up @@ -337,6 +339,7 @@ type RouteAdmissionPolicy struct {

// NamespaceOwnershipCheck is a route admission policy component that describes
// how host name claims across namespaces should be handled.
// +kubebuilder:validation:Enum=InterNamespaceAllowed;Strict
type NamespaceOwnershipCheck string

const (
Expand Down

0 comments on commit 6c7683d

Please sign in to comment.