Skip to content

Commit

Permalink
Merge pull request #44 from heliapb/fix/op_crd
Browse files Browse the repository at this point in the history
[FIX] - CRD name bug on Operator Analyser
  • Loading branch information
nicolastakashi authored Oct 26, 2024
2 parents a90a3e1 + 2ef5f8b commit 8de95a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions internal/analyzers/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ func analyzeClusterRoleAndCRDRules(ctx context.Context, clientSets *k8sutil.Clie
}

func analyzeCRDRules(ctx context.Context, clientSets *k8sutil.ClientSets, crb v1.ClusterRoleBinding, rule v1.PolicyRule) error {
for _, crd := range crds.List {
crd, err := clientSets.APIExtensionsClient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, crd, metav1.GetOptions{})
for _, crdName := range crds.List {
crd, err := clientSets.APIExtensionsClient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, crdName, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("failed to get CRD %s", crd)
return fmt.Errorf("failed to get CRD %s", crdName)
}

found := false
Expand Down
20 changes: 10 additions & 10 deletions internal/crds/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ package crds

var (
List = []string{
"alertmanagers",
"alertmanagerconfigs",
"podmonitors",
"probes",
"prometheusagents",
"prometheuses",
"prometheusrules",
"scrapeconfigs",
"servicemonitors",
"thanosrulers",
"alertmanagers.monitoring.coreos.com",
"alertmanagerconfigs.monitoring.coreos.com",
"podmonitors.monitoring.coreos.com",
"probes.monitoring.coreos.com",
"prometheusagents.monitoring.coreos.com",
"prometheuses.monitoring.coreos.com",
"prometheusrules.monitoring.coreos.com",
"scrapeconfigs.monitoring.coreos.com",
"servicemonitors.monitoring.coreos.com",
"thanosrulers.monitoring.coreos.com",
}
)

0 comments on commit 8de95a0

Please sign in to comment.