Skip to content

Commit

Permalink
APIGOV-29053 - support skipping handling external CRDs (#844)
Browse files Browse the repository at this point in the history
* APIGOV-29053 - support skipping handling external CRDs

* MR changes
  • Loading branch information
dgghinea authored Oct 30, 2024
1 parent 21e255a commit fd56acb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/agent/handler/credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ func (h *credentials) Handle(ctx context.Context, meta *proto.EventMeta, resourc
return nil
}

if c, ok := h.prov.(prov.CustomCredential); ok {
creds := c.GetIgnoredCredentialTypes()
for _, cred := range creds {
if cred == cr.Spec.CredentialRequestDefinition {
logger.WithField("crdName", cred).Debug("skipping handling credential provisioning")
return nil
}
}
}

var credential *management.Credential
if ok := h.shouldProcessPending(cr); ok {
log.Trace("processing resource in pending status")
Expand Down
5 changes: 5 additions & 0 deletions pkg/apic/provisioning/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
OAuthSecretCRD = "oauth-secret"
OAuthPublicKeyCRD = "oauth-public-key"
OAuthIDPCRD = "oauth-idp"
ExternalCRD = "external-crd"

OauthClientID = "clientId"
OauthClientSecret = "clientSecret"
Expand Down Expand Up @@ -129,6 +130,10 @@ type Provisioning interface {
CredentialUpdate(CredentialRequest) (RequestStatus, Credential)
}

type CustomCredential interface {
GetIgnoredCredentialTypes() []string
}

// ExpiredCredentialAction - the action to take on an expired credential
type ExpiredCredentialAction int

Expand Down

0 comments on commit fd56acb

Please sign in to comment.