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

[artifactory] Create database secrets if postgres password is set #1110

Conversation

woodcockjosh
Copy link

PR Checklist

[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]

  • Chart Version bumped
  • CHANGELOG.md updated
  • Variables and other changes are documented in the README.md
  • Title of the PR starts with chart name (e.g. [artifactory])

What this PR does / why we need it:
Allows user to set database password rather than use the generated one. This also works as a workaround for #859

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes

Special notes for your reviewer:

@@ -1,4 +1,4 @@
{{- if and (not .Values.database.secrets) (not .Values.postgresql.enabled) }}
{{- if or (and (not .Values.database.secrets) (not .Values.postgresql.enabled)) .Values.database.password }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@woodcockjosh I'm not sure this change is required , .Values.database.password implies external postgres

@@ -429,6 +429,9 @@ artifactory:
url: "jdbc:postgresql://{{ .Release.Name }}-postgresql:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }}"
driver: org.postgresql.Driver
username: "{{ .Values.postgresql.postgresqlUsername }}"
{{- if .Values.postgresql.postgresqlPassword }}
password: "{{ .Values.postgresql.postgresqlPassword }}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@woodcockjosh This creates a secret for .Values.postgresql.postgresqlPassword from postgresql sub-chart and in statefulset it is referenced using JF_SHARED_DATABASE_PASSWORD

{{ if or .Values.database.secrets.password .Values.database.password .Values.postgresql.enabled }}
        - name: JF_SHARED_DATABASE_PASSWORD
          valueFrom:
            secretKeyRef:
        {{- if .Values.database.secrets.password }}
              name: {{ tpl .Values.database.secrets.password.name . }}
              key: {{ tpl .Values.database.secrets.password.key . }}
        {{- else if .Values.database.password }}
              name: {{ template "artifactory.fullname" . }}-database-creds
              key: db-password
        {{- else if .Values.postgresql.enabled }}
              name: {{ .Release.Name }}-postgresql
              key: postgresql-password
        {{- end }}
      {{- end }}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right well until a solution is implemented for #859 I'm going to use this approach to fix the problem with upgrades. It would be a shame if everyone else had to copy paste the artifactory chart to solve their problem but I understand if upgrading the chart without the upgrade failing is not the highest priority for the repo.

@woodcockjosh
Copy link
Author

@chukka any update on this?

@gitta-jfrog
Copy link
Collaborator

We decided to keep the current implementation as it is, if needed, please raise a issue and we will investigate. Thanks!

@gitta-jfrog gitta-jfrog closed this Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants