Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Context
tigera-operator configures the eck-operator to deploy a StatefulSet by specifying a NodeSet in the Elasticsearch CR. The name of the resulting StatefulSet is the name of the NodeSet.
tigera-operator sets the NodeSet name by hashing the PersistentVolumeClaim template of the NodeSet.
This ensures that if the PVC template changes as a result of LogStorage changes, a new name for the NodeSet is generated, which creates a new StatefulSet with the new PVC template (rather than updating the existing StatefulSet).
A new StatefulSet must be created, since a StatefulSet's PVC template can not be updated after the StatefulSet has been created.
Issue
The upgrade of k8s.io/apimachinery to v0.34.3 has changed how k8s objects serialize. Specifically,
creationTimestampnow has anomitzerojson tag. This change has resulted in the same PersistentVolumeClaim resulting in different hashes depending on the version of tigera-operator (and what version of apimachinery it uses)The primary impact here is that when users upgrade Calico Enteprise to a newer version, which has an operator with apimachinery >= v0.34.3, tigera-operator computes a different name for the NodeSet (due to the serialization change), and this triggers a new StatefulSet and PVC to be created, even though no LogStorage properties changed.
This recreation could lead to one of two things:
Proposal
This PR changes the behaviour of NodeSet name generation as follows:
This has the key property of retaining the existing NodeSet name, regardless of how it was generated, if the existing PVC in the NodeSet matches the configuration found in LogStorage.
Alternative approaches
It was attempted to simply augment the serialization to retain the
creationTimestamp: nullthat previous versions of apimachinery would create. Unfortunately all attempted approaches resulted in field orders changing, which also meant a different hash.Release Note
For PR author
make gen-filesmake gen-versionsFor PR reviewers
A note for code reviewers - all pull requests must have the following:
kind/bugif this is a bugfix.kind/enhancementif this is a a new feature.enterpriseif this PR applies to Calico Enterprise only.