Skip to content
Merged
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 @@ -534,7 +534,36 @@ spec:
resourceGroupName:
description: resourceGroupName is the Resource Group for new Azure resources created for the cluster.
type: string
resourceTags:
description: resourceTags is a list of additional tags to apply to Azure resources created for the cluster. See https://docs.microsoft.com/en-us/rest/api/resources/tags for information on tagging Azure resources. Due to limitations on Automation, Content Delivery Network, DNS Azure resources, a maximum of 15 tags may be applied. OpenShift reserves 5 tags for internal use, allowing 10 tags for user configuration.
items:
description: AzureResourceTag is a tag to apply to Azure resources created for the cluster.
properties:
key:
description: key is the key part of the tag. A tag key can have a maximum of 128 characters and cannot be empty. Key must begin with a letter, end with a letter, number or underscore, and must contain only alphanumeric characters and the following special characters `_ . -`.
maxLength: 128
minLength: 1
pattern: ^[a-zA-Z]([0-9A-Za-z_.-]*[0-9A-Za-z_])?$
type: string
value:
description: 'value is the value part of the tag. A tag value can have a maximum of 256 characters and cannot be empty. Value must contain only alphanumeric characters and the following special characters `_ + , - . / : ; < = > ? @`.'
maxLength: 256
minLength: 1
pattern: ^[0-9A-Za-z_.=+-@]+$
type: string
required:
- key
- value
type: object
maxItems: 10
type: array
x-kubernetes-validations:
- message: resourceTags are immutable and may only be configured during installation
rule: self.all(x, x in oldSelf) && oldSelf.all(x, x in self)
type: object
x-kubernetes-validations:
- message: resourceTags may only be configured during installation
rule: '!has(oldSelf.resourceTags) && !has(self.resourceTags) || has(oldSelf.resourceTags) && has(self.resourceTags)'
baremetal:
description: BareMetal contains settings specific to the BareMetal platform.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,36 @@ spec:
resourceGroupName:
description: resourceGroupName is the Resource Group for new Azure resources created for the cluster.
type: string
resourceTags:
description: resourceTags is a list of additional tags to apply to Azure resources created for the cluster. See https://docs.microsoft.com/en-us/rest/api/resources/tags for information on tagging Azure resources. Due to limitations on Automation, Content Delivery Network, DNS Azure resources, a maximum of 15 tags may be applied. OpenShift reserves 5 tags for internal use, allowing 10 tags for user configuration.
items:
description: AzureResourceTag is a tag to apply to Azure resources created for the cluster.
properties:
key:
description: key is the key part of the tag. A tag key can have a maximum of 128 characters and cannot be empty. Key must begin with a letter, end with a letter, number or underscore, and must contain only alphanumeric characters and the following special characters `_ . -`.
maxLength: 128
minLength: 1
pattern: ^[a-zA-Z]([0-9A-Za-z_.-]*[0-9A-Za-z_])?$
type: string
value:
description: 'value is the value part of the tag. A tag value can have a maximum of 256 characters and cannot be empty. Value must contain only alphanumeric characters and the following special characters `_ + , - . / : ; < = > ? @`.'
maxLength: 256
minLength: 1
pattern: ^[0-9A-Za-z_.=+-@]+$
type: string
required:
- key
- value
type: object
maxItems: 10
type: array
x-kubernetes-validations:
- message: resourceTags are immutable and may only be configured during installation
rule: self.all(x, x in oldSelf) && oldSelf.all(x, x in self)
type: object
x-kubernetes-validations:
- message: resourceTags may only be configured during installation
rule: '!has(oldSelf.resourceTags) && !has(self.resourceTags) || has(oldSelf.resourceTags) && has(self.resourceTags)'
baremetal:
description: BareMetal contains settings specific to the BareMetal platform.
properties:
Expand Down
158 changes: 158 additions & 0 deletions config/v1/stable.infrastructure.testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,161 @@ tests:
external:
platformName: SomeOtherCoolplatformName
expectedError: " spec.platformSpec.external.platformName: Invalid value: \"string\": platform name cannot be changed once set"
- name: Should not be able to modify an existing Azure ResourceTags Tag
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
controlPlaneTopology: "HighlyAvailable"
infrastructureTopology: "HighlyAvailable"
platform: Azure
platformStatus:
type: Azure
azure:
resourceTags:
- {key: "key", value: "value"}
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
type: Azure
azure:
resourceTags:
- {key: "key", value: "changed"}
expectedStatusError: "status.platformStatus.azure.resourceTags: Invalid value: \"array\": resourceTags are immutable and may only be configured during installation"
- name: Should not be able to add a Tag to an existing Azure ResourceTags
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
controlPlaneTopology: "HighlyAvailable"
infrastructureTopology: "HighlyAvailable"
platform: Azure
platformStatus:
type: Azure
azure:
resourceTags:
- {key: "key", value: "value"}
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
type: Azure
azure:
resourceTags:
- {key: "key", value: "value"}
- {key: "new", value: "entry"}
expectedStatusError: "status.platformStatus.azure.resourceTags: Invalid value: \"array\": resourceTags are immutable and may only be configured during installation"
- name: Should not be able to remove a Tag from an existing Azure ResourceTags
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
type: Azure
azure:
resourceTags:
- {key: "key", value: "value"}
- {key: "new", value: "entry"}
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
type: Azure
azure:
resourceTags:
- {key: "key", value: "value"}
expectedStatusError: "status.platformStatus.azure.resourceTags: Invalid value: \"array\": resourceTags are immutable and may only be configured during installation"
- name: Should not be able to add Azure ResourceTags to an empty platformStatus.azure
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
type: Azure
azure: {}
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
azure:
resourceTags:
- {key: "key", value: "value"}
expectedStatusError: "status.platformStatus.azure: Invalid value: \"object\": resourceTags may only be configured during installation"
- name: Should not be able to remove Azure ResourceTags from platformStatus.azure
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
type: Azure
azure:
resourceTags:
- {key: "key", value: "value"}
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
type: Azure
azure: {}
expectedStatusError: "status.platformStatus.azure: Invalid value: \"object\": resourceTags may only be configured during installation"
- name: Should be able to modify the ResourceGroupName while Azure ResourceTags are present
initial: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
type: Azure
azure:
resourceGroupName: foo
resourceTags:
- {key: "key", value: "value"}
updated: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
platform: Azure
platformStatus:
azure:
resourceGroupName: bar
resourceTags:
- {key: "key", value: "value"}
expected: |
apiVersion: config.openshift.io/v1
kind: Infrastructure
spec: {}
status:
controlPlaneTopology: "HighlyAvailable"
infrastructureTopology: "HighlyAvailable"
platform: Azure
platformStatus:
azure:
resourceGroupName: bar
resourceTags:
- {key: "key", value: "value"}
29 changes: 29 additions & 0 deletions config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ type AWSResourceTag struct {
type AzurePlatformSpec struct{}

// AzurePlatformStatus holds the current status of the Azure infrastructure provider.
// +kubebuilder:validation:XValidation:rule="!has(oldSelf.resourceTags) && !has(self.resourceTags) || has(oldSelf.resourceTags) && has(self.resourceTags)",message="resourceTags may only be configured during installation"
type AzurePlatformStatus struct {
// resourceGroupName is the Resource Group for new Azure resources created for the cluster.
ResourceGroupName string `json:"resourceGroupName"`
Expand All @@ -478,6 +479,34 @@ type AzurePlatformStatus struct {
// armEndpoint specifies a URL to use for resource management in non-soverign clouds such as Azure Stack.
// +optional
ARMEndpoint string `json:"armEndpoint,omitempty"`

// resourceTags is a list of additional tags to apply to Azure resources created for the cluster.
// See https://docs.microsoft.com/en-us/rest/api/resources/tags for information on tagging Azure resources.
// Due to limitations on Automation, Content Delivery Network, DNS Azure resources, a maximum of 15 tags
// may be applied. OpenShift reserves 5 tags for internal use, allowing 10 tags for user configuration.
// +kubebuilder:validation:MaxItems=10
// +kubebuilder:validation:XValidation:rule="self.all(x, x in oldSelf) && oldSelf.all(x, x in self)",message="resourceTags are immutable and may only be configured during installation"
// +optional
ResourceTags []AzureResourceTag `json:"resourceTags,omitempty"`
}

// AzureResourceTag is a tag to apply to Azure resources created for the cluster.
type AzureResourceTag struct {
// key is the key part of the tag. A tag key can have a maximum of 128 characters and cannot be empty. Key
// must begin with a letter, end with a letter, number or underscore, and must contain only alphanumeric
// characters and the following special characters `_ . -`.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=128
// +kubebuilder:validation:Pattern=`^[a-zA-Z]([0-9A-Za-z_.-]*[0-9A-Za-z_])?$`
Key string `json:"key"`
// value is the value part of the tag. A tag value can have a maximum of 256 characters and cannot be empty. Value
// must contain only alphanumeric characters and the following special characters `_ + , - . / : ; < = > ? @`.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
// +kubebuilder:validation:Pattern=`^[0-9A-Za-z_.=+-@]+$`
Value string `json:"value"`
}

// AzureCloudEnvironment is the name of the Azure cloud environment
Expand Down
23 changes: 22 additions & 1 deletion config/v1/zz_generated.deepcopy.go

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

11 changes: 11 additions & 0 deletions config/v1/zz_generated.swagger_doc_generated.go

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

Loading