Skip to content

Commit da12258

Browse files
fmountclaude
andcommitted
Watch ConfigMap with global defaults produced by openstack-operator
As part of the TLSProfile inheritance effort, this patch implements the "consumer" side of the feature in watcher-operator. The openstack-operator reads the cluster TLSSecurityProfile and publishes it in a well-known ConfigMap that lib-common merges into the ConfigOptions of every rendered Template through ApplyTemplateDefaults. A watcher on that ConfigMap is registered through the generic interface lib-common provides, so watcher re-renders its configuration whenever the cluster-wide TLS defaults change. The reconciler lacked read access to ConfigMaps, so the rbac marker and the generated role are extended with get/list/watch. Co-Authored-By: Claude Code <noreply@anthropic.com> Signed-off-by: Francesco Pantano <fpantano@redhat.com>
1 parent 345d753 commit da12258

6 files changed

Lines changed: 23 additions & 9 deletions

File tree

‎api/go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.26.3
44

55
require (
66
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20261109153811-12c94c172a56
7-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261113070913-5152d1d626f9
7+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261120143313-344125315151
88
k8s.io/api v0.33.13
99
k8s.io/apimachinery v0.33.13
1010
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d

‎api/go.sum‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ github.com/onsi/gomega v1.44.0 h1:eAiGl3Pw5jz5GQdDff0BcxYpAX1JxW8xD7mFUuwNfZQ=
7878
github.com/onsi/gomega v1.44.0/go.mod h1:e/C2HwaZ1DhvjzXXuFhcR7hY7Sh9pl7MmoWKEjzwcdA=
7979
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20261109153811-12c94c172a56 h1:BRXqaAKNa6FuspElWEh0xuIZ8+puNBen3vHVj8y2ohw=
8080
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20261109153811-12c94c172a56/go.mod h1:NgRoCE/or9N5vCCpA5ik99TJZH4IOVnrl9b1LS4p+II=
81-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261113070913-5152d1d626f9 h1:SnR2m0LHH1k+qHT1HSwwx5c7Lc6r1U8PIQpiUj60qrw=
82-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:Bs95wrakWtl9bWhWVIuN54hE8+IILqRU0QH+/AjGlDo=
81+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261120143313-344125315151 h1:TJGE7ZvQ961zcVexdJZBLSZoxLsZa2Q0xBwZTLmEQps=
82+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261120143313-344125315151/go.mod h1:Bs95wrakWtl9bWhWVIuN54hE8+IILqRU0QH+/AjGlDo=
8383
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
8484
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
8585
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

‎config/rbac/role.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ kind: ClusterRole
44
metadata:
55
name: manager-role
66
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- configmaps
11+
verbs:
12+
- get
13+
- list
14+
- watch
715
- apiGroups:
816
- ""
917
resources:

‎go.mod‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ require (
1010
github.com/openshift/api v3.9.0+incompatible
1111
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20261109153811-12c94c172a56
1212
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20261112104408-51d8260ce753
13-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261113070913-5152d1d626f9
14-
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20261113070913-5152d1d626f9
13+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261120143313-344125315151
14+
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20261120143313-344125315151
1515
github.com/openstack-k8s-operators/lib-common/modules/users v0.0.0-20261113070913-5152d1d626f9
1616
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20261107161448-1a1c03d292f5
1717
github.com/openstack-k8s-operators/watcher-operator/api v0.0.0-00010101000000-000000000000

‎go.sum‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20261109153811-1
120120
github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20261109153811-12c94c172a56/go.mod h1:NgRoCE/or9N5vCCpA5ik99TJZH4IOVnrl9b1LS4p+II=
121121
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20261112104408-51d8260ce753 h1:IGJucK7jKBLRAPre2qxBM8LZa+Je1eIagDqxLujrexA=
122122
github.com/openstack-k8s-operators/keystone-operator/api v0.6.1-0.20261112104408-51d8260ce753/go.mod h1:bH2zBjst8As72ETxOG6/HycGemlYG46EkUb++rqP93g=
123-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261113070913-5152d1d626f9 h1:SnR2m0LHH1k+qHT1HSwwx5c7Lc6r1U8PIQpiUj60qrw=
124-
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:Bs95wrakWtl9bWhWVIuN54hE8+IILqRU0QH+/AjGlDo=
123+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261120143313-344125315151 h1:TJGE7ZvQ961zcVexdJZBLSZoxLsZa2Q0xBwZTLmEQps=
124+
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20261120143313-344125315151/go.mod h1:Bs95wrakWtl9bWhWVIuN54hE8+IILqRU0QH+/AjGlDo=
125125
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20261111093153-d3e5c656b371 h1:e+XFyE18cx6wQDFJ9WkuRzQ/cQ2q/DUYSYaPg4rz5xo=
126126
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20261111093153-d3e5c656b371/go.mod h1:Jd4fWlkX+mMlAyY4I8TM1NAc2EJVUbJNmtKLIuXvBq0=
127127
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20261111093153-d3e5c656b371 h1:k5jn1VThgF/7/umUxYFSQakI1iQVRWhyknXxJ+WaPcY=
128128
github.com/openstack-k8s-operators/lib-common/modules/storage v0.6.1-0.20261111093153-d3e5c656b371/go.mod h1:a7cwXeo63Ce+d/BoQnfK5Qnwxi6B18F7zZlRvSd4XXA=
129-
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20261113070913-5152d1d626f9 h1:zdLGDWn8gHxLR6DgZmfq3pXx7Z7/27Uz2Ua/093K7Ks=
130-
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20261113070913-5152d1d626f9/go.mod h1:n8vhem98f8sW/Yd4KFmngEHA04kWWNI/WZ9mTG9tOSo=
129+
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20261120143313-344125315151 h1:3bdhq6LB7+TXcaBN9GbL0pI/upt5SGIlGNEYMdm7BUs=
130+
github.com/openstack-k8s-operators/lib-common/modules/test v0.6.1-0.20261120143313-344125315151/go.mod h1:n8vhem98f8sW/Yd4KFmngEHA04kWWNI/WZ9mTG9tOSo=
131131
github.com/openstack-k8s-operators/lib-common/modules/users v0.0.0-20261113070913-5152d1d626f9 h1:jnyHfNDI76L31tZqsCO8DyfcB8AdAL8RQsq4UnZeZKE=
132132
github.com/openstack-k8s-operators/lib-common/modules/users v0.0.0-20261113070913-5152d1d626f9/go.mod h1:jmVVRfwuFQ3fHLIOAkUrtLgOwEL6j45POzS3PBJuwyM=
133133
github.com/openstack-k8s-operators/mariadb-operator/api v0.6.1-0.20261107161448-1a1c03d292f5 h1:LTh4uEIohVKYNt08vbvJMzplmDWVqZ1GBK7vY7hu2RA=

‎internal/controller/watcherapi_controller.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func (r *WatcherAPIReconciler) GetLogger(ctx context.Context) logr.Logger {
7575
//+kubebuilder:rbac:groups=watcher.openstack.org,resources=watcherapis/status,verbs=get;update;patch
7676
//+kubebuilder:rbac:groups=watcher.openstack.org,resources=watcherapis/finalizers,verbs=update
7777
//+kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch;create;update;patch;delete;
78+
//+kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;
7879
//+kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete;
7980
//+kubebuilder:rbac:groups=keystone.openstack.org,resources=keystoneapis,verbs=get;list;watch;
8081
//+kubebuilder:rbac:groups=keystone.openstack.org,resources=keystoneservices,verbs=get;list;watch;create;update;patch;delete;
@@ -997,6 +998,11 @@ func (r *WatcherAPIReconciler) SetupWithManager(mgr ctrl.Manager) error {
997998
Watches(&keystonev1.KeystoneAPI{},
998999
handler.EnqueueRequestsFromMapFunc(r.findObjectForSrc),
9991000
builder.WithPredicates(keystonev1.KeystoneAPIStatusChangedPredicate)).
1001+
// Reconcile when the well-known TLS profile ConfigMap maintained by
1002+
// the openstack-operator changes, so rendered configs pick up the
1003+
// new cluster-wide TLS defaults.
1004+
Watches(&corev1.ConfigMap{},
1005+
util.WatchDefaultTemplateConfigMap(r.Client, &watcherv1beta1.WatcherAPI{})).
10001006
Complete(r)
10011007
}
10021008

0 commit comments

Comments
 (0)