janus-idp / backstage-operator

Apache License 2.0
4 stars 11 forks source link

add checkPostPassword PreHook #35

Closed PatAKnight closed 10 months ago

PatAKnight commented 1 year ago

Description

This PR adds a new PreHook called checkPostPassword that will check the Helm Release to see if upstream.postgresql.auth.password and upstream.postgresql.auth.postgresPassword has been set. The purpose of this is to fix the problem of reconcile error stating that upstream.postgresql.auth.password and upstream.postgresql.auth.postgresPassword must not be empty.

The checkPostPassword will randomly generate a string for the password and postgresPassword fields whenever the helm chart is installed. These will then be picked up by the PostgreSQL helm chart. If these fields already have input in them, this prehook will skip adding to the fields.

Currently, there is a limitation to this that we will need to document. Essentially, if a user decides to enter in an existingSecret, they will also need to enter in the password and postgresPassword for the operator to work. The reason is that the operator will perform a dry run periodically and before any upgrades. This will lead to the error that the password and postgresPassword must not be empty.

One other thing to note. I had to update both the upstream and backstage values whenever I am setting the password. For some reason there is an issue with using one or the other. Only setting upstream will lead to the password error and only setting backstage will make it so that I can not skip setting the fields.

Which issues(s) does this PR fix

sonarcloud[bot] commented 1 year ago

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
16.9% 16.9% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint