Skip to content

Commit 77880e5

Browse files
committed
config: add aws usertags to infrastructure
Add a new field userTags to `.status.aws` of the infrastructure.config.openshift.io type. Tags included in the userTags field will be applied to new resources created for the cluster. Note that even though AWS generally allows the tag value to be empty, some AWS services do not support this. Therefore, we require that a tag value have a minimum length of 1. https://issues.redhat.com/browse/CORS-1657
1 parent 8c78458 commit 77880e5

File tree

4 files changed

+92
-0
lines changed

4 files changed

+92
-0
lines changed

config/v1/0000_10_config-operator_01_infrastructure.crd.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,38 @@ spec:
271271
empty.
272272
type: string
273273
pattern: ^https://
274+
userTags:
275+
description: userTags is a list of additional tags to apply
276+
to AWS resources created for the cluster. See https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html
277+
for information on tagging AWS resources. AWS supports a
278+
maximum of 50 tags per resource. OpenShift reserves 25 tags
279+
for its use, leaving 25 tags available for the user.
280+
type: array
281+
maxItems: 25
282+
items:
283+
description: AWSUserTag is a tag to apply to AWS resources
284+
created for the cluster.
285+
type: object
286+
required:
287+
- key
288+
- value
289+
properties:
290+
key:
291+
description: key is the key of the tag
292+
type: string
293+
maxLength: 128
294+
minLength: 1
295+
pattern: ^[0-9A-Za-z_.:/=+-@]+$
296+
value:
297+
description: value is the value of the tag. Some AWS
298+
service do not support empty values. Since user tags
299+
are added to resources in many services, the length
300+
of the tag value must meet the requirements of all
301+
services.
302+
type: string
303+
maxLength: 256
304+
minLength: 1
305+
pattern: ^[0-9A-Za-z_.:/=+-@]+$
274306
azure:
275307
description: Azure contains settings specific to the Azure infrastructure
276308
provider.

config/v1/types_infrastructure.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,34 @@ type AWSPlatformStatus struct {
313313
// There must be only one ServiceEndpoint for a service.
314314
// +optional
315315
ServiceEndpoints []AWSServiceEndpoint `json:"serviceEndpoints,omitempty"`
316+
317+
// userTags is a list of additional tags to apply to AWS resources created for the cluster.
318+
// See https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html for information on tagging AWS resources.
319+
// AWS supports a maximum of 50 tags per resource. OpenShift reserves 25 tags for its use, leaving 25 tags
320+
// available for the user.
321+
// +kubebuilder:validation:MaxItems=25
322+
// +optional
323+
UserTags []AWSUserTag `json:"userTags,omitempty"`
324+
}
325+
326+
// AWSUserTag is a tag to apply to AWS resources created for the cluster.
327+
type AWSUserTag struct {
328+
// key is the key of the tag
329+
// +kubebuilder:validation:Required
330+
// +kubebuilder:validation:MinLength=1
331+
// +kubebuilder:validation:MaxLength=128
332+
// +kubebuilder:validation:Pattern=`^[0-9A-Za-z_.:/=+-@]+$`
333+
// +required
334+
Key string `json:"key"`
335+
// value is the value of the tag.
336+
// Some AWS service do not support empty values. Since user tags are added to resources in many services, the
337+
// length of the tag value must meet the requirements of all services.
338+
// +kubebuilder:validation:Required
339+
// +kubebuilder:validation:MinLength=1
340+
// +kubebuilder:validation:MaxLength=256
341+
// +kubebuilder:validation:Pattern=`^[0-9A-Za-z_.:/=+-@]+$`
342+
// +required
343+
Value string `json:"value"`
316344
}
317345

318346
// AzurePlatformSpec holds the desired state of the Azure infrastructure provider.

config/v1/zz_generated.deepcopy.go

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/v1/zz_generated.swagger_doc_generated.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)