From 6de059eae9a7e906133d531e0904ecd9ba533fb7 Mon Sep 17 00:00:00 2001 From: Peter Engelbert Date: Tue, 7 Feb 2023 10:57:56 -0500 Subject: [PATCH 1/2] Ensure windows nodes are excluded by default Signed-off-by: Peter Engelbert --- config/manager/controller_manager_config.yaml | 1 + controllers/imagejob/imagejob_controller.go | 10 ---------- manifest_staging/charts/eraser/values.yaml | 7 ++++--- manifest_staging/deploy/eraser.yaml | 1 + .../gatekeeper/helmify/static/values.yaml | 7 ++++--- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/config/manager/controller_manager_config.yaml b/config/manager/controller_manager_config.yaml index f0dd6d1e8e..92921276f0 100644 --- a/config/manager/controller_manager_config.yaml +++ b/config/manager/controller_manager_config.yaml @@ -21,6 +21,7 @@ manager: type: exclude # must be either exclude|include selectors: - eraser.sh/cleanup.filter + - kubernetes.io/os=windows components: collector: enabled: true diff --git a/controllers/imagejob/imagejob_controller.go b/controllers/imagejob/imagejob_controller.go index a3bb820cf8..47dad5be2c 100644 --- a/controllers/imagejob/imagejob_controller.go +++ b/controllers/imagejob/imagejob_controller.go @@ -63,16 +63,6 @@ var defaultTolerations = []corev1.Toleration{ } func Add(mgr manager.Manager, cfg *config.Manager) error { - c, err := cfg.Read() - if err != nil { - return err - } - - filterOpts := c.Manager.NodeFilter - if filterOpts.Type == "exclude" && !slices.Contains(filterOpts.Selectors, windowsFilterLabel) { - filterOpts.Selectors = append(filterOpts.Selectors, windowsFilterLabel) - } - return add(mgr, newReconciler(mgr, cfg)) } diff --git a/manifest_staging/charts/eraser/values.yaml b/manifest_staging/charts/eraser/values.yaml index 5180266cb6..7104d1311b 100644 --- a/manifest_staging/charts/eraser/values.yaml +++ b/manifest_staging/charts/eraser/values.yaml @@ -26,9 +26,10 @@ runtimeConfig: pullSecrets: [] # image pull secrets for collector/scanner/eraser priorityClassName: "" # priority class name for collector/scanner/eraser nodeFilter: {} - # type: exclude # must be either exclude|include - # selectors: - # - eraser.sh/cleanup.filter + type: exclude # must be either exclude|include + selectors: + - eraser.sh/cleanup.filter + - kubernetes.io/os=windows components: collector: enabled: true diff --git a/manifest_staging/deploy/eraser.yaml b/manifest_staging/deploy/eraser.yaml index 7106b279f9..1a4643d82f 100644 --- a/manifest_staging/deploy/eraser.yaml +++ b/manifest_staging/deploy/eraser.yaml @@ -453,6 +453,7 @@ data: type: exclude # must be either exclude|include selectors: - eraser.sh/cleanup.filter + - kubernetes.io/os=windows components: collector: enabled: true diff --git a/third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml b/third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml index 5180266cb6..7104d1311b 100644 --- a/third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml +++ b/third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml @@ -26,9 +26,10 @@ runtimeConfig: pullSecrets: [] # image pull secrets for collector/scanner/eraser priorityClassName: "" # priority class name for collector/scanner/eraser nodeFilter: {} - # type: exclude # must be either exclude|include - # selectors: - # - eraser.sh/cleanup.filter + type: exclude # must be either exclude|include + selectors: + - eraser.sh/cleanup.filter + - kubernetes.io/os=windows components: collector: enabled: true From c83f1eff892bc51292ab48b492d26926839b1b07 Mon Sep 17 00:00:00 2001 From: Peter Engelbert Date: Tue, 7 Feb 2023 15:10:26 -0500 Subject: [PATCH 2/2] Fix typo in helm chart Signed-off-by: Peter Engelbert --- manifest_staging/charts/eraser/values.yaml | 2 +- .../open-policy-agent/gatekeeper/helmify/static/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest_staging/charts/eraser/values.yaml b/manifest_staging/charts/eraser/values.yaml index 7104d1311b..a1f0eb728c 100644 --- a/manifest_staging/charts/eraser/values.yaml +++ b/manifest_staging/charts/eraser/values.yaml @@ -25,7 +25,7 @@ runtimeConfig: # delayOnFailure: "" pullSecrets: [] # image pull secrets for collector/scanner/eraser priorityClassName: "" # priority class name for collector/scanner/eraser - nodeFilter: {} + nodeFilter: type: exclude # must be either exclude|include selectors: - eraser.sh/cleanup.filter diff --git a/third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml b/third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml index 7104d1311b..a1f0eb728c 100644 --- a/third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml +++ b/third_party/open-policy-agent/gatekeeper/helmify/static/values.yaml @@ -25,7 +25,7 @@ runtimeConfig: # delayOnFailure: "" pullSecrets: [] # image pull secrets for collector/scanner/eraser priorityClassName: "" # priority class name for collector/scanner/eraser - nodeFilter: {} + nodeFilter: type: exclude # must be either exclude|include selectors: - eraser.sh/cleanup.filter