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: Mismatch between HelmReleaseName and AzureName prevents secret creation #4515

Closed
frantisektripsky opened this issue Jan 6, 2025 · 2 comments · Fixed by #4516
Closed
Assignees
Labels
bug 🪲 Something isn't working
Milestone

Comments

@frantisektripsky
Copy link

Describe the bug

When creating a NamespacesEventhubsAuthorizationRule resource with a specified Secrets section, and the Helm release name is not equal to the azureName, the following error occurs:
“extension failed to produce resources for export: failed to retreive response: POST https://management.azure.com/subscriptions/my-azure-subscription/resourceGroups/my-azure-resource-group/providers/Microsoft.EventHub/namespaces/my-azure-event-hubs-namespace/eventhubs/my-azure-event-hub/authorizationRules/event-hub-kubernetes-auth-rule/listKeys
The issue lies in the generated POST URL:
The authorizationRules name in the request (event-hub-kubernetes-auth-rule) incorrectly reflects the Helm release name. It should use the value from azureName instead (event-hub-azure-auth-rule).

The version of the operator pod: v2.10.0

Expected behavior

When creating a NamespacesEventhubsAuthorizationRule resource with a specified Secrets section, if the Helm release name is not equal to the azureName, the following behavior occurs:

a/ The event-hub-azure-auth-rule is created in Azure.
b/ A secret is created in the Kubernetes cluster with an entry named primaryConnectionString.

To Reproduce

Helm release example:
apiVersion: eventhub.azure.com/v1api20211101
kind: NamespacesEventhubsAuthorizationRule
metadata:
name: event-hub-kubernetes-auth-rule
spec:
azureName: event-hub-azure-auth-rule
operatorSpec:
secrets:
primaryConnectionString:
key: primaryConnectionString
name: event-hub- Kubernetes

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

@matthchr
Copy link
Member

matthchr commented Jan 7, 2025

You're right, this is a bug. The issue is

response, err := client.ListKeys(ctx, id.ResourceGroupName, namespaceID.Name, rule.Name, &options)

We should be using rule.AzureName() there, or id.Name (which is the AzureName), but we aren't.

I suspect we have a similar but for the other Authorization rules, and we didn't notice because our tests for those have AzureName == rule.Name so it works fine.

I'll send a PR.

@matthchr matthchr self-assigned this Jan 7, 2025
matthchr added a commit to matthchr/azure-service-operator that referenced this issue Jan 7, 2025
obj.Name was mistakenly used when it should have been obj.AzureName (or
id.Name, which is derived from the ARM ID which comes from
obj.AzureName).

Fixes Azure#4515.
github-merge-queue bot pushed a commit that referenced this issue Jan 7, 2025
obj.Name was mistakenly used when it should have been obj.AzureName (or
id.Name, which is derived from the ARM ID which comes from
obj.AzureName).

Fixes #4515.
@github-project-automation github-project-automation bot moved this from Backlog to Recently Completed in Azure Service Operator Roadmap Jan 7, 2025
@matthchr matthchr added this to the v2.12.0 milestone Jan 7, 2025
@matthchr
Copy link
Member

matthchr commented Jan 7, 2025

A fix for this is now merged. It will be included in the v2.12 release, but you can test it out now by updating to run the experimental release of ASO, which contains the fix.

@matthchr matthchr moved this from Recently Completed to Ready for Release in Azure Service Operator Roadmap Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
Status: Ready for Release
Development

Successfully merging a pull request may close this issue.

2 participants