fix: wait for app user secret before starting initdb#8663
Conversation
|
❗ By default, the pull request is configured to backport to all release branches.
|
|
/test limit=local |
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/18003840131 |
|
/test limit=local |
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/18012162947 |
b416c6d to
5d37c09
Compare
|
/test limit=local |
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/18058199848 |
| job.Spec.Template.Spec.Containers[0].Env = append(job.Spec.Template.Spec.Containers[0].Env, corev1.EnvVar{ | ||
| Name: "APP_USERNAME", | ||
| ValueFrom: &corev1.EnvVarSource{ | ||
| SecretKeyRef: &corev1.SecretKeySelector{ | ||
| LocalObjectReference: corev1.LocalObjectReference{Name: cluster.GetApplicationSecretName()}, | ||
| Key: "username", | ||
| Optional: ptr.To(false), | ||
| }, | ||
| }, | ||
| }) | ||
| } | ||
|
|
There was a problem hiding this comment.
Potentially we could use the container envfrom field to mount the whole secret, but I felt like for what we want to achieve this minimalistic approach that exposes only the username to the job is the best
|
/test limit=local |
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/18099907008 |
|
do we have any ETA for a release once this is merged? :) this would help us remove a very ugly workaround |
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
This patch ensures that the operator waits for the application user secret to be available before running `initdb`. The change is implemented with minimal impact by adding a reference to the secret in the Pod created by the `initdb` Job. The username is exposed as an environment variable, which is not currently used, but guarantees that the Job cannot start until the secret exists. Closes: #6069 Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> (cherry picked from commit 9d4ec08)
This patch ensures that the operator waits for the application user secret to be available before running `initdb`. The change is implemented with minimal impact by adding a reference to the secret in the Pod created by the `initdb` Job. The username is exposed as an environment variable, which is not currently used, but guarantees that the Job cannot start until the secret exists. Closes: #6069 Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> (cherry picked from commit 9d4ec08)
This patch ensures that the operator waits for the application user secret to be available before running `initdb`. The change is implemented with minimal impact by adding a reference to the secret in the Pod created by the `initdb` Job. The username is exposed as an environment variable, which is not currently used, but guarantees that the Job cannot start until the secret exists. Closes: #6069 Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> (cherry picked from commit 9d4ec08)
…tive-pg#8663) This patch ensures that the operator waits for the application user secret to be available before running `initdb`. The change is implemented with minimal impact by adding a reference to the secret in the Pod created by the `initdb` Job. The username is exposed as an environment variable, which is not currently used, but guarantees that the Job cannot start until the secret exists. Closes: cloudnative-pg#6069 Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
|
@armru Will this fix also work for secrets of managed roles? If not should I open a new issue or do we keep the existing issue open for that? |
…tive-pg#8663) This patch ensures that the operator waits for the application user secret to be available before running `initdb`. The change is implemented with minimal impact by adding a reference to the secret in the Pod created by the `initdb` Job. The username is exposed as an environment variable, which is not currently used, but guarantees that the Job cannot start until the secret exists. Closes: cloudnative-pg#6069 Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com> Signed-off-by: theBrahma <office.utpal.brahma@gmail.com>
The scope of this PR is to address #6069 with minimally invasive changes
Closes #6069