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

APIGOV-29053 - support skipping handling external CRDs #844

Merged
merged 2 commits into from
Oct 30, 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
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