Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdeal committed Aug 5, 2024
1 parent 3d6b357 commit b68e50a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ spec:
type: string
x-kubernetes-validations:
- message: '''alias'' is improperly formatted, must match the format ''family@version'''
rule: self.matches('^[a-zA-Z0-9]*@.*$')
rule: self.matches('^[a-zA-Z0-9]+@.+$')
- message: 'family is not supported, must be one of the following: ''al2'', ''al2023'', ''bottlerocket'', ''windows2019'', ''windows2022'''
rule: self.find('^[^@]+') in ['al2','al2023','bottlerocket','windows2019','windows2022']
rule: self.split('@')[0] in ['al2','al2023','bottlerocket','windows2019','windows2022']
- message: windows families may only specify version 'latest'
rule: 'self.find(''^[^@]+'') in [''windows2019'',''windows2022''] ? self.split(''@'')[1] == ''latest'': true'
rule: 'self.split(''@'')[0] in [''windows2019'',''windows2022''] ? self.split(''@'')[1] == ''latest'' : true'
id:
description: ID is the ami id in EC2
pattern: ami-[0-9a-z]+
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ spec:
type: string
x-kubernetes-validations:
- message: '''alias'' is improperly formatted, must match the format ''family@version'''
rule: self.matches('^[a-zA-Z0-9]*@.*$')
rule: self.matches('^[a-zA-Z0-9]+@.+$')
- message: 'family is not supported, must be one of the following: ''al2'', ''al2023'', ''bottlerocket'', ''windows2019'', ''windows2022'''
rule: self.find('^[^@]+') in ['al2','al2023','bottlerocket','windows2019','windows2022']
rule: self.split('@')[0] in ['al2','al2023','bottlerocket','windows2019','windows2022']
- message: windows families may only specify version 'latest'
rule: 'self.find(''^[^@]+'') in [''windows2019'',''windows2022''] ? self.split(''@'')[1] == ''latest'': true'
rule: 'self.split(''@'')[0] in [''windows2019'',''windows2022''] ? self.split(''@'')[1] == ''latest'' : true'
id:
description: ID is the ami id in EC2
pattern: ami-[0-9a-z]+
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/v1/ec2nodeclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ type AMISelectorTerm struct {
// The version can either be pinned to a specific AMI release, with that AMIs version format (ex: "al2023@v20240625" or "bottlerocket@v1.10.0").
// The version can also be set to "latest" for any family. Setting the version to latest will result in drift when a new AMI is released. This is **not** recommended for production environments.
// Note: The Windows families do **not** support version pinning, and only latest may be used.
// +kubebuilder:validation:XValidation:message="'alias' is improperly formatted, must match the format 'family@version'",rule="self.matches('^[a-zA-Z0-9]*@.*$')"
// +kubebuilder:validation:XValidation:message="family is not supported, must be one of the following: 'al2', 'al2023', 'bottlerocket', 'windows2019', 'windows2022'",rule="self.find('^[^@]+') in ['al2','al2023','bottlerocket','windows2019','windows2022']"
// +kubebuilder:validation:XValidation:message="windows families may only specify version 'latest'",rule="self.find('^[^@]+') in ['windows2019','windows2022'] ? self.split('@')[1] == 'latest': true"
// +kubebuilder:validation:XValidation:message="'alias' is improperly formatted, must match the format 'family@version'",rule="self.matches('^[a-zA-Z0-9]+@.+$')"
// +kubebuilder:validation:XValidation:message="family is not supported, must be one of the following: 'al2', 'al2023', 'bottlerocket', 'windows2019', 'windows2022'",rule="self.split('@')[0] in ['al2','al2023','bottlerocket','windows2019','windows2022']"
// +kubebuilder:validation:XValidation:message="windows families may only specify version 'latest'",rule="self.split('@')[0] in ['windows2019','windows2022'] ? self.split('@')[1] == 'latest' : true"
// +kubebuilder:validation:MaxLength=30
// +optional
Alias string `json:"alias,omitempty"`
Expand Down

0 comments on commit b68e50a

Please sign in to comment.