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

Run reset-admin-password on reinstallation #1324

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES/1294.bugfix
Original file line number Diff line number Diff line change
@@ -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`.
8 changes: 6 additions & 2 deletions controllers/repo_manager/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion controllers/repo_manager/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}
Expand Down
Loading