Skip to content

Commit

Permalink
Add AWS tags to Infrastructure.Spec CRD
Browse files Browse the repository at this point in the history
This API change makes the existing `resourceTags` option mutable.

See openshift/enhancements#1051 for more
info
  • Loading branch information
josefkarasek committed Apr 6, 2022
1 parent 9c4998a commit b388fc9
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 3 deletions.
25 changes: 24 additions & 1 deletion config/v1/0000_10_config-operator_01_infrastructure.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,29 @@ spec:
description: AWS contains settings specific to the Amazon Web Services infrastructure provider.
type: object
properties:
resourceTags:
description: resourceTags is a list of additional tags to apply to AWS resources created for the cluster. See https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html for information on tagging AWS resources. AWS supports a minimum of 10 tags per resource. OpenShift reserves 5 tags for its use, leaving 5 tags available for the user. ResourceTags field is mutable and items can be removed. When a tag is removed from this list, management of the tag is stopped. The tag will remain in an unmanaged state on any existing resource.
type: array
maxItems: 5
items:
description: AWSResourceTagSpec is a tag to apply to AWS resources created for the cluster.
type: object
required:
- key
- value
properties:
key:
description: key is the key of the AWS tag. The value must consist only of alphanumeric and certain special characters ( _.:/=+-@). key should not start with "openshift.io" or "kubernetes.io". Both of these prefixes are reserved for use by the platform. key must be no more than 128 characters in length.
type: string
maxLength: 128
minLength: 1
pattern: ^[0-9A-Za-z_ .:/=+-@]+$
value:
description: value is the value of the AWS tag. The value must consist only of alphanumeric and certain special characters ( _.:/=+-@). value must be no more than 256 characters in length. Some AWS services do not support empty values. Since tags are added to resources in many services, the length of the tag value must meet the requirements of all services.
type: string
maxLength: 256
minLength: 1
pattern: ^[0-9A-Za-z_ .:/=+-@]+$
serviceEndpoints:
description: serviceEndpoints list contains custom endpoints which will override default service endpoint of AWS Services. There must be only one ServiceEndpoint for a service.
type: array
Expand Down Expand Up @@ -303,7 +326,7 @@ spec:
description: region holds the default AWS region for new AWS resources created by the cluster.
type: string
resourceTags:
description: resourceTags is a list of additional tags to apply to AWS resources created for the cluster. See https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html for information on tagging AWS resources. AWS supports a maximum of 50 tags per resource. OpenShift reserves 25 tags for its use, leaving 25 tags available for the user.
description: resourceTags is a list of additional tags to apply to AWS resources created for the cluster. See https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html for information on tagging AWS resources. In previous versions, OpenShift reserved 25 tags for its use, leaving 25 tags available for the user. ResourceTags field is immutable. To update the list of tags, contact support.
type: array
maxItems: 25
items:
Expand Down
39 changes: 38 additions & 1 deletion config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,40 @@ type AWSPlatformSpec struct {
// There must be only one ServiceEndpoint for a service.
// +optional
ServiceEndpoints []AWSServiceEndpoint `json:"serviceEndpoints,omitempty"`

// resourceTags is a list of additional tags to apply to AWS resources created for the cluster.
// See https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html for information on tagging AWS resources.
// AWS supports a minimum of 10 tags per resource. OpenShift reserves 5 tags for its use, leaving 5 tags
// available for the user.
// ResourceTags field is mutable and items can be removed.
// When a tag is removed from this list, management of the tag is stopped.
// The tag will remain in an unmanaged state on any existing resource.
// +kubebuilder:validation:MaxItems=5
// +optional
ResourceTags []AWSResourceTagSpec `json:"resourceTags,omitempty"`
}

// AWSResourceTagSpec is a tag to apply to AWS resources created for the cluster.
type AWSResourceTagSpec struct {
// key is the key of the AWS tag. The value must consist only of alphanumeric and certain special characters ( _.:/=+-@).
// key should not start with "openshift.io" or "kubernetes.io". Both of these prefixes are reserved for use by the platform.
// key must be no more than 128 characters in length.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=128
// +kubebuilder:validation:Pattern=`^[0-9A-Za-z_ .:/=+-@]+$`
// +required
Key string `json:"key"`
// value is the value of the AWS tag. The value must consist only of alphanumeric and certain special characters ( _.:/=+-@).
// value must be no more than 256 characters in length.
// Some AWS services do not support empty values. Since tags are added to resources in many services, the
// length of the tag value must meet the requirements of all services.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
// +kubebuilder:validation:Pattern=`^[0-9A-Za-z_ .:/=+-@]+$`
// +required
Value string `json:"value"`
}

// AWSPlatformStatus holds the current status of the Amazon Web Services infrastructure provider.
Expand All @@ -369,9 +403,12 @@ type AWSPlatformStatus struct {

// resourceTags is a list of additional tags to apply to AWS resources created for the cluster.
// See https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html for information on tagging AWS resources.
// AWS supports a maximum of 50 tags per resource. OpenShift reserves 25 tags for its use, leaving 25 tags
// In previous versions, OpenShift reserved 25 tags for its use, leaving 25 tags
// available for the user.
// ResourceTags field is immutable.
// To update the list of tags, contact support.
// +kubebuilder:validation:MaxItems=25
// +kubebuilder:deprecatedversion:warning="ResourceTags in .Status is deprecated, use .Spec.PlatformSpec.AWS.ResourceTags"
// +optional
ResourceTags []AWSResourceTag `json:"resourceTags,omitempty"`
}
Expand Down
21 changes: 21 additions & 0 deletions config/v1/zz_generated.deepcopy.go

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

13 changes: 12 additions & 1 deletion 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.

0 comments on commit b388fc9

Please sign in to comment.