From 3ac6dba503a656d265ab4289cea6d3f32a656f59 Mon Sep 17 00:00:00 2001 From: Gabe Alford Date: Thu, 11 Jan 2024 14:39:16 -0700 Subject: [PATCH] fix: remove deprecated componentConfig and controller manager options --- PROJECT | 1 - cmd/main.go | 13 ------- config/default/manager_config_patch.yaml | 20 ---------- config/manager/controller_manager_config.yaml | 21 ---------- config/manager/kustomization.yaml | 4 -- config/non-olm/patches/manager_patch.yaml | 10 ----- deploy/falcon-operator.yaml | 39 +------------------ 7 files changed, 1 insertion(+), 107 deletions(-) delete mode 100644 config/default/manager_config_patch.yaml delete mode 100644 config/manager/controller_manager_config.yaml diff --git a/PROJECT b/PROJECT index 3028af5b..88db8788 100644 --- a/PROJECT +++ b/PROJECT @@ -2,7 +2,6 @@ # This file is used to track the info used to scaffold your project # and allow the plugins properly work. # More info: https://book.kubebuilder.io/reference/project-config.html -componentConfig: true domain: crowdstrike.com layout: - go.kubebuilder.io/v4 diff --git a/cmd/main.go b/cmd/main.go index 6f3238ad..7983f74f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -63,13 +63,8 @@ func main() { var profileAddr string var enableProfiling bool var ver bool - var configFile string var err error - flag.StringVar(&configFile, "config", "config.yaml", - "The controller will load its initial configuration from this file. "+ - "Omit this flag to use the default configuration values. "+ - "Command-line flags override configuration from this file.") flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.") flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.") flag.StringVar(&profileAddr, "profile-bind-address", "localhost:8082", "The address the profiling endpoint binds to.") @@ -147,14 +142,6 @@ func main() { ), } - if configFile != "" { - options, err = options.AndFrom(ctrl.ConfigFile().AtPath(configFile)) - if err != nil { - setupLog.Error(err, "unable to load the config file") - os.Exit(1) - } - } - mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options) if err != nil { setupLog.Error(err, "unable to start manager") diff --git a/config/default/manager_config_patch.yaml b/config/default/manager_config_patch.yaml deleted file mode 100644 index 6c400155..00000000 --- a/config/default/manager_config_patch.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: controller-manager - namespace: system -spec: - template: - spec: - containers: - - name: manager - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml - volumes: - - name: manager-config - configMap: - name: manager-config diff --git a/config/manager/controller_manager_config.yaml b/config/manager/controller_manager_config.yaml deleted file mode 100644 index 69474ff9..00000000 --- a/config/manager/controller_manager_config.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: 70435a7a.crowdstrike.com -# leaderElectionReleaseOnCancel defines if the leader should step down volume -# when the Manager ends. This requires the binary to immediately end when the -# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly -# speeds up voluntary leader transitions as the new leader don't have to wait -# LeaseDuration time first. -# In the default scaffold provided, the program ends immediately after -# the manager stops, so would be fine to enable this option. However, -# if you are doing or is intended to do any operation such as perform cleanups -# after the manager stops then its usage might be unsafe. -# leaderElectionReleaseOnCancel: true diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 548a6777..15c55a7d 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -4,10 +4,6 @@ resources: generatorOptions: disableNameSuffixHash: true -configMapGenerator: -- files: - - controller_manager_config.yaml - name: manager-config apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: diff --git a/config/non-olm/patches/manager_patch.yaml b/config/non-olm/patches/manager_patch.yaml index dd426caa..5878c800 100644 --- a/config/non-olm/patches/manager_patch.yaml +++ b/config/non-olm/patches/manager_patch.yaml @@ -13,15 +13,5 @@ spec: env: - name: WATCH_NAMESPACE value: null - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml securityContext: fsGroup: 65534 - volumes: - - name: manager-config - configMap: - name: manager-config diff --git a/deploy/falcon-operator.yaml b/deploy/falcon-operator.yaml index ba770150..0a734b42 100644 --- a/deploy/falcon-operator.yaml +++ b/deploy/falcon-operator.yaml @@ -3694,35 +3694,6 @@ subjects: name: falcon-operator-controller-manager namespace: falcon-operator --- -apiVersion: v1 -data: - controller_manager_config.yaml: | - apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 - kind: ControllerManagerConfig - health: - healthProbeBindAddress: :8081 - metrics: - bindAddress: 127.0.0.1:8080 - webhook: - port: 9443 - leaderElection: - leaderElect: true - resourceName: 70435a7a.crowdstrike.com - # leaderElectionReleaseOnCancel defines if the leader should step down volume - # when the Manager ends. This requires the binary to immediately end when the - # Manager is stopped, otherwise, this setting is unsafe. Setting this significantly - # speeds up voluntary leader transitions as the new leader don't have to wait - # LeaseDuration time first. - # In the default scaffold provided, the program ends immediately after - # the manager stops, so would be fine to enable this option. However, - # if you are doing or is intended to do any operation such as perform cleanups - # after the manager stops then its usage might be unsafe. - # leaderElectionReleaseOnCancel: true -kind: ConfigMap -metadata: - name: falcon-operator-manager-config - namespace: falcon-operator ---- apiVersion: apps/v1 kind: Deployment metadata: @@ -3767,7 +3738,7 @@ spec: - linux containers: - args: - - --config=controller_manager_config.yaml + - --leader-elect command: - /manager env: @@ -3803,16 +3774,8 @@ spec: drop: - ALL privileged: false - volumeMounts: - - mountPath: /controller_manager_config.yaml - name: manager-config - subPath: controller_manager_config.yaml securityContext: fsGroup: 65534 runAsNonRoot: true serviceAccountName: falcon-operator-controller-manager terminationGracePeriodSeconds: 10 - volumes: - - configMap: - name: falcon-operator-manager-config - name: manager-config