diff --git a/CHANGES/1294.bugfix b/CHANGES/1294.bugfix new file mode 100644 index 000000000..08884033c --- /dev/null +++ b/CHANGES/1294.bugfix @@ -0,0 +1,2 @@ +Fixed an issue where the reset-admin-password `Job` was not being deployed during +a reinstallation with the same admin `Secret`. diff --git a/controllers/repo_manager/job.go b/controllers/repo_manager/job.go index f7ffd3f8b..b581cd3d1 100644 --- a/controllers/repo_manager/job.go +++ b/controllers/repo_manager/job.go @@ -41,10 +41,11 @@ func (r *RepoManagerReconciler) updateAdminPasswordJob(ctx context.Context, pulp log.Error(err, "Failed to find "+adminSecretName+" Secret!") } - // if the secret didn't change there is nothing to do + // if the secret is already set (it is not the first execution) and it + // didn't change, there is nothing to do calculatedHash := controllers.CalculateHash(adminSecret.Data) currentHash := controllers.GetCurrentHash(adminSecret) - if currentHash == calculatedHash { + if pulp.Status.AdminPasswordSecret != "" && currentHash == calculatedHash { return } @@ -81,6 +82,9 @@ func (r *RepoManagerReconciler) updateAdminPasswordJob(ctx context.Context, pulp if err := r.Update(ctx, adminSecret); err != nil { log.Error(err, "Failed to update "+adminSecretName+" Secret label!") } + + // update the status.admin_password_secret field + setStatus(ctx, pulp, adminPwdSecretCondition(), *r, "AdminPasswordSecret") } // pulpcoreVolumes defines the list of volumes used by pulpcore containers diff --git a/controllers/repo_manager/status.go b/controllers/repo_manager/status.go index eb6aa6ec4..6a3825929 100644 --- a/controllers/repo_manager/status.go +++ b/controllers/repo_manager/status.go @@ -179,7 +179,6 @@ func setStatusFields(ctx context.Context, pulp *repomanagerpulpprojectorgv1beta2 {verifyFunc: dbFieldsEncrSecretCondition(), fieldName: "DBFieldsEncryptionSecret"}, {verifyFunc: ingressTypeCondition(), fieldName: "IngressType"}, {verifyFunc: containerTokenSecretCondition(), fieldName: "ContainerTokenSecret"}, - {verifyFunc: adminPwdSecretCondition(), fieldName: "AdminPasswordSecret"}, {verifyFunc: ingressClassNameCondition(), fieldName: "IngressClassName"}, {verifyFunc: pulpSecretKeyCondition(), fieldName: "PulpSecretKey"}, }