Skip to content

Commit

Permalink
Merge pull request sl1pm4t#86 from sl1pm4t/cluster_role_selectors
Browse files Browse the repository at this point in the history
Fix ClusterRole aggregation_rule.cluster_role_selector] not found
  • Loading branch information
sl1pm4t authored Oct 5, 2021
2 parents 59182ac + 60670a2 commit 6ef6d85
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
5 changes: 5 additions & 0 deletions hcl_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ func TestWriteObject(t *testing.T) {
"kubernetes_certificate_signing_request",
0,
},
{
"clusterRole",
"kubernetes_cluster_role",
0,
},
}

for _, tt := range tests {
Expand Down
4 changes: 2 additions & 2 deletions input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ func Test_readFilesInput(t *testing.T) {
{
"test-fixtures",
"test-fixtures",
21,
22,
},
{
"test-fixtures/",
"test-fixtures/",
21,
22,
},
{
"test-fixtures/nested/server-clusterrole.yaml",
Expand Down
1 change: 1 addition & 0 deletions pkg/tfkschema/name_mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func init() {
inflection.AddSingular("requests", "requests")
inflection.AddSingular("imagePullSecrets", "imagePullSecrets")
inflection.AddSingular("capabilities", "capabilities")
inflection.AddSingular("ClusterRoleSelectors", "ClusterRoleSelectors")

inflection.AddUncountable("data")
inflection.AddUncountable("metadata")
Expand Down
10 changes: 10 additions & 0 deletions test-fixtures/clusterRole.tf.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "kubernetes_cluster_role" "monitoring" {
metadata {
name = "monitoring"
}
aggregation_rule {
cluster_role_selectors {
match_labels = { "rbac.example.com/aggregate-to-monitoring" = "true" }
}
}
}
9 changes: 9 additions & 0 deletions test-fixtures/clusterRole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: monitoring
aggregationRule:
clusterRoleSelectors:
- matchLabels:
rbac.example.com/aggregate-to-monitoring: "true"
rules: [] # The control plane automatically fills in the rules

0 comments on commit 6ef6d85

Please sign in to comment.