Skip to content

Commit 3510c2b

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 instead of overwriting to preserve asset-defined labels like app.kubernetes.io/*
1 parent 6bf13d6 commit 3510c2b

4 files changed

Lines changed: 7 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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ func (r *Reconciler) getDaemonSetObject(proxy *v1alpha1.HTTP01Proxy, resourceLab
3333

3434
ds.SetNamespace(proxy.GetNamespace())
3535
common.UpdateResourceLabels(ds, resourceLabels)
36-
ds.Spec.Template.Labels = resourceLabels
36+
if ds.Spec.Template.Labels == nil {
37+
ds.Spec.Template.Labels = map[string]string{}
38+
}
39+
for k, v := range resourceLabels {
40+
ds.Spec.Template.Labels[k] = v
41+
}
3742

3843
// Update image
3944
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)