Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Comment on lines +82 to 87

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, the intention is that aws-eusc is only allowed behind gate. Thus, the partition regex is defined based on whether AWSEuropeanSovereignCloudInstall feature gate is enabled 👇

api/config/v1/types_dns.go

Lines 143 to 146 in 5346161

// +openshift:validation:FeatureGateAwareXValidation:featureGate="",rule=`matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')`,message=`privateZoneIAMRole must be a valid AWS IAM role ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>`
// +openshift:validation:FeatureGateAwareXValidation:featureGate=AWSEuropeanSovereignCloudInstall,rule=`matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')`,message=`privateZoneIAMRole must be a valid AWS IAM role ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>`
// +optional
PrivateZoneIAMRole string `json:"privateZoneIAMRole"`

That is the 2 validation entries should be mutually exclusive (same KMS key ARN). I remember we discussed it in #2708 (comment) and #2770.

Any ideas how to achieve the same thing with the new tooling change here 🤔?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,9 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once set
rule: 'size(self) != size(oldSelf) ? size(oldSelf) == 0
&& size(self) < 2 : true'
- message: Cannot add and remove vCenters at the same time
rule: 'size(self) >= size(oldSelf) ? oldSelf.all(x, self.exists(y,
y.server == x.server)) : true'
Expand All @@ -1100,6 +1103,9 @@ spec:
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
type: object
x-kubernetes-validations:
- message: vcenters can have at most 1 item when configured post-install
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
&& size(self.vsphere.vcenters) < 2) : true'
- message: vcenters is required once set and cannot be removed
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
: true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,9 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once set
rule: 'size(self) != size(oldSelf) ? size(oldSelf) == 0
&& size(self) < 2 : true'
- message: vcenters must have unique server values
rule: self.all(x, self.exists_one(y, y.server == x.server))
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,9 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once set
rule: 'size(self) != size(oldSelf) ? size(oldSelf) == 0
&& size(self) < 2 : true'
- message: Cannot add and remove vCenters at the same time
rule: 'size(self) >= size(oldSelf) ? oldSelf.all(x, self.exists(y,
y.server == x.server)) : true'
Expand All @@ -1100,6 +1103,9 @@ spec:
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
type: object
x-kubernetes-validations:
- message: vcenters can have at most 1 item when configured post-install
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
&& size(self.vsphere.vcenters) < 2) : true'
- message: vcenters is required once set and cannot be removed
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
: true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,9 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once set
rule: 'size(self) != size(oldSelf) ? size(oldSelf) == 0
&& size(self) < 2 : true'
- message: vcenters must have unique server values
rule: self.all(x, self.exists_one(y, y.server == x.server))
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,9 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once set
rule: 'size(self) != size(oldSelf) ? size(oldSelf) == 0
&& size(self) < 2 : true'
- message: Cannot add and remove vCenters at the same time
rule: 'size(self) >= size(oldSelf) ? oldSelf.all(x, self.exists(y,
y.server == x.server)) : true'
Expand All @@ -1100,6 +1103,9 @@ spec:
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
type: object
x-kubernetes-validations:
- message: vcenters can have at most 1 item when configured post-install
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
&& size(self.vsphere.vcenters) < 2) : true'
- message: vcenters is required once set and cannot be removed
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
: true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS
IAM role ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS
IAM role ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Expand Down Expand Up @@ -1373,6 +1376,10 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once
set
rule: 'size(self) != size(oldSelf) ? size(oldSelf)
== 0 && size(self) < 2 : true'
- message: Cannot add and remove vCenters at the same
time
rule: 'size(self) >= size(oldSelf) ? oldSelf.all(x,
Expand All @@ -1393,6 +1400,10 @@ spec:
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
type: object
x-kubernetes-validations:
- message: vcenters can have at most 1 item when configured
post-install
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
&& size(self.vsphere.vcenters) < 2) : true'
- message: vcenters is required once set and cannot be removed
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
: true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,10 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once
set
rule: 'size(self) != size(oldSelf) ? size(oldSelf)
== 0 && size(self) < 2 : true'
- message: vcenters must have unique server values
rule: self.all(x, self.exists_one(y, y.server ==
x.server))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS
IAM role ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS
IAM role ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Expand Down Expand Up @@ -1373,6 +1376,10 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once
set
rule: 'size(self) != size(oldSelf) ? size(oldSelf)
== 0 && size(self) < 2 : true'
- message: Cannot add and remove vCenters at the same
time
rule: 'size(self) >= size(oldSelf) ? oldSelf.all(x,
Expand All @@ -1393,6 +1400,10 @@ spec:
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
type: object
x-kubernetes-validations:
- message: vcenters can have at most 1 item when configured
post-install
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
&& size(self.vsphere.vcenters) < 2) : true'
- message: vcenters is required once set and cannot be removed
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
: true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,10 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once
set
rule: 'size(self) != size(oldSelf) ? size(oldSelf)
== 0 && size(self) < 2 : true'
- message: vcenters must have unique server values
rule: self.all(x, self.exists_one(y, y.server ==
x.server))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS
IAM role ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS
IAM role ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Expand Down Expand Up @@ -1373,6 +1376,10 @@ spec:
type: array
x-kubernetes-list-type: atomic
x-kubernetes-validations:
- message: vcenters cannot be added or removed once
set
rule: 'size(self) != size(oldSelf) ? size(oldSelf)
== 0 && size(self) < 2 : true'
- message: Cannot add and remove vCenters at the same
time
rule: 'size(self) >= size(oldSelf) ? oldSelf.all(x,
Expand All @@ -1393,6 +1400,10 @@ spec:
rule: '!has(oldSelf.ingressIPs) || has(self.ingressIPs)'
type: object
x-kubernetes-validations:
- message: vcenters can have at most 1 item when configured
post-install
rule: '!has(oldSelf.vsphere) && has(self.vsphere) ? (has(self.vsphere.vcenters)
&& size(self.vsphere.vcenters) < 2) : true'
- message: vcenters is required once set and cannot be removed
rule: 'oldSelf.?vsphere.vcenters.hasValue() ? self.?vsphere.vcenters.hasValue()
: true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ spec:
<key-id-or-alias> is the KMS key ID or alias name.
type: string
x-kubernetes-validations:
- message: 'kmsKeyARN must be a valid AWS KMS key ARN in the
format: arn:<partition>:kms:<region>:<account-id>:(key|alias)/<key-id-or-alias>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b|aws-iso-e|aws-iso-f):kms:[a-z0-9-]+:[0-9]{12}:(key|alias)/.*$')
- message: 'kmsKeyARN must be a valid AWS KMS key ARN in the
format: arn:<partition>:kms:<region>:<account-id>:(key|alias)/<key-id-or-alias>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b|aws-iso-e|aws-iso-f|aws-eusc):kms:[a-z0-9-]+:[0-9]{12}:(key|alias)/.*$')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ spec:
<key-id-or-alias> is the KMS key ID or alias name.
type: string
x-kubernetes-validations:
- message: 'kmsKeyARN must be a valid AWS KMS key ARN in the
format: arn:<partition>:kms:<region>:<account-id>:(key|alias)/<key-id-or-alias>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b|aws-iso-e|aws-iso-f):kms:[a-z0-9-]+:[0-9]{12}:(key|alias)/.*$')
- message: 'kmsKeyARN must be a valid AWS KMS key ARN in the
format: arn:<partition>:kms:<region>:<account-id>:(key|alias)/<key-id-or-alias>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b|aws-iso-e|aws-iso-f|aws-eusc):kms:[a-z0-9-]+:[0-9]{12}:(key|alias)/.*$')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ spec:
<key-id-or-alias> is the KMS key ID or alias name.
type: string
x-kubernetes-validations:
- message: 'kmsKeyARN must be a valid AWS KMS key ARN in the
format: arn:<partition>:kms:<region>:<account-id>:(key|alias)/<key-id-or-alias>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b|aws-iso-e|aws-iso-f):kms:[a-z0-9-]+:[0-9]{12}:(key|alias)/.*$')
- message: 'kmsKeyARN must be a valid AWS KMS key ARN in the
format: arn:<partition>:kms:<region>:<account-id>:(key|alias)/<key-id-or-alias>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b|aws-iso-e|aws-iso-f|aws-eusc):kms:[a-z0-9-]+:[0-9]{12}:(key|alias)/.*$')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ spec:
<role-name> is the IAM role name.
type: string
x-kubernetes-validations:
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov):iam::[0-9]{12}:role/.*$')
- message: 'privateZoneIAMRole must be a valid AWS IAM role
ARN in the format: arn:<partition>:iam::<account-id>:role/<role-name>'
rule: matches(self, '^arn:(aws|aws-cn|aws-us-gov|aws-eusc):iam::[0-9]{12}:role/.*$')
Expand Down
Loading