Skip to content

Get previous custom resource version on update #279

Answered by buehler
Crespalvaro asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @Crespalvaro
I understand what you mean. It is theoretically possible. There are Kubernetes metadata fields that allow you to do such things (more or less). For example, when you apply the CRD with kubectl apply, the last used configuration of the entity is stored in an annotation kubectl.kubernetes.io/last-applied-configuration. It contains the last json that was applied.

However as @erin-allison pointed out, this is not the general idea of the reconciliation loop in the operator pattern. You should always check if the given state in the cluster matches the one that is described by the entity.

Now when I'm thinking about, the differentiation between "Created" and "Updated" is useless…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
3 replies
@Crespalvaro
Comment options

@erin-allison
Comment options

@Crespalvaro
Comment options

Comment options

You must be logged in to vote
2 replies
@Crespalvaro
Comment options

@buehler
Comment options

Answer selected by Crespalvaro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #278 on September 08, 2021 15:01.