Skip to content

Commit f2a5573

Browse files
Feat: improve CEL expression checks in mutating webhook configuration (#27)
1 parent 72ca429 commit f2a5573

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • internal/controller/overcommitclass

internal/controller/overcommitclass/utils.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,22 @@ func webhookChanged(updated, current interface{}) bool {
224224
}
225225
}
226226

227+
// Compare MatchConditions (including CEL expressions for namespace exclusion)
228+
if len(updatedWebhook.MatchConditions) != len(currentWebhook.MatchConditions) {
229+
return true
230+
}
231+
232+
for i, updatedCondition := range updatedWebhook.MatchConditions {
233+
if i >= len(currentWebhook.MatchConditions) {
234+
return true
235+
}
236+
currentCondition := currentWebhook.MatchConditions[i]
237+
if updatedCondition.Name != currentCondition.Name ||
238+
updatedCondition.Expression != currentCondition.Expression {
239+
return true
240+
}
241+
}
242+
227243
// If we reach here, they're likely the same
228244
return false
229245
}

0 commit comments

Comments
 (0)