Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

[RHIDP-2246] Fix reconciliation issue when referenced ConfigMap/Secret has a dot (.) in its name #363

Conversation

rm3l
Copy link
Member

@rm3l rm3l commented May 21, 2024

Description

This PR fixes an issue when a ConfigMap or Secret is referenced in the CR and contains a dot (.) in its name. The operator would use the ConfigMap/Secret name as is as the volume name in the Deployment Spec, which could be reported as invalid by Kubernetes.
This PR makes sure to sanitize volume names, such that they are RFC 1123-compliant, as depicted in https://kubernetes.io/docs/concepts/overview/working-with-objects/names/.

Which issue(s) does this PR fix or relate to

PR acceptance criteria

  • Tests
  • Documentation
  • If the bundle manifests have been updated, make sure to review the rhdh-operator.csv.yaml file accordingly

How to test changes / Special notes to the reviewer

See the updated example in examples/rhdh-cr-with-app-configs.yaml.
Prior to the changes here, this example would not be reconciled properly. Now it works as expected.

@rm3l rm3l changed the title fix: Fix reconciliation issue when referenced ConfigMap/Secret has a dot (.) in its name [RHIDP-2246] [RHIDP-2246] Fix reconciliation issue when referenced ConfigMap/Secret has a dot (.) in its name May 21, 2024
pkg/utils/utils.go Outdated Show resolved Hide resolved
pkg/utils/utils_test.go Outdated Show resolved Hide resolved
examples/rhdh-cr-with-app-configs.yaml Outdated Show resolved Hide resolved
Co-authored-by: Gennady Azarenkov <gazarenkov@gmail.com>
Copy link

sonarcloud bot commented May 27, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@rm3l rm3l requested a review from gazarenkov May 27, 2024 15:02
@openshift-ci openshift-ci bot added the lgtm PR is ready to be merged. Required by Prow. label May 28, 2024
Copy link

openshift-ci bot commented May 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gazarenkov

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

The pull request process is described 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 approved PR has been approved by an approver from all required OWNERS files. Required by Prow. label May 28, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit adc11eb into janus-idp:main May 28, 2024
8 checks passed
@rm3l rm3l deleted the RHIDP-2246--cannot-mount-a-secret-configmap-with-a-.-in-its-name branch May 28, 2024 08:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved PR has been approved by an approver from all required OWNERS files. Required by Prow. lgtm PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants