Skip to content

Commit

Permalink
[release-1.13] Remove sinkbindings OIDC token secret when not needed …
Browse files Browse the repository at this point in the history
…and fix status setting (#7839)

* Remove Sinkbindings OIDC token secret, when not needed

* Set Sinkbindings OIDCTokenSecretName in its status correctly

---------

Co-authored-by: Christoph Stäbler <cstabler@redhat.com>
  • Loading branch information
knative-prow-robot and creydr authored Apr 10, 2024
1 parent d045c98 commit 4745cd5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/reconciler/sinkbinding/sinkbinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ func (s *SinkBindingSubResourcesReconciler) Reconcile(ctx context.Context, b psb
// sink has no audience set -> don't create token secret
sb.Status.MarkOIDCIdentityCreatedSucceededWithReason("Sink has no audience defined", "")
sb.Status.MarkOIDCTokenSecretCreatedSuccceededWithReason("Sink has no audience defined", "")

if err := s.removeOIDCTokenSecretEventually(ctx, sb); err != nil {
return err
}
sb.Status.OIDCTokenSecretName = nil
}
} else {
Expand Down Expand Up @@ -164,6 +168,8 @@ func (s *SinkBindingSubResourcesReconciler) reconcileOIDCTokenSecret(ctx context
logger.Debugf("OIDC token secret for %s/%s sinkbinding still valid for > %s (expires %s). Will not update secret", sb.Name, sb.Namespace, resyncAndBufferDuration, expiry)
// token is still valid for resync period + buffer --> we're fine

sb.Status.OIDCTokenSecretName = &secretName

return nil
}

Expand Down

0 comments on commit 4745cd5

Please sign in to comment.