Skip to content

Commit

Permalink
fix: update regex validation for Kind and PVC
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraprafful committed Nov 18, 2024
1 parent 9d02acf commit cea9552
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions workspaces/controller/api/v1beta1/workspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type WorkspaceSpec struct {
// the WorkspaceKind to use
//+kubebuilder:validation:MinLength:=2
//+kubebuilder:validation:MaxLength:=63
//+kubebuilder:validation:Pattern:=^[a-z0-9][-a-z0-9]*[a-z0-9]$
//+kubebuilder:validation:Pattern:=^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
//+kubebuilder:validation:XValidation:rule="self == oldSelf",message="Workspace 'kind' is immutable"
//+kubebuilder:example="jupyterlab"
Kind string `json:"kind"`
Expand Down Expand Up @@ -85,7 +85,7 @@ type WorkspacePodVolumes struct {
//+kubebuilder:validation:Optional
//+kubebuilder:validation:MinLength:=2
//+kubebuilder:validation:MaxLength:=63
//+kubebuilder:validation:Pattern:=^[a-z0-9][-a-z0-9]*[a-z0-9]$
//+kubebuilder:validation:Pattern:=^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
//+kubebuilder:example="my-home-pvc"
Home *string `json:"home,omitempty"`

Expand All @@ -104,7 +104,7 @@ type PodVolumeMount struct {
// the name of the PVC to mount
//+kubebuilder:validation:MinLength:=2
//+kubebuilder:validation:MaxLength:=63
//+kubebuilder:validation:Pattern:=^[a-z0-9][-a-z0-9]*[a-z0-9]$
//+kubebuilder:validation:Pattern:=^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
//+kubebuilder:example="my-data-pvc"
PVCName string `json:"pvcName"`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ spec:
example: jupyterlab
maxLength: 63
minLength: 2
pattern: ^[a-z0-9][-a-z0-9]*[a-z0-9]$
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
x-kubernetes-validations:
- message: Workspace 'kind' is immutable
Expand Down Expand Up @@ -130,7 +130,7 @@ spec:
example: my-data-pvc
maxLength: 63
minLength: 2
pattern: ^[a-z0-9][-a-z0-9]*[a-z0-9]$
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
readOnly:
default: false
Expand All @@ -154,7 +154,7 @@ spec:
example: my-home-pvc
maxLength: 63
minLength: 2
pattern: ^[a-z0-9][-a-z0-9]*[a-z0-9]$
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
type: object
required:
Expand Down

0 comments on commit cea9552

Please sign in to comment.