Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lowercase regex validation for vpc, vpcsubnet and loadbalancer names #1715

Merged
merged 3 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/v1beta2/ibmpowervscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ type VPCResourceReference struct {

// name of resource.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength:=63
// +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`
// +optional
Name *string `json:"name,omitempty"`

Expand Down
1 change: 1 addition & 0 deletions api/v1beta2/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type IBMVPCClusterSpec struct {
type VPCLoadBalancerSpec struct {
// Name sets the name of the VPC load balancer.
// +kubebuilder:validation:MaxLength:=63
// +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`
// +optional
Name string `json:"name,omitempty"`

Expand Down
8 changes: 5 additions & 3 deletions api/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,11 @@ type SecurityGroupRulePrototype struct {
// Subnet describes a subnet.
type Subnet struct {
Ipv4CidrBlock *string `json:"cidr,omitempty"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Zone *string `json:"zone,omitempty"`
// +kubebuilder:validation:MaxLength:=63
// +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Zone *string `json:"zone,omitempty"`
}

// VPCEndpoint describes a VPCEndpoint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ spec:
name:
description: Name sets the name of the VPC load balancer.
maxLength: 63
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
public:
default: true
Expand Down Expand Up @@ -413,7 +414,9 @@ spec:
type: string
name:
description: name of resource.
maxLength: 63
minLength: 1
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
region:
description: |-
Expand All @@ -439,6 +442,8 @@ spec:
id:
type: string
name:
maxLength: 63
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
zone:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ spec:
name:
description: Name sets the name of the VPC load balancer.
maxLength: 63
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
public:
default: true
Expand Down Expand Up @@ -444,7 +445,9 @@ spec:
type: string
name:
description: name of resource.
maxLength: 63
minLength: 1
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
region:
description: |-
Expand All @@ -470,6 +473,8 @@ spec:
id:
type: string
name:
maxLength: 63
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
zone:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ spec:
name:
description: Name sets the name of the VPC load balancer.
maxLength: 63
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
public:
default: true
Expand Down Expand Up @@ -366,6 +367,8 @@ spec:
id:
type: string
name:
maxLength: 63
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
zone:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ spec:
name:
description: Name sets the name of the VPC load balancer.
maxLength: 63
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
public:
default: true
Expand Down