Controller read resource another controller #3172
-
I'm creating the controller with Kubebuilder. The first controller has resource and the second controller doesn't resource. My Question, How can second controller read the resource from first controller? or. How I get the namespace that the controller will be create? different the namespace that resource will create? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, you can achieve that. However, to implement this solution, you'll also need to manage a second Kind created in your project. You'll watch this, and manage it similarly to how you'd handle a deployment. The code utilizes the outdated watch syntax. Now, it's recommended to use the builder pattern. While the current layout is no longer supported, you can find an example in the postgresql-operator project. In this project, the Kind responsible for creating the cronjob observes the Kind that represents the database on the cluster. Closing this one as sorted out. |
Beta Was this translation helpful? Give feedback.
Yes, you can achieve that.
You're looking to create a controller primarily responsible for managing a principal Kind (e.g., MyKind). This will be your main controller for this Kind.
However, to implement this solution, you'll also need to manage a second Kind created in your project. You'll watch this, and manage it similarly to how you'd handle a deployment.
The code utilizes the outdated watch syntax. Now, it's recommended to use the builder pattern. While the current layout is no longer supported, you can find an example in the postgresql-operator project. In this project, the Kind responsible for creating the cronjob observes the Kind that represents the database on the cluster.
Closi…