feat: add configHash field to Cluster (#25311)#27657
feat: add configHash field to Cluster (#25311)#27657matmil-dev wants to merge 5 commits intoargoproj:masterfrom
Conversation
🔴 Preview Environment stopped on BunnyshellSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #27657 +/- ##
=======================================
Coverage 63.83% 63.83%
=======================================
Files 418 418
Lines 57237 57257 +20
=======================================
+ Hits 36537 36552 +15
+ Misses 17292 17291 -1
- Partials 3408 3414 +6 ☔ View full report in Codecov by Sentry. |
d6b2370 to
47c01f9
Compare
ppapapetrou76
left a comment
There was a problem hiding this comment.
I have few concerns / questions regarding the overall implementation
- the term
generationin k8s is used as a increasing integer tied to the persisted spec.. Here the code uses a field with the same name as a content hash living in ephemeral cache. So this semantically misleading and I would suggest to change the field nane to something likeidentityHashorconfigHashetc. - this PR changes the publc API so this should be documented in the upgrade notes IMHO
- I'm also worreid about placing this field in ClusterInfo and not in the Cluster spec itself. The ClusterInfo is a cached-layer that resets so I'm wondering if we really want to put it here.
ppapapetrou76
left a comment
There was a problem hiding this comment.
one more thing that I missed in my previous review
cluster.Info.Generation is never populated from the DB because Info is not persisted in the Kubernetes secret. The cluster.Info.Generation + 1 fallback in getUpdatedClusterInfo is always equal to 0 + 1 = 1,
With that said the test named falls back to existing generation plus one when cluster has existing generation tests something that cannot be reproduced in production
|
Thanks for the quick review!
Yep, I mentioned this in a comment on the issue, I'll paste it here for posterity:
I'm fine with whichever name seems the most suitable. I'm partial to your
Will make the change. I presume this would end up in 3.5?
My motivation for that was that it seemed to fit in with the other information in ClusterInfo such as the Some other open questions I left on the issue which I would also like to surface here:
|
Signed-off-by: Mateja Milošević <mateja@matmil.dev>
Signed-off-by: Mateja Milošević <mateja@matmil.dev>
Signed-off-by: Mateja Milošević <mateja@matmil.dev>
Signed-off-by: Mateja Milošević <mateja@matmil.dev>
Signed-off-by: Mateja Milošević <mateja@matmil.dev>
47c01f9 to
a4abd64
Compare
|
I've pushed an update to change over to a If the backing secret is edited directly, either using kubectl or some other mechanism, the system, as currently architected, has no opportunity to persist a new value for the hash immediately after the edit. Edits made through other means are fine and a new hash is immediately calculated and persisted. This effectively means that the secret itself will contain a stale value for the hash (if the edits made to the secret involved the config), even though a correct updated value will be disseminated to consumers using the API or CLI (as per the current implementation which recalculates the hash on every I personally dislike this behavior, but I am not sure it's avoidable without making major changes to the cluster secret persistence flow to allow rewriting the secret directly after an edit is observed via the |
Closes #25311.
As discussed in issue #25311, this PR adds a
configHashfield to the Cluster structure which would aid external observers in detecting changes to Cluster configurations, since watching the respective Cluster API response is not a reliable approach due to certain sensitive fields being redacted.Pending further discussion on the issue.
As I am a first-time contributor, I am not sure of how this feature fits into the "feature status" framework. I suppose it should be marked as alpha, but I am not sure the scope of the changes is large enough to even warrant this, so I would appreciate guidance.
Checklist: