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

[bitnami/mongodb] replicaSetConfigurationSettings.sh script always has usernameAndPassword empty because we inject rootPassword from Vault #25885

Closed
soufianebenali opened this issue May 15, 2024 · 1 comment · Fixed by #25944
Assignees
Labels
solved tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@soufianebenali
Copy link
Contributor

soufianebenali commented May 15, 2024

Name and Version

bitnami/mongodb 15.1.7

What architecture are you using?

None

What steps will reproduce the bug?

Description:

We are experiencing an issue with our setup where we use HashiCorp Vault to manage and store our secrets. These secrets are mounted directly onto the pods. As a result, we do not define the .Values.auth.rootPassword in our configuration. This approach is leading to problems with the replicaSetConfigurationSettings.sh script.

https://github.com/bitnami/charts/blob/main/bitnami/mongodb/templates/replicaset/scripts-configmap.yaml#L225

Problem:

Due to the absence of the .Values.auth.rootPassword, the usernameAndPassword variable in the script replicaSetConfigurationSettings.sh is always set to an empty string (usernameAndPassword=""). This is causing the application to encounter the following error:

not yet able to read rs.conf settings from the currently running rs (after 7 attempts) 
MongoServerError: Command replSetGetConfig requires authentication

Are you using any custom parameters or values?

architecture: replicaset
replicaCount: 3
auth:
  enable: true
  existingSecret: "mongodb-vault"
image:
  registry: docker.io
  repository: bitnami/mongodb
  tag: 7.0.9-debian-12-r0
  digest: ""
tls:
  enabled: true
  existingSecret: "mongodb-ca-vault"
  mode: preferTLS
extraFlags:
 - "--tlsAllowConnectionsWithoutCertificates"
priorityClassName: "our-secops-050"
persistence:
  storageClass: "our-nfs-retained-storage"
  size: 3Gi
systemLogVerbosity: 0
externalAccess:
  enabled: true
  service:
    type: ClusterIP
extraVolumeMounts:
  - name: mongodb-vault
    mountPath: '/etc/mongodb/userconfig/vault-secrets'
    readOnly: true
metrics:
  enabled: false
  prometheusRule:
    enabled: false

What is the expected behavior?

On the Configmap mongodb-scripts to have the following variable set like this:

usernameAndPassword="-u ${MONGODB_ROOT_USER} -p ${MONGODB_ROOT_PASSWORD}"

Maybe adding an OR to the condition in this line like the following:

{{- if and .Values.auth.enabled (or .Values.auth.rootPassword .Values.auth.existingSecret) }}

What do you see instead?

we have the following variable set to:

usernameAndPassword=""

@soufianebenali soufianebenali added the tech-issues The user has a technical issue about an application label May 15, 2024
@github-actions github-actions bot added the triage Triage is needed label May 15, 2024
@carrodher
Copy link
Member

Thank you for bringing this issue to our attention. We appreciate your involvement! If you're interested in contributing a solution, we welcome you to create a pull request. The Bitnami team is excited to review your submission and offer feedback. You can find the contributing guidelines here.

Your contribution will greatly benefit the community. Feel free to reach out if you have any questions or need assistance.

soufianebenali added a commit to soufianebenali/Bitnami-charts that referenced this issue May 16, 2024
…Values.auth.rootPassword

Description:
Ensure that the Helm chart handles authentication correctly by using an "or" condition between .Values.auth.existingSecret and .Values.auth.rootPassword while maintaining the "and" condition with .Values.auth.enabled. This allows for the use of existing secrets from Vault alongside the root password.

Resolved: bitnami#25885
soufianebenali added a commit to soufianebenali/Bitnami-charts that referenced this issue May 16, 2024
…Values.auth.rootPassword

Description:
Ensure that the Helm chart handles authentication correctly by using an "or" condition between .Values.auth.existingSecret and .Values.auth.rootPassword while maintaining the "and" condition with .Values.auth.enabled. This allows for the use of existing secrets from Vault alongside the root password.

Resolved: bitnami#25885

Signed-off-by: Soufiane Benali <[email protected]>
soufianebenali added a commit to soufianebenali/Bitnami-charts that referenced this issue May 16, 2024
…Values.auth.rootPassword

Description:
Ensure that the Helm chart handles authentication correctly by using an "or" condition between .Values.auth.existingSecret and .Values.auth.rootPassword while maintaining the "and" condition with .Values.auth.enabled. This allows for the use of existing secrets from Vault alongside the root password.

Resolved: bitnami#25885

Signed-off-by: Soufiane Benali <[email protected]>
soufianebenali added a commit to soufianebenali/Bitnami-charts that referenced this issue May 16, 2024
…Values.auth.rootPassword

Description:
Ensure that the Helm chart handles authentication correctly by using an "or" condition between .Values.auth.existingSecret and .Values.auth.rootPassword while maintaining the "and" condition with .Values.auth.enabled. This allows for the use of existing secrets from Vault alongside the root password.

Resolved: bitnami#25885

Signed-off-by: Soufiane Benali <[email protected]>
alemorcuq added a commit that referenced this issue May 24, 2024
…et and .Values.auth.rootPassword (#25944)

* Summary: Add "or" condition between .Values.auth.existingSecret and .Values.auth.rootPassword

Description:
Ensure that the Helm chart handles authentication correctly by using an "or" condition between .Values.auth.existingSecret and .Values.auth.rootPassword while maintaining the "and" condition with .Values.auth.enabled. This allows for the use of existing secrets from Vault alongside the root password.

Resolved: #25885

Signed-off-by: Soufiane Benali <[email protected]>

* Update CHANGELOG.md

Signed-off-by: Bitnami Containers <[email protected]>

---------

Signed-off-by: Soufiane Benali <[email protected]>
Signed-off-by: Alejandro Moreno <[email protected]>
Signed-off-by: Bitnami Containers <[email protected]>
Co-authored-by: Alejandro Moreno <[email protected]>
Co-authored-by: Bitnami Containers <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
2 participants