Skip to content

Commit

Permalink
fix: Use scoped client name in Reconcile (#45)
Browse files Browse the repository at this point in the history
When the maester creates a client, it adds the namespace to the owner. This fix takes that into account when checking for updates.

Without this patch, the maester fails to update the client with hydra when the k8s admin makes changes to the oauth2client resource in a namespace.

Testing image is available at `dangersalad/hydra-maester:v0.0.12-alpha2`.
  • Loading branch information
paulbdavis committed Feb 5, 2020
1 parent a88f285 commit f8f51ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/oauth2client_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (r *OAuth2ClientReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error
}

if found {
if fetched.Owner != oauth2client.Name {
if fetched.Owner != fmt.Sprintf("%s/%s", oauth2client.Name, oauth2client.Namespace) {
conflictErr := errors.Errorf("ID provided in secret %s/%s is assigned to another resource", secret.Name, secret.Namespace)
if updateErr := r.updateReconciliationStatusError(ctx, &oauth2client, hydrav1alpha1.StatusInvalidSecret, conflictErr); updateErr != nil {
return ctrl.Result{}, updateErr
Expand Down

0 comments on commit f8f51ea

Please sign in to comment.