Skip to content

Commit

Permalink
Fallback Category
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Jogeleit <[email protected]>
  • Loading branch information
Frank Jogeleit committed Apr 29, 2024
1 parent 430ebb6 commit 27252fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/kyverno/pkg/kubernetes/kyverno/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (c *client) GetPolicies(ctx context.Context) ([]sdk.PolicyListItem, error)
Title: title,
Namespace: p.Namespace,
Name: p.Name,
Category: p.Annotations[AnnotationPolicyCategory],
Category: utils.Defaults(p.Annotations[AnnotationPolicyCategory], "Other"),
Severity: p.Annotations[AnnotationPolicySeverity],
Description: p.Annotations[AnnotationPolicyDescription],
}
Expand Down
9 changes: 9 additions & 0 deletions plugins/kyverno/pkg/utils/defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package utils

func Defaults(value, fallback string) string {
if value != "" {
return value
}

return fallback
}

0 comments on commit 27252fe

Please sign in to comment.