You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What would be the best way to update json tag in CR struct spec, and keep compatibility at the same time?
Now I have an existing CR in a running server:
spec:
oldKey: true
If I change json tag to a newKey in the struct, and update custom resource, it is replaced with a new one, however, it has the default value, since oldKey wasn't found when CR was retrieved:
spec:
newKey: false
How can I keep backward compatibility, ie update oldKey with newKey, keeping the same value? It is not possible to have several json tags in a struct. Are there any best practices here?
The text was updated successfully, but these errors were encountered:
@eivantsov If I understand correctly you are trying to update the API/spec fields of your CRD, but you still want to handle older instances of the CRD with the older API and convert them to the new API.
@hasbro17 yes, it looks like I asked if versioning is the best solution. I tried to add a new API version + migration function, and it worked for me. Thanks for helpful links. CLosing.
Type of question
What would be the best way to update json tag in CR struct spec, and keep compatibility at the same time?
Now I have an existing CR in a running server:
If I change json tag to a
newKey
in the struct, and update custom resource, it is replaced with a new one, however, it has the default value, since oldKey wasn't found when CR was retrieved:How can I keep backward compatibility, ie update oldKey with newKey, keeping the same value? It is not possible to have several json tags in a struct. Are there any best practices here?
The text was updated successfully, but these errors were encountered: