Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az aks create|nodepool add --labels - labels ignored if prefix contains '.' #1689

Closed
mathieu-benoit opened this issue Apr 30, 2020 · 15 comments

Comments

@mathieu-benoit
Copy link

Describe the bug
az aks create|nodepool add --labels, labels are ignored if their prefix contains '.'.

To Reproduce

  • az aks create --labels test.test/test=test
  • or az aks nodepool add --labels test.test/test=test

Expected behavior
As described here https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set, prefix in labels could contain '.'. And I don't think this associated regex takes this into account: https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/acs/_validators.py#L291

Environment summary
Azure CLI 2.5.0 (aks-preview extension not installed)

Additional context
FYI, in my case, I would like to set this label to my User nodepool: kubernetes.azure.com/mode=user since it's not added for me.

@mathieu-benoit
Copy link
Author

JFYI @jluk and @xizhamsft

@ghost
Copy link

ghost commented Apr 30, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm.

@yonzhan
Copy link

yonzhan commented Apr 30, 2020

aks

@djsly
Copy link

djsly commented May 30, 2020

it seems that the logic for the node labels follows the more strict DNS-1123 standard.

While this is a valid standard for some names of resources in Kubernetes, the labels doesn't follow this standard

https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set

Labels are key/value pairs. 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: a series of DNS labels separated by dots (.), not longer than 253 characters in total, followed by a slash (/).

@djsly
Copy link

djsly commented May 30, 2020

https://github.com/kubernetes/kubernetes/blob/fdb2cb4c8832da1499069bda918c014762d8ac05/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L201-L212

is what Kubernetes uses to validate the DNS Prefixes

definition of a subdomain in DNS (RFC 1123)

@lilyjma
Copy link

lilyjma commented Jun 3, 2020

@Azure/aks-pm please take a look!

@palma21
Copy link
Member

palma21 commented Jun 5, 2020

Thanks folks anyone adventures a PR to fix it?

Otherwise adding @wenwu449 to add to the backlog

@seanmck seanmck transferred this issue from Azure/azure-cli Jun 20, 2020
@seanmck
Copy link
Collaborator

seanmck commented Jun 20, 2020

Looks like an RP issue as problem repros in direct REST API calls as well. Also, it seems like it's the 2nd dot which is problematic.

@mathieu-benoit
Copy link
Author

FYI @seanmck: I'm not able to reproduce the issue with Terraform: https://github.com/mathieu-benoit/myakscluster/blob/master/tf/aks.tf#L121

@github-actions
Copy link

Action required from @Azure/aks-pm

@ghost
Copy link

ghost commented Jul 26, 2020

Action required from @Azure/aks-pm

@ghost ghost added the Needs Attention 👋 Issues needs attention/assignee/owner label Jul 26, 2020
@palma21 palma21 removed the Needs Attention 👋 Issues needs attention/assignee/owner label Jul 27, 2020
@ghost
Copy link

ghost commented Aug 1, 2020

Action required from @Azure/aks-pm

@ghost ghost added the Needs Attention 👋 Issues needs attention/assignee/owner label Aug 1, 2020
@gtxistxgao
Copy link

gtxistxgao commented Aug 5, 2020

@mathieu-benoit

Tried to reproduce in az cli version 2.10. aks-preview extension not installed. Both az aks nodepool add --labels and az aks create --node-labels work well.

~$ az aks nodepool add --resource-group xxx --cluster-name xxxdemo --name nodepool3 --labels a.b/c=d -c 1
~$ k get node --show-labels | grep a.b/c=d
aks-nodepool3-xxx-vmss000000 Ready agent 6m25s v1.16.10 a.b/c=d,agentpool=nodepool3,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/instance-type=Standard_DS2_v2,beta.kubernetes.io/os=linux,failure-domain.beta.kubernetes.io/region=westus2,failure-domain.beta.kubernetes.io/zone=0,kubernetes.azure.com/cluster=MC_xxx_xxxdemo_westus2,kubernetes.azure.com/node-image-version=AKSUbuntu-1604-2020.06.30,kubernetes.azure.com/role=agent,kubernetes.io/arch=amd64,kubernetes.io/hostname=aks-nodepool3-xxx-vmss000000,kubernetes.io/os=linux,kubernetes.io/role=agent,node-role.kubernetes.io/agent=,storageprofile=managed,storagetier=Premium_LRS

~$ az aks create --resource-group xxx --name xxxdemo2 --nodepool-labels a.b/c=d -c 1
~$ k get node --show-labels
NAME STATUS ROLES AGE VERSION LABELS
aks-nodepool1-xxx-vmss000000 Ready 3s v1.16.10 a.b/c=d,agentpool=nodepool1,beta.kubernetes.io/arch=amd64,beta.kubernetes.io/instance-type=Standard_DS2_v2,beta.kubernetes.io/os=linux,failure-domain.beta.kubernetes.io/region=westus2,failure-domain.beta.kubernetes.io/zone=0,kubernetes.azure.com/cluster=MC_xxx_xxxdemo2_westus2,kubernetes.azure.com/mode=system,kubernetes.azure.com/node-image-version=AKSUbuntu-1604-2020.06.30,kubernetes.azure.com/role=agent,kubernetes.io/arch=amd64,kubernetes.io/hostname=aks-nodepool1-xxx-vmss000000,kubernetes.io/os=linux,storageprofile=managed,storagetier=Premium_LRS

@gtxistxgao gtxistxgao added Needs Author Feedback and removed Needs Attention 👋 Issues needs attention/assignee/owner labels Aug 6, 2020
@ghost ghost added the action-required label Sep 2, 2020
@ghost ghost added the stale Stale issue label Nov 1, 2020
@ghost
Copy link

ghost commented Nov 1, 2020

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

@ghost
Copy link

ghost commented Nov 16, 2020

This issue will now be closed because it hasn't had any activity for 15 days after stale. mathieu-benoit feel free to comment again on the next 7 days to reopen or open a new issue after that time if you still have a question/issue or suggestion.

@ghost ghost closed this as completed Nov 16, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 16, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants