Skip to content

Commit 69a74fd

Browse files
committed
CM-716: Address review feedback - RBAC, predicate, and label fixes
- Remove unused MachineConfig/MachineConfiguration RBAC rules from the HTTP01Proxy ClusterRole (the controller never touches MCO APIs) - Remove GenerationChangedPredicate from the primary HTTP01Proxy watch so deletion/finalizer events are not filtered out - Merge resource labels into DaemonSet pod template using maps.Copy instead of overwriting to preserve asset-defined labels
1 parent 6bf13d6 commit 69a74fd

4 files changed

Lines changed: 6 additions & 32 deletions

File tree

bindata/http01-proxy/cert-manager-http01-proxy-clusterrole.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,3 @@ rules:
1717
- get
1818
- list
1919
- watch
20-
- apiGroups:
21-
- operator.openshift.io
22-
resources:
23-
- machineconfigurations
24-
verbs:
25-
- update
26-
- apiGroups:
27-
- machineconfiguration.openshift.io
28-
resources:
29-
- machineconfigs
30-
verbs:
31-
- get
32-
- list
33-
- create
34-
- update

pkg/controller/http01proxy/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
102102
withIgnoreStatusUpdatePredicates := builder.WithPredicates(predicate.GenerationChangedPredicate{}, controllerManagedResources)
103103

104104
return ctrl.NewControllerManagedBy(mgr).
105-
For(&v1alpha1.HTTP01Proxy{}, builder.WithPredicates(predicate.GenerationChangedPredicate{})).
105+
For(&v1alpha1.HTTP01Proxy{}).
106106
Named(ControllerName).
107107
Watches(&appsv1.DaemonSet{}, handler.EnqueueRequestsFromMapFunc(mapFunc), withIgnoreStatusUpdatePredicates).
108108
Watches(&rbacv1.ClusterRole{}, handler.EnqueueRequestsFromMapFunc(mapFunc), controllerManagedResourcePredicates).

pkg/controller/http01proxy/daemonsets.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package http01proxy
22

33
import (
44
"fmt"
5+
"maps"
56
"os"
67
"strconv"
78

@@ -33,7 +34,10 @@ func (r *Reconciler) getDaemonSetObject(proxy *v1alpha1.HTTP01Proxy, resourceLab
3334

3435
ds.SetNamespace(proxy.GetNamespace())
3536
common.UpdateResourceLabels(ds, resourceLabels)
36-
ds.Spec.Template.Labels = resourceLabels
37+
if ds.Spec.Template.Labels == nil {
38+
ds.Spec.Template.Labels = make(map[string]string)
39+
}
40+
maps.Copy(ds.Spec.Template.Labels, resourceLabels)
3741

3842
// Update image
3943
image := os.Getenv(http01proxyImageNameEnvVarName)

pkg/operator/assets/bindata.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)