-
Bug
-
Resolution: Obsolete
-
Major
-
None
-
None
-
False
-
False
-
PSAP Sprint 208, PSAP Sprint 209, PSAP Sprint 210
-
undefined
In the main.go file in the main cluster-nfd-operator directory, a command line option exists for disabling leader election, and the default value indicates that leader election should be turned off. However, leader election is still enabled anyways:In the `main.go` file in the main directory, a command line option exists for disabling leader election, and the default value indicates that leader election should be turned off. However, leader election is still enabled anyways:
# oc logs pod/nfd-controller-manager-7cd8d54686-nllqc managerI0816 17:01:22.272019
1 main.go:55] Operator Version: 783214b0-dirtyI0816 17:01:23.326238
1 request.go:655] Throttling request took 1.021121017s, request: GET:https://172.30.0.1:443/apis/security.openshift.io/v1?timeout=32s2021-08-16T17:01:25.093Z INFO controller-runtime.metrics metrics server is starting to listen {"addr": "127.0.0.1:8080"}2021-08-16T17:01:25.094Z INFO setup starting managerI0816 17:01:25.094661
1 leaderelection.go:243] attempting to acquire leader lease openshift-nfd/39f5e5c3.nodefeaturediscoveries.nfd.kubernetes.io...2021-08-16T17:01:25.095Z INFO controller-runtime.manager starting metrics server {"path": "/metrics"}I0816 17:01:25.121966
1 leaderelection.go:253] successfully acquired lease openshift-nfd/39f5e5c3.nodefeaturediscoveries.nfd.kubernetes.io2021-08-16T17:01:25.122Z INFO controller-runtime.manager.controller.nodefeaturediscovery Starting EventSource {"reconciler group": "nfd.openshift.io", "reconciler kind": "NodeFeatureDiscovery", "source": "kind source: /, Kind="}2021-08-16T17:01:25.122Z DEBUG controller-runtime.manager.events Normal {"object":{"kind":"ConfigMap","namespace":"openshift-nfd","name":"39f5e5c3.nodefeaturediscoveries.nfd.kubernetes.io","uid":"e8ebfd1a-d7d7-44cc-9038-70bd5f1ae380","apiVersion":"v1","resourceVersion":"53680499"}, "reason": "LeaderElection", "message": "nfd-controller-manager-7cd8d54686-nllqc_c3d12674-228d-4747-9d07-f025b8aaf51e became leader"}2021-08-16T17:01:25.122Z DEBUG controller-runtime.manager.events Normal {"object":{"kind":"Lease","namespace":"openshift-nfd","name":"39f5e5c3.nodefeaturediscoveries.nfd.kubernetes.io","uid":"10ebb14c-84f8-42be-ae4c-9eef1316e853","apiVersion":"coordination.k8s.io/v1","resourceVersion":"53680500"}, "reason": "LeaderElection", "message": "nfd-controller-manager-7cd8d54686-nllqc_c3d12674-228d-4747-9d07-f025b8aaf51e became leader"}2021-08-16T17:01:25.223Z INFO controller-runtime.manager.controller.nodefeaturediscovery Starting EventSource {"reconciler group": "nfd.openshift.io", "reconciler kind": "NodeFeatureDiscovery", "source": "kind source: /, Kind="}```
{{ I think this problem occurs because `LeaderElectionID` is provided in the manager creation step:}}
{{ ``` mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{ Scheme: scheme, MetricsBindAddress: metricsAddr, Port: 9443, LeaderElection: enableLeaderElection, LeaderElectionID: "39f5e5c3.nodefeaturediscoveries.nfd.kubernetes.io", HealthProbeBindAddress: probeAddr, Namespace: watchNamespace, // namespaced-scope when the value is not an empty string })}}
**Acceptance Criteria**
- Create a PR to fix the operator's logic
- Ensure that all tests pass before merging into master