Repository navigation
feat: set the API's update strategy - #306
Conversation
Add the value tesk.strategy, rendered into the API Deployment's spec.strategy, with the default type Recreate: one upgrade that brings tesk-api 2.0.0 and taskmaster 0.12.0 must not leave an old API pod serving tasks of the new taskmaster. Null leaves Kubernetes' default (RollingUpdate), as before. The schema closes the map and checks the type; the template fails on rollingUpdate with Recreate. Refs #305 Co-Authored-By: Claude Opus 5.5 <[email protected]>
After the installation, upgrade the release to Kubernetes' default strategy (as charts up to 0.3.0 had) and back to the chart's default, and check that the Deployment ends up with type Recreate only. Refs #305 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add tesk.strategy to the configuration reference, and explain in the upgrade notes why the default is Recreate, and how operators who upgrade in two steps can keep RollingUpdate. Refs #305 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kubernetes rejects any rollingUpdate with Recreate, also an empty one. Test explicit Recreate, empty maps and null rollingUpdate; correct the schema description (an empty map keeps the default). The kind step also checks that Kubernetes set a rollingUpdate before the upgrade, and reports both checks the same way. Refs #305 Co-Authored-By: Claude Opus 5.5 <[email protected]>
With server-side apply (Helm 4, Flux, Argo CD), Kubernetes keeps the defaulted rollingUpdate and the upgrade to Recreate fails (checked on kind): document a one-time kubectl patch. Mention the downtime in the deployment guide and the chart README. Refs #305 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The startup probe doesn't bound the downtime; the patch is needed only for releases of charts up to 0.3.0 upgraded with server-side apply. Refs #305 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideAPIDefine and validate the public
ImplementationRender the API Deployment strategy and reject
ConfigurationSet
DocumentationExplain the strategy’s upgrade-safety rationale, downtime implications,
TestsExercise the strategy defaults, overrides, null and invalid combinations, plus the chart-install upgrade from Kubernetes’ default strategy back to
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #306 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 422 422
=========================================
Hits 422 422 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Linked issuesChecked at commit c0311ac #305 feat: set the API's update strategy (Recreate) · 4 of 4 met
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/actions/install-chart/action.yml" line_range="52" />
<code_context>
+ run: |
+ strategy() {
+ kubectl get deployment tesk-api -n "${NAMESPACE}" \
+ -o jsonpath='{.spec.strategy}'
+ }
+ helm upgrade tesk charts/tesk --namespace "${NAMESPACE}" \
</code_context>
<issue_to_address>
**Strategy check rejects valid deployments**
When the strategy is retrieved with kubectl’s default JSONPath printer, `strategy()` captures the strategy as Go-style map text, so `jq` cannot parse `before` and the upgrade strategy check exits with an error, even when the Deployment has the expected strategy.
Have `strategy()` emit valid JSON for the selected strategy before passing it to `jq`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and with Recreate, each API rollout stops the old pod before the replacement is ready, so clients can experience an API outage; reverting restores the prior rollout behavior, but cannot undo outages that already occurred.
Blocking findings: .github/actions/install-chart/action.yml:52
Summary
Makes chart upgrades safe for the new upgrade order (TESK API first, then the taskmaster): tesk-api 2.0.0 (elixir-cloud-aai/tesk-api#183) selects executor jobs by
taskmaster-name=<id>,job-type=executor, and the taskmaster of tesk-core 0.12.0 also labels the filer jobs withtaskmaster-name(elixir-cloud-aai/tesk-core#147). An older API pod that serves tasks of the new taskmaster reports wrong states, and in this chart onehelm upgradeswitches the API and the taskmaster together.tesk.strategy(the API Deployment'sspec.strategy), defaulttype: Recreate;type: RollingUpdate(withrollingUpdate) for operators who upgrade in two steps; null leaves Kubernetes' default, as charts up to 0.3.0 did.values.schema.jsoncloses the map (typeenum,rollingUpdate.maxSurge/maxUnavailableint or string); the template fails on anyrollingUpdatewithRecreate, which Kubernetes rejects..github/actions/install-chart(CI and release): after the install, upgrade to Kubernetes' default strategy and back, and check that the Deployment ends up with{"type": "Recreate"}.values.yaml, configuration reference, upgrade notes (why, the two-step alternative, and a one-timekubectl patchfor server-side apply), deployment guide and chart README (downtime on every rollout).appVersionare left for the release-train PR after the tags.Verification
helm lint charts/tesk --strict(Helm 3.22.1): passed.REQUIRE_HELM=1 pytest(all tests, includingtests/test_chart.py): 805 passed before the review fixes; after them,pytest tests/test_chart.py -k "strategy or schema": 73 passed. The new tests failed before the implementation.pre-commit run --all-files: passed.mkdocs build --strict: passed.install-chart, run against a release: passed, ending with{"type":"Recreate"}.RollingUpdate,rollingUpdate25%/25%) to the new default: works, asretainKeysdropsrollingUpdate.kubectl apply --server-sideof the rendered Deployment) of the same upgrade: fails withspec.strategy.rollingUpdate: Forbidden, also whenrollingUpdate: nullis rendered; removing onlyrollingUpdategets re-defaulted. The documentedkubectl patch --type=jsonthat replaces/spec/strategywith{"type": "Recreate"}works, and the server-side apply then succeeds. CI covers only the Helm 3 path.Declined review findings
rollingUpdaterule in the schema (if/then): the schema can't see the merged default, so the template check stays the single place.Open questions
None.
Closes #305
🤖 Generated with Claude Code
Summary by Sourcery
Set the API Deployment to use a safe Recreate strategy by default while providing validated alternatives for operators who require rolling upgrades.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: