← 输入框|github.com|刷新
Skip to content

api: stop redeploying services when nothing in the spec changed - #9

Merged
yekta merged 1 commit into
masterfrom
fix/rename-triggers-service-restart
Oct 16, 2026
Merged

yekta merged 1 commit into
masterfrom
fix/rename-triggers-service-restart

Conversation

@yekta

@yekta yekta commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Renaming a service, or making any other update that leaves the spec alone, restarted the service.

NeedsDeployment compared the stored resource definition with the new one using reflect.DeepEqual. Empty hosts, ports and volumes lists come back from storage as nil, 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.

  • Use equality.Semantic.DeepEqual from k8s.io/apimachinery for the spec, GitHub installation ID and database config checks. It treats nil and empty slices as equal.
  • Remove the special case that turned nil volumes into an empty slice. It only covered volumes.

Testing

  • Added a NeedsDeployment No Hosts Or Ports case to TestNeedsDeployment. A service with no hosts, ports or volumes now returns NoDeploymentNeeded. Adding a port still returns NeedsDeployment.

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.
@yekta
yekta merged commit be32c91 into master Oct 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant