Skip to content

Fix invalid ConfigMap key translation #1742

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zimnx
Copy link

@zimnx zimnx commented Aug 8, 2025

Description of the change:

When generating ConfigMap keys from OLM bundle filenames, colons (:) were being replaced with tildes (~). However, ~ is not a valid character for ConfigMap keys, leading to errors like:

binaryData[scylladb~controller~aggregate-to-operator_rbac.authorization.k8s.io_v1_clusterrole.yaml]: Invalid value: "...": a valid config key must consist of alphanumeric characters, '-', '_' or '.' (regex: '[-._a-zA-Z0-9]+')

This commit fixes the issue by replacing : with hyphens (-) instead, which are allowed in ConfigMap keys. For example:

  • Before: scylladb:controller:aggregate-to-operator...scylladb~controller~aggregate-to-operator... (invalid)
  • After: scylladb:controller:aggregate-to-operator...scylladb-controller-aggregate-to-operator... (valid)

Motivation for the change:

This ensures all generated ConfigMap keys conform to Kubernetes naming requirements.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

Closes #1741

Copy link
Contributor

openshift-ci bot commented Aug 8, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign oceanc80 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 8, 2025
Copy link
Contributor

openshift-ci bot commented Aug 8, 2025

Hi @zimnx. Thanks for your PR.

I'm waiting for a operator-framework member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@zimnx zimnx changed the title Fix invalid ConfigMap key by replacing Fix invalid ConfigMap key Aug 8, 2025
When generating ConfigMap keys from OLM bundle filenames, colons (`:`) were being replaced with tildes (`~`). However, `~` is not a valid character for ConfigMap keys, leading to errors like:
```
binaryData[scylladb~controller~aggregate-to-operator_rbac.authorization.k8s.io_v1_clusterrole.yaml]: Invalid value: "...": a valid config key must consist of alphanumeric characters, '-', '_' or '.' (regex: '[-._a-zA-Z0-9]+')
```

This commit fixes the issue by replacing `:` with hyphens (`-`) instead, which are allowed in ConfigMap keys. For example:

* Before: `scylladb:controller:aggregate-to-operator...` →  `scylladb~controller~aggregate-to-operator...` (invalid)
* After:  `scylladb:controller:aggregate-to-operator...` →  `scylladb-controller-aggregate-to-operator...` (valid)

This ensures all generated ConfigMap keys conform to Kubernetes naming requirements.
@zimnx zimnx force-pushed the fix-cm-invalid-character branch from 46a74a1 to 5813ca9 Compare August 8, 2025 13:52
@zimnx zimnx changed the title Fix invalid ConfigMap key Fix invalid ConfigMap key translation Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConfigMapWriter use keys having forbidden characters
1 participant