Skip to content

feat: configurable k8s restart targets (services list + etl cronjob) - #12

Merged
JoshuaHarris391 merged 1 commit into
mainfrom
feat/configurable-restarts
Aug 19, 2026
Merged

feat: configurable k8s restart targets (services list + etl cronjob)#12
JoshuaHarris391 merged 1 commit into
mainfrom
feat/configurable-restarts

Conversation

@JoshuaHarris391

Copy link
Copy Markdown
Collaborator

Companion to AustralianBioCommons/aws-gen3-pipeline#8. The k8s restart targets — previously hardcoded in the k8s_ops scripts, in two different orders — now resolve with precedence CLI flags > SSM > classic defaults.

What

  • EnvConfig gains restart_services (comma-separated, restarted serially in order) and etl_cronjob, resolved from the optional SSM facts app/restart_services / app/etl_cronjob via the existing _app_or_default mechanism; script_env exports them as G3DT_RESTART_SERVICES / G3DT_ETL_CRONJOB.
  • The scripts take those env vars as their defaults, so every call path — k8s restart-schema, restart-etl, restart-ms, dict deploy, synth deploy — picks up the configured targets with no per-caller plumbing. restart_etl_and_ms.sh drops its divergent hardcoded -r list (order now unified with the schema list).
  • New per-run override flags: --restart-services on restart-schema/restart-ms/dict deploy/synth deploy, --etl-cronjob on restart-etl/restart-ms/synth deploy. -r on the raw scripts still wins over everything.
  • Legacy NAMESPACE="cad" default removed — the schema/ms scripts now fail fast when no namespace is given (via -n or G3DT_NAMESPACE) instead of silently targeting another project's namespace.
  • config show prints restart_services / etl_cronjob; config diff compares the optional k8s block when the config file defines it.

End-to-end tests

New tests/test_restart_scripts_sh.py runs the real scripts with stubbed argocd/jq/kubectl/sleep, pinning: the restart order for a custom subset (the omix3 shape — no portal), the classic four when nothing is configured, -r beating the env var, the namespace fail-fast, and the etl cronjob name reaching kubectl create job --from=cronjob/<name>.

376/376 tests green. pyproject.toml -> 3.5.0 (minor; pre-k8s-block environments keep the classic behaviour).

The microservice restart set and the ETL cronjob name were hardcoded in
the k8s_ops scripts (sheepdog/peregrine/guppy/portal, etl-cronjob), in
two different orders across scripts. They now resolve with precedence
CLI flags > SSM > default: the CDK's optional k8s config block publishes
app/restart_services (comma-separated, restarted serially in order) and
app/etl_cronjob; new --restart-services / --etl-cronjob flags on
k8s restart-schema / restart-etl / restart-ms, dict deploy, and
synth deploy override them per run; and environments deployed without
the block keep the classic Gen3 set. This lets a commons that manages a
service outside this flow (e.g. omix3's manually redeployed frontend)
simply omit it from its wrapper config.

The scripts read $G3DT_RESTART_SERVICES / $G3DT_ETL_CRONJOB as their
defaults so every call path picks the values up without per-caller
plumbing; restart_etl_and_ms.sh drops its divergent hardcoded -r list.
Also removes the legacy "cad" namespace default -- the scripts now fail
fast when no namespace is given instead of silently targeting another
project's namespace.

config show prints restart_services/etl_cronjob; config diff compares
the optional k8s block when the config file defines it. New end-to-end
tests run the real scripts with stubbed argocd/jq/kubectl and pin the
restart order, the flag-beats-env precedence, and the namespace guard.
@JoshuaHarris391
JoshuaHarris391 merged commit daee1ed into main Aug 19, 2026
1 check 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