Skip to content

Commit

Permalink
update validation rules for controllerRef
Browse files Browse the repository at this point in the history
  • Loading branch information
randmonkey committed Jan 29, 2024
1 parent 24f3ff2 commit d18d4ba
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
16 changes: 14 additions & 2 deletions config/crd/bases/configuration.konghq.com_konglicenses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ spec:
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
enabled:
description: Enabled is set to true to let controllers (like KIC) to reconcile
it.
default: true
description: |-
Enabled is set to true to let controllers (like KIC) to reconcile it.
Default value is true to apply the license by default.
type: boolean
kind:
description: |-
Expand Down Expand Up @@ -155,17 +157,27 @@ spec:
description: |-
Group is the group of referent.
It should be empty if the referent is in "core" group (like pod.)
maxLength: 253
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
kind:
description: Kind is the kind of the referent.
maxLength: 63
minLength: 1
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
type: string
name:
description: Name is the name of the referent.
maxLength: 253
minLength: 1
type: string
namespace:
description: |-
Namespace is the namespace of the referent.
It should be empty if the referent is cluster scoped.
maxLength: 63
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
required:
- name
Expand Down
6 changes: 4 additions & 2 deletions docs/api-reference.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion pkg/apis/configuration/v1alpha1/kong_license_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ type KongLicense struct {
// RawLicenseString is the raw content of the license in string format.
RawLicenseString string `json:"rawLicenseString"`
// Enabled is set to true to let controllers (like KIC) to reconcile it.
// Default value is true to apply the license by default.
// +kubebuilder:default=true
Enabled bool `json:"enabled"`
// Status is the status of the KongLicense being processed by controllers.
Status KongLicenseStatus `json:"status,omitempty"`
Expand Down Expand Up @@ -52,15 +54,28 @@ type KongLicenseControllerStatus struct {

// Group refers to a Kubernetes Group. It must either be an empty string or a
// RFC 1123 subdomain.
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
type Group string

// Kind refers to a kubernetes kind.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$`
type Kind string

// Namespace refers to a Kubernetes namespace.
// Namespace refers to a Kubernetes namespace. It must be a RFC 1123 label.
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
type Namespace string

// ObjectName refers to the name of a Kubernetes object.
// Object names can have a variety of forms, including RFC1123 subdomains,
// RFC 1123 labels, or RFC 1035 labels.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
type ObjectName string

type ControllerReference struct {
Expand Down

0 comments on commit d18d4ba

Please sign in to comment.