Valid label keys have two segments: an optional prefix and name, separated by a slash (/). The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. The prefix is optional. If specified, the prefix must be a DNS subdomain (...)
Valid label values must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
Some CF names might exceed K8s' name length limit, and contain upper case letters, and some K8s names/labels might contain invalid characters for CF ('-', '_', '.', '_')
Removing Node.of(this).uniqueId from constructs and letting cdk and cdk8s to implement their own uniqueId would prevent confusions and unnecessary limits on each frameworks.
I understand that
constructs
were supposed to supportcdk
, so It was also understandable thatNode.of(this).uniqueId
is bound to CloudFormation's logical ID rules: ([A-Za-z0-9]{255}
) https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html#resources-section-structure-resource-fields https://docs.amazonaws.cn/en_us/AWSCloudFormation/latest/UserGuide/cloudformation-limits.htmlHowever,
constructs
is now also used as a foundation ofcdk8s
, and Kubernetes imposes different rules to resource names and labels:https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-subdomain-names
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
Some CF names might exceed K8s' name length limit, and contain upper case letters, and some K8s names/labels might contain invalid characters for CF (
'-'
,'_'
,'.'
,'_'
)Removing
Node.of(this).uniqueId
fromconstructs
and lettingcdk
andcdk8s
to implement their ownuniqueId
would prevent confusions and unnecessary limits on each frameworks.Maybe this is related to this: https://github.com/aws/constructs/issues/120