Skip to content

Commit

Permalink
fix: Fix crd names error for roles (#1365)
Browse files Browse the repository at this point in the history
roles can have different chars which are not supported in crd names eg '_', capital letter

fixes: #1355
  • Loading branch information
deven0t authored Jul 24, 2023
1 parent 5938409 commit dc22a5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/configauditreport/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ func (b *ReportBuilder) Data(data v1alpha1.ConfigAuditReportData) *ReportBuilder
func (b *ReportBuilder) reportName() string {
kind := b.controller.GetObjectKind().GroupVersionKind().Kind
name := b.controller.GetName()
reportName := fmt.Sprintf("%s-%s", strings.ToLower(kind), strings.ToLower(name))
if len(validation.IsValidLabelValue(reportName)) == 0 {
reportName := fmt.Sprintf("%s-%s", strings.ToLower(kind), name)
if len(validation.IsDNS1123Label(reportName)) == 0 {
return reportName
}
return fmt.Sprintf("%s-%s", strings.ToLower(kind), kube.ComputeHash(name))
Expand Down

0 comments on commit dc22a5e

Please sign in to comment.