Sharing data between reconcilers ?

11 views
Skip to first unread message

Pieter Voet

unread,
Jul 29, 2025, 4:32:44 AMJul 29
to Operator Framework
Hi all,

I recently converted my operator from single-group to multi-group, because I want the operator to handle another CustomResource (CR).
In single-group mode, I have a singleton data structure,  to have just one ClientSet per K8S type..  I now try to share that data structure between the two reconcilers..

First question is : am I on the wrong track ? 
Second question : if sharing data is allowed, how do I do that ?
 
( so far I tried creating  the Manager with a BaseContext Option where I stuffed my data structure in  , using context.WithValue(), but then the reconcilers apparently do not have that context.. )

Thanks for any help !

Pieter Voet

unread,
Jul 29, 2025, 5:09:29 AMJul 29
to Operator Framework
Ah, easy after all...  where 'cmd/main.go'  calls 'SetupWithManager(mgr)'  , I just added an extra parameter.

Question remains : is this good practice ?
Thanks
Op dinsdag 29 juli 2025 om 10:32:44 UTC+2 schreef Pieter Voet:
Reply all
Reply to author
Forward
0 new messages