Closed djdongjin closed 2 years ago
I think we can do that operation by multiple options.
option 1: patch manifest by kustomize
guestbook-operator is set with WithApplyKustomize
at here.
So you can patch target manifest by the way kustomize can.
I created sample codebase which add kustomize patch, please refer this.
I think it's easier way than next one.
option 2: implement a func for used by WithObjectTransform
We can implement any functions for manipulating a target manifest in Go code.
It's more flexible way than previous one, because this way can implement any logics as you like.
But it's more complicated, I think.
I'm not sure that which one is better for your requirement, but maybe option 2 is better because your requirement seems to have some logics depending on complicated condtion.
@atoato88 thanks for the suggestion! I finally figured it out using the WithObjectTransform
and MutatePodSpec
here
You're welcome, and thank you for sharing your solution. 😉
Hi, I have a question about reconcilers built based on kubebuild-declarative-pattern. Suppose I want that in the reconcile loop, the reconciler should read an annotation from a namespace and based on that annotation value, add a node-affinity (or any other deployment change) to the deployment it creates. Is it possible? Thanks! For example:
Basically, the question is how to make some customization to the generated reconclier.