New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watching all v1.Secrets in parallel of watching CRD #694
Comments
@prune998 If I'm following, it sounds like you can use just one controller that has two watches:
If you aren't already, you may also want to use owner references on the opaque merged secrets and another watch with
|
Thanks @joelanford for this help. I'm already using I'm now stuck where the controler who's watching for |
@joelanford, I just tested |
Correct,
I don't think you would need to check. In the mapper function for |
Sounds you gave me the solution @joelanford. It's now fully working. My concern now is that the Reconcile seem to be triggered more than once for the same API change..
As you can see the removal of secret |
Is this issue only happening on deletes? On a delete, objects may get updated multiple times by Kubernetes and other controllers (e.g. setting The other thing that you may notice is that when the merged secrets are created or updated by the operator, I'm pretty sure your map function will be triggered (since its watching all secrets). So you'll probably want to ignore those in the map function since they'll be handled by the |
Yep. |
No problem! Glad I could help. |
@joelanford if you get this, maybe you could help me again... I'm trying to use
I would like to compare the Secrets Data (name and base64 value) of the old and new to see if something change. I can't find a way to access the data inside the runtime.Object Thanks ! |
@prune998 you can use a type assertion to get the |
Well, I was trying to use type assertion without success when I reached to you but I finaly got it working ! |
I've released my operator and blogged about it. Comments welcome :) |
Type of question
how to implement a specific feature
Question
I'm building an operator which, depending on the CR definition, will merge some TLS Secrets into another Opaque Secret, one file per merged secret.
I'v done the part of creating the CRD, watching for it and for Operator created secrets.
Every time a secret is created/updated, I also need to find out if it matches one of the CR
search
definition (by labels), and if it does, trigger the re-creation (by enqueueing the CR to the Reconcile)I'm stuck with the last part.
Should I create a new Controler to watch for
v1.Secret
?Should I add a
EnqueueRequestForObject
in my CRD controler ?Maybe there's a irc/forum/slack where I could get some help ?
Thanks.
Environment
operator-sdk version: v0.1.0+git
Kubernetes version information:
The text was updated successfully, but these errors were encountered: