Skip to content

Commit

Permalink
workaround for empty Kind or Group in certificaterequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Arseniy Belorukov committed Dec 9, 2023
1 parent c459a13 commit 5a7f9b5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/internal/approver/manager/predicate/predicate.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,18 @@ func SelectorIssuerRef(_ context.Context, cr *cmapi.CertificateRequest, policies
if issRefSel.Name != nil && !util.WildcardMatches(*issRefSel.Name, issRef.Name) {
continue
}
if issRefSel.Kind != nil && !util.WildcardMatches(*issRefSel.Kind, issRef.Kind) {
issRefKind := issRef.Kind
if issRefKind == "" {
issRefKind = "Issuer"
}
if issRefSel.Kind != nil && !util.WildcardMatches(*issRefSel.Kind, issRefKind) {
continue
}
if issRefSel.Group != nil && !util.WildcardMatches(*issRefSel.Group, issRef.Group) {
issRefGroup := issRef.Group
if issRefGroup == "" {
issRefGroup = "cert-manager.io"
}
if issRefSel.Group != nil && !util.WildcardMatches(*issRefSel.Group, issRefGroup) {
continue
}
matchingPolicies = append(matchingPolicies, policy)
Expand Down

0 comments on commit 5a7f9b5

Please sign in to comment.