Skip to content

Commit

Permalink
Add missing prefixes to k8s resources
Browse files Browse the repository at this point in the history
  • Loading branch information
monteiro-renato authored Nov 25, 2024
1 parent c3b2eb9 commit 7678e3e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/plugins/optional/helm/v1alpha/scaffolds/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ func copyFileWithHelmLogic(srcFile, destFile, subDir, projectName string) error
contentStr = strings.Replace(contentStr,
"name: metrics-reader",
fmt.Sprintf("name: %s-metrics-reader", projectName), 1)

contentStr = strings.Replace(contentStr,
"name: metrics-auth-role",
fmt.Sprintf("name: %s-metrics-auth-role", projectName), -1)
contentStr = strings.Replace(contentStr,
"name: metrics-auth-rolebinding",
fmt.Sprintf("name: %s-metrics-auth-rolebinding", projectName), 1)

if strings.Contains(contentStr, "-controller-manager") &&
strings.Contains(contentStr, "kind: ServiceAccount") &&
!strings.Contains(contentStr, "RoleBinding") {
Expand All @@ -312,6 +320,12 @@ func copyFileWithHelmLogic(srcFile, destFile, subDir, projectName string) error
contentStr = strings.Replace(contentStr,
"name: leader-election-rolebinding",
fmt.Sprintf("name: %s-leader-election-rolebinding", projectName), 1)
contentStr = strings.Replace(contentStr,
"name: manager-role",
fmt.Sprintf("name: %s-manager-role", projectName), -1)
contentStr = strings.Replace(contentStr,
"name: manager-rolebinding",
fmt.Sprintf("name: %s-manager-rolebinding", projectName), 1)

// The generated files do not include the namespace
if strings.Contains(contentStr, "leader-election-rolebinding") ||
Expand Down

0 comments on commit 7678e3e

Please sign in to comment.