-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Update mechanism for objects #537
Comments
I am sorry @eivantsov I might not be following. Let me re-state what I am hearing and then answer in case I don't understand. I think you're asking that if an operator image has differences than the previous version that you currently need to update the CR during the reconciliation loop and your wondering if there is a better way? I don't see any mechanism besides your operator to make decisions on what has changed and what should be updated. @hasbro17 can you double check this statement? If instead we are discussing versioning the CRD, I think that this is the issue that you may be interested in following. |
@shawn-hurley yes, you got it right. In fact, in my case, the operator should always check for updates, without any checks, like if the image changed or anything in pod spec. So, using sdk.Update() is the right way to go in the reconcile process? I create objects unless they exist and then update them. If they are identical, nothing happens, if there are changes objects are recreated. |
I believe that it might be worth checking only the fields that you want to check to determine if they are the same and allow Kube to manage the other stuff. For example, there are some defaults that you probably want but don't want to add to your pod definition in the code. You might also be able to use Another thing that you could do, is using this function from the controller runtime. Of course, this is after the refactor to use controller runtime. I am going to close this, please feel free to re-open if I didn't answer the question completely. |
@shawn-hurley thanks |
My operator creates over a dozen of objects of all possible kinds: services, routes, pvcs, deployments, role bindings, service accounts.
If a new version of an operator brings new image tags, envs to deployments or any other changes in objects I expect existing objects to be updated.
Currently, I need to run
sdk.Update()
on all of them to make sure that if the version of my operator introduces changes to the objects they will be applied.Is there perhaps a better way?
The text was updated successfully, but these errors were encountered: