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

Bug: Azure Service Operator Incorrectly Denying '_' Character in Azure Resource Group Names #3932

Closed
eiriksanderfjeld opened this issue Apr 11, 2024 · 2 comments
Labels
question Further information is requested

Comments

@eiriksanderfjeld
Copy link

Version of Azure Service Operator
ASO V2: mcr.microsoft.com/k8s/azureserviceoperator:v2.6.0,gcr.io/kubebuilder/kube-rbac-proxy:v0.13.1

Describe the bug
The Azure Service Operator is incorrectly denying the usage of the "_" (underscore) character in Azure Resource Group names. This restriction is not consistent with Azure's naming conventions and is causing inconvenience to users who wish to include underscores in their resource group names.

To Reproduce

  1. Attempt to create an Azure Resource Group using the Azure Service Operator.
  2. Include the "_" character in the name of the resource group.
  3. Notice that the operation fails with an error indicating that the "_" character is not allowed.

Expected behavior
According to Azure's naming conventions, the _ character is a valid character for resource group names. The Azure Service Operator should allow the usage of "_" in resource group names without any restrictions.

Actual Behavior:
The Azure Service Operator is denying the usage of the "_" character in resource group names, contrary to Azure's naming conventions.

The ResourceGroup "dev_resources" is invalid: metadata.name: Invalid value: "dev_resources": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Additional context
The rg.yaml file used apply the resoure group.

apiVersion: resources.azure.com/v1api20200601
kind: ResourceGroup
metadata:
  name: dev_resources
  namespace: default
spec:
  location: westeurope
@matthchr
Copy link
Member

You're running into a situation where what Kubernetes allows for names differs from what Azure allows for names.

We have the .spec.azureName field for this reason. You can't name the Kubernetes representation of the resource group with an _ in it, so you have two choices:

  1. Pick a different name, if you want the k8s ResourceGroup and the Azure resource group to have the same name.
  2. Pick a different name for the Kubernetes resource and set azureName to dev_resources

@matthchr matthchr assigned matthchr and unassigned matthchr Apr 11, 2024
@matthchr matthchr added question Further information is requested waiting-on-user-response Waiting on more information from the original user before progressing. and removed waiting-on-user-response Waiting on more information from the original user before progressing. labels Apr 11, 2024
@matthchr
Copy link
Member

matthchr commented Apr 15, 2024

Closing this as it's working as designed. Please feel free to reply if you have any additional questions.

@github-project-automation github-project-automation bot moved this from Backlog to Recently Completed in Azure Service Operator Roadmap Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Development

No branches or pull requests

2 participants