Skip to content

Commit 494d753

Browse files
mprahldhaiducek
authored andcommitted
Fix the Gatekeeper expander event inform policy
This was accidentally checking for annotations in the format of an array of maps but it should just be a map. Signed-off-by: mprahl <[email protected]>
1 parent 75d0dfe commit 494d753

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

internal/expanders/gatekeeper.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,11 @@ func (g GatekeeperPolicyExpander) Expand(
105105
"objectDefinition": map[string]interface{}{
106106
"apiVersion": "v1",
107107
"kind": "Event",
108-
"annotations": []map[string]interface{}{
109-
{
110-
"constraint_action": "deny",
111-
"constraint_kind": constraintKind,
112-
"constraint_name": constraintName,
113-
"event_type": "violation",
114-
},
108+
"annotations": map[string]interface{}{
109+
"constraint_action": "deny",
110+
"constraint_kind": constraintKind,
111+
"constraint_name": constraintName,
112+
"event_type": "violation",
115113
},
116114
},
117115
},

internal/expanders/gatekeeper_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,11 @@ func TestGatekeeperExpand(t *testing.T) {
141141
"objectDefinition": map[string]interface{}{
142142
"apiVersion": "v1",
143143
"kind": "Event",
144-
"annotations": []map[string]interface{}{
145-
{
146-
"constraint_action": "deny",
147-
"constraint_kind": "MyConstraint",
148-
"constraint_name": "my-awesome-constraint",
149-
"event_type": "violation",
150-
},
144+
"annotations": map[string]interface{}{
145+
"constraint_action": "deny",
146+
"constraint_kind": "MyConstraint",
147+
"constraint_name": "my-awesome-constraint",
148+
"event_type": "violation",
151149
},
152150
},
153151
},

0 commit comments

Comments
 (0)