Skip to content

Commit

Permalink
Remove octarine ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
BenRub committed Sep 18, 2023
1 parent 5de2343 commit ecad79c
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions cbcontainers/state/components/enforcer_validating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,6 @@ func (obj *EnforcerValidatingWebhookK8sObject) mutateResourcesWebhook(resourcesW
}

func (obj *EnforcerValidatingWebhookK8sObject) getResourcesNamespaceSelector(selector *metav1.LabelSelector) *metav1.LabelSelector {
octarineIgnore := metav1.LabelSelectorRequirement{
Key: "octarine",
Operator: metav1.LabelSelectorOpNotIn,
Values: []string{"ignore"},
}

agentNamespace := metav1.LabelSelectorRequirement{
// See https://kubernetes.io/docs/reference/labels-annotations-taints/#kubernetes-io-metadata-name
// This is the label that always matches the namespace name
Expand All @@ -154,22 +148,18 @@ func (obj *EnforcerValidatingWebhookK8sObject) getResourcesNamespaceSelector(sel
if selector == nil || selector.MatchExpressions == nil || len(selector.MatchExpressions) != 2 {
initializeLabelSelector = true
} else {
octarineIgnoreFound := false
cbContainersNamespaceFound := false
for _, requirement := range selector.MatchExpressions {
if reflect.DeepEqual(requirement, octarineIgnore) {
octarineIgnoreFound = true
}
if reflect.DeepEqual(requirement, agentNamespace) {
cbContainersNamespaceFound = true
}
}
initializeLabelSelector = !octarineIgnoreFound || !cbContainersNamespaceFound
initializeLabelSelector = !cbContainersNamespaceFound
}

if initializeLabelSelector {
return &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{octarineIgnore, agentNamespace},
MatchExpressions: []metav1.LabelSelectorRequirement{agentNamespace},
}
}

Expand Down

0 comments on commit ecad79c

Please sign in to comment.