Skip to content

Commit

Permalink
Update RegistryProfile with new ACR token password once rotated (#3088)
Browse files Browse the repository at this point in the history
  • Loading branch information
cadenmarchese authored Aug 22, 2023
1 parent cf09d3c commit 48af20f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/cluster/acrtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,25 @@ func (m *manager) rotateACRTokenPassword(ctx context.Context) error {
return nil
}

tokenManager, err := acrtoken.NewManager(m.env, m.localFpAuthorizer)
token, err := acrtoken.NewManager(m.env, m.localFpAuthorizer)
if err != nil {
return err
}

registryProfile := tokenManager.GetRegistryProfile(m.doc.OpenShiftCluster)
err = tokenManager.RotateTokenPassword(ctx, registryProfile)
registryProfile := token.GetRegistryProfile(m.doc.OpenShiftCluster)
err = token.RotateTokenPassword(ctx, registryProfile)
if err != nil {
return err
}

m.doc, err = m.db.PatchWithLease(ctx, m.doc.Key, func(doc *api.OpenShiftClusterDocument) error {
token.PutRegistryProfile(doc.OpenShiftCluster, registryProfile)
return nil
})
if err != nil {
return err
}

// update cluster pull secret in openshift-azure-operator namespace
// secret is stored as a .dockerconfigjson string in the .dockerconfigjson key
encodedDockerConfigJson, _, err := pullsecret.SetRegistryProfiles("", registryProfile)
Expand Down

0 comments on commit 48af20f

Please sign in to comment.