Skip to content

Commit

Permalink
Remove the policy from OPA if ConfigMap's label was removed
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey LEBEDEV <[email protected]>
  • Loading branch information
Andrey LEBEDEV authored and tsandall committed Jan 29, 2020
1 parent 4bb0d82 commit 5c1724f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/configmap/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,16 @@ func (s *Sync) add(obj interface{}) {
}
}

func (s *Sync) update(_, obj interface{}) {
func (s *Sync) update(oldObj, obj interface{}) {
cm := obj.(*v1.ConfigMap)
if match, isPolicy := s.matcher(cm); match {
s.syncAdd(cm, isPolicy)
} else {
// check if the label was removed
oldCm := oldObj.(*v1.ConfigMap)
if match, isPolicy := s.matcher(oldCm); match {
s.syncRemove(oldCm, isPolicy)
}
}
}

Expand Down

0 comments on commit 5c1724f

Please sign in to comment.