Repository navigation
api: stop redeploying services when nothing in the spec changed - #9
Merged
Merged
Conversation
The deployment check compared the stored resource definition with the new one using reflect.DeepEqual. Empty hosts, ports and volumes lists are read back from storage as nil, but the newly built spec has empty slices, so the two never matched. That made any service update, renames included, look like a spec change and restart the service. The check now uses Kubernetes semantic equality, which treats nil and empty slices as equal. This replaces the special case that only covered volumes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Renaming a service, or making any other update that leaves the spec alone, restarted the service.
NeedsDeploymentcompared the stored resource definition with the new one usingreflect.DeepEqual. Empty hosts, ports and volumes lists come back from storage asnil, but the new spec builds them as empty slices. Because of that the two specs never matched, so every update counted as a spec change and set off a redeploy.equality.Semantic.DeepEqualfromk8s.io/apimachineryfor the spec, GitHub installation ID and database config checks. It treatsniland empty slices as equal.nilvolumes into an empty slice. It only covered volumes.Testing
NeedsDeployment No Hosts Or Portscase toTestNeedsDeployment. A service with no hosts, ports or volumes now returnsNoDeploymentNeeded. Adding a port still returnsNeedsDeployment.