Skip to content

feat: Add opt-in POST /maintenance/restart endpoint for k8s#54

Merged
ionos-landgraf-vin merged 2 commits into
mainfrom
feat/maintenance-restart
Apr 16, 2026
Merged

feat: Add opt-in POST /maintenance/restart endpoint for k8s#54
ionos-landgraf-vin merged 2 commits into
mainfrom
feat/maintenance-restart

Conversation

@ionos-landgraf-vin
Copy link
Copy Markdown
Collaborator

This pull request introduces a new optional maintenance endpoint for triggering rolling restarts in Kubernetes deployments. The main change is the addition of a POST /maintenance/restart endpoint, which allows for lightweight rolling restarts and automatic image re-pulls when used with imagePullPolicy: Always. The feature is opt-in, disabled by default, and can be enabled via a new CLI option and configuration. Documentation and tests are updated accordingly.

Maintenance Restart Endpoint Feature:

  • Added a new --enable-restart CLI option to enable the POST /maintenance/restart endpoint for triggering pod restarts in Kubernetes (lib/archsight/cli.rb, chart/archsight/values.yaml) [1] [2].
  • Implemented the restart endpoint and server restart logic in Archsight::Web::Application, including the perform_restart! method and endpoint handler (lib/archsight/web/application.rb).
  • Added configuration and helper methods to manage and check the restart_enabled setting (lib/archsight/web/application.rb) [1] [2].

Documentation:

  • Added clear documentation on how to enable and use the rolling restart endpoint in Kubernetes, including security notes and example usage (docs/kubernetes.md).

Testing:

  • Added tests to verify the behavior of the restart endpoint, both when enabled and disabled, in application_test.rb (test/web/application_test.rb).

…lling restarts

Enables lightweight deployments without kubectl: calling the endpoint shuts
down the server gracefully (SIGTERM), Kubernetes restarts the pod, and with
imagePullPolicy: Always the new image is pulled automatically.

The endpoint is disabled by default and must be opted in via --enable-restart
(CLI) or by appending it to the Helm chart args. Includes docs and tests.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in maintenance endpoint to trigger a Kubernetes pod restart by terminating the running web process, intended to support lightweight “restart to re-pull image” workflows when imagePullPolicy: Always is used.

Changes:

  • Added POST /maintenance/restart endpoint plus restart scheduling logic in the Sinatra app.
  • Added --enable-restart CLI flag / config wiring to toggle the endpoint (default off).
  • Updated Kubernetes documentation and added endpoint behavior tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/archsight/web/application.rb Introduces restart feature flag, restart implementation, and the new maintenance route.
lib/archsight/cli.rb Adds CLI option and wires it to the Sinatra setting.
test/web/application_test.rb Adds tests for disabled-by-default behavior and enabled restart behavior.
docs/kubernetes.md Documents how to enable and use the restart endpoint in Kubernetes.
chart/archsight/values.yaml Notes how to enable the flag via Helm args (documentation comment).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/archsight/web/application.rb
Comment thread lib/archsight/web/application.rb Outdated
- Add optional --restart-token / X-Restart-Token shared-secret check (401
  on mismatch) to prevent unauthenticated access to the restart endpoint
- Move shutdown thread spawn to an `after` filter so it fires after the
  response is fully assembled, not mid-handler
- Increase default shutdown delay to 2.0s and make it configurable via
  ARCHSIGHT_RESTART_SHUTDOWN_DELAY env var
- Update docs with token example, delay config, and security guidance
- Expand tests: token missing/wrong/correct cases + helper refactor

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@ionos-landgraf-vin ionos-landgraf-vin merged commit cdb76ac into main Apr 16, 2026
8 checks passed
@ionos-landgraf-vin ionos-landgraf-vin deleted the feat/maintenance-restart branch April 16, 2026 13:53
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.

2 participants