Commit Graph

61 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
96d726c43c fix: retire cron containers past their active deadline
Cron containers were never reaped once they exceeded their active deadline, so a hung cron task ran indefinitely instead of being retired after 24 hours as documented. `cron:run` now also accepts a `--ttl-seconds` argument, matching the one `dokku run` already takes.
2026-08-12 13:11:34 -04:00
Jose Diaz-Gonzalez
1d2c7424aa fix: do not require a local image for k3s deploys
Kubernetes pulls the app image itself, so a k3s host is free to reap its local copy while the workload keeps running, which the `registry` plugin already does on its own. Deploys, restarts, `dokku run`, and in-cluster cron no longer assert that the image is present locally, falling back to the metadata recorded in the app's current Helm release. A `ps:restart` naming a single process type now rolls only that process type's pods rather than silently redeploying every one. Apps with an `app.json` postdeploy task still require the image locally, as that task runs on the Dokku host.
2026-08-12 02:14:56 -04:00
Jose Diaz-Gonzalez
cd1089500b feat: translate docker-options --sysctl on the k3s scheduler
The `docker-local` scheduler supports `--sysctl` for free because docker options are passed verbatim to `docker run`, but the k3s scheduler silently dropped it. Namespaced sysctls now render into the pod's `securityContext.sysctls` for deployments, cron jobs, and one-off runs. A sysctl the kernel does not namespace fails the deploy instead of being dropped, since it cannot take effect within a pod regardless of what was requested.
2026-08-07 05:43:00 -04:00
Jose Diaz-Gonzalez
90831a5504 fix: guard k3s issuer template against absent values
The `issuer.yaml` chart template dereferenced `.Values.global.issuer.enabled` without guarding against the value being absent, which yaml serialization omitted for apps without a per-app email, causing a nil-pointer render error that broke every k3s web deploy.
2026-07-19 04:34:40 -04:00
Jose Diaz-Gonzalez
dc802ddd19 feat: support per-app letsencrypt emails on k3s
The `letsencrypt-email-prod` and `letsencrypt-email-stag` properties can now be set per app in addition to globally, resolving app-level before the global value for the app's selected `letsencrypt-server`. An app that sets its own email renders a namespaced cert-manager `Issuer` using that email, while apps without an override continue to use the shared `ClusterIssuer` with the global email.
2026-07-19 03:31:55 -04:00
Jose Diaz-Gonzalez
bf2cfe1886 fix: hash scheduler-k3s cron-id label to fit Kubernetes' 63-byte cap
The `dokku.com/cron-id` label could exceed Kubernetes' 63-byte cap because the cron ID is `base36(appName === command === schedule)`, which expands roughly 1.5x per byte. The label is now keyed `dokku.com/cron-hash` and holds the `sha1` hex digest of the cron-id, a fixed 40-character value that always fits the cap. The same hex digest is mirrored into the `dokku.com/cron-hash` annotation, and the original base36 cron-id stays in the `dokku.com/cron-id` annotation that `cron:list` reads when surfacing user-facing IDs. Per-task lookups stay server-side via label selectors, so `cron:set --maintenance` and the forbid/replace concurrency checks on `dokku run --cron-id` keep working without any in-memory filtering.
2026-05-24 16:52:22 -04:00
Jose Diaz-Gonzalez
b66df28d96 fix: harden scheduler-k3s cron manifests and dockerfile run startup
The cron-id label could exceed Kubernetes' 63-byte cap when commands or
schedules were long, and an all-digit job-suffix or cron-id rendered as
an unquoted YAML scalar caused the API server to reject manifests. Run
pods built from dockerfiles also occasionally hit the 10s startup wait
on a cold image pull, even though the pod was scheduled correctly.

The cron-id is now stored as an annotation and a shorter hash is used as
the selector label. Every interpolated annotation and label value in the
cron-job and deployment templates is now quoted to prevent numeric
coercion, and the run-pod wait timeout is raised to 30 seconds.
2026-05-11 14:49:58 -04:00
Jose Diaz-Gonzalez
cfb7da8ec0 feat: scheduler-k3s renders pvc-backed volumes from storage attachments
Adds a per-entry storage helm chart that owns the PVC and (when host_path is set) the PV, and three triggers for the storage plugin to drive: storage-create installs/upgrades the chart with storage-class existence validation, storage-destroy uninstalls it, storage-status reports the PVC phase. App deployment and cron-job charts now consume storage-app-mounts and reference each PVC by name; the // todo: implement volumes blocks are gone. ProcessVolume gained sub_path, read_only, and persistent_claim fields and the deployment/cron-job templates render them.
2026-04-29 14:49:15 -04:00
Jose Diaz-Gonzalez
ef9bdc0379 fix: split env config and image pull secret into separate helm releases
Bundling these Secrets in the app helm chart caused two bugs in the scheduler-k3s plugin: a chart rollback could delete Secrets that older ReplicaSets still referenced by exact timestamped name (`env-{app}.{ts}` and `ims-{app}.{ts}`), hard-crashing pods until manual intervention; and the strategic-merge `patchMergeKey` on `imagePullSecrets` let stale entries leak into the live Deployment until the list pointed at many nonexistent Secrets. Each Secret now lives in its own helm release with a stable name (`config-{app}` and `pull-secret-{app}`), installed before the app chart on every deploy. The deployment trigger also prunes any leaked `imagePullSecrets` entries from the live Deployment so the next deploy lands on a clean list, and the rename and destroy paths uninstall the new releases (and the previously-leaked TLS release on rename) under the old app name.
2026-04-29 12:18:03 -04:00
Jose Diaz-Gonzalez
b8e8ea74ff feat: use certificates imported by certs plugin when deploying via scheduler-k3s
Closes #7257
2026-01-08 01:05:40 -05:00
Jose Diaz-Gonzalez
99a1e2ee33 feat: default to running one-off k3s containers to a max of 1 day
This follows the standard enforced by Heroku.
2025-11-18 14:09:38 -05:00
Jose Diaz-Gonzalez
f38bc64119 feat: expose concurrency policy to kubernetes jobs 2025-11-10 03:07:29 -05:00
Jose Diaz-Gonzalez
c885205b91 refactor: respect the maintenance value of the cron task instead of skipping them
The former method would omit the CronJob objects entirely, meaning a redeploy would be necessary to re-enable them.
2025-11-09 23:16:38 -05:00
Jose Diaz-Gonzalez
f90a4061c0 feat: create SecurityContext for k3s scheduler from docker-options
Closes #7664
2025-09-12 18:09:33 -04:00
Jose Diaz-Gonzalez
65dd4bc1e0 feat: set shm-size volume/volumeMounts on kubernetes deployments 2025-03-06 22:59:35 -05:00
Jose Diaz-Gonzalez
50f8099ebb fix: allow autoscaling config to have zero min replicas 2024-11-15 23:11:54 -05:00
Jose Diaz-Gonzalez
b98863b6a7 feat: add support for the keda-http-add-on
Externally, it is treated the same as any other scaling trigger, but requires that the chart be installed in order for it to be supported.
2024-11-13 03:29:26 -05:00
Jose Diaz-Gonzalez
fd2cfe8080 fix: correctly pull the deployment id from an app's helm values when executing dokku run under the k3s scheduler
- Fix the internal identifier of deployment_id -> deployment_id
- Add tests for both enter and run.
2024-11-04 14:44:25 -05:00
Jose Diaz-Gonzalez
ac2ea7597e fix: use correct variable name 2024-03-12 06:11:28 -04:00
Jose Diaz-Gonzalez
d4b484a33a fix: replace existing port-map ingress objects with domain ingress objects
Domains cannot be reused across ingress objects, and port maps are a function of a domain, so the inversion here makes most sense (at the cost of some downtime when migrating.
2024-03-12 03:55:40 -04:00
Jose Diaz-Gonzalez
7c58bbf792 feat: setup cluster trigger authentication objects 2024-03-06 03:39:11 -05:00
Jose Diaz-Gonzalez
25ad302ed2 refactor: use enum to represent authentication type 2024-03-06 03:39:11 -05:00
Jose Diaz-Gonzalez
c0f01c58d6 feat: add initial support for interacting with ClusterTriggerAuthentication objects
These will be provisioned to the keda namespace and referenced by Triggers if they exist (as a fallback to app-specific values).
2024-03-06 03:39:11 -05:00
Jose Diaz-Gonzalez
94125ce787 chore: make secrets optional 2024-03-06 03:39:11 -05:00
Jose Diaz-Gonzalez
042495bcd6 fix: ensure keda auth secrets are written out 2024-03-06 03:39:11 -05:00
Jose Diaz-Gonzalez
4ddd341184 feat: add initial support for keda authentication 2024-03-06 03:39:11 -05:00
Jose Diaz-Gonzalez
46f11cb239 feat: implement replacements 2024-03-06 03:39:11 -05:00
Jose Diaz-Gonzalez
b7ff696507 feat: add initial support for injecting keda addons 2024-03-06 03:39:11 -05:00
Jose Diaz-Gonzalez
5e53207009 fix: ensure we pass global labels 2024-03-01 17:42:24 -05:00
Jose Diaz-Gonzalez
d8946edf91 feat: add support for manipulating labels
Closes #6625
2024-03-01 17:42:24 -05:00
Jose Diaz-Gonzalez
1ae2df52f5 fix: use image pull secrets instead of registries.yaml to reference private repositories
While this will now more or less require a local docker login - which can be overridden by setting the image-pull-secrets property - this ensures every deploy has a valid context.

One annoying thing is that the secret is per-app vs global, meaning that if the secret must be rotated, all apps need to be redeployed. A future change can fix that by deploying a global secret, or if folks really desire, this can be done by setting the image-pull-secrets property on the app/globally.
2024-02-12 17:15:37 -05:00
Jose Diaz-Gonzalez
bfccf60a37 refactor: simplify tls handling by always redirecting 2024-02-12 01:31:39 -05:00
Jose Diaz-Gonzalez
1af36b609d feat: add resource-specific annotations to ingress objects 2024-02-06 22:12:41 -05:00
Jose Diaz-Gonzalez
f5f583b12b feat: add support for specifying annotations
As the command contains a colon, it must be handled in the commands binary as opposed to subcommands.

Also include a simple bats test.
2024-02-06 13:54:53 -05:00
Jose Diaz-Gonzalez
d02c04c2a5 feat: add support for app-specific service accounts when deploying via k3s
Service accounts must still be bound to a role, but this ensures apps do not get access to the default service account.
2024-02-05 16:47:57 -05:00
Jose Diaz-Gonzalez
029e1f5f48 feat: add the dokku logo as the chart icon 2024-01-26 06:55:46 -05:00
Jose Diaz-Gonzalez
f5182aa553 feat: allow specifying an ingress class via chart value
While Dokku currently only supports traefik, providing this setting will allow swapping out the ingress to another fairly easily.
2024-01-26 03:23:34 -05:00
Jose Diaz-Gonzalez
6707e5f1eb feat: add redirect to https when both an http and https port mapping match 2024-01-23 09:45:20 -05:00
Jose Diaz-Gonzalez
4a7db5ce24 feat: apply the cluster issuers on every app deploy
This ensures we can always get certificates regardless of what app gets deployed with whatever configuration.
2024-01-23 07:25:03 -05:00
Jose Diaz-Gonzalez
c8f5ad9029 fix: correct issues in certificate generation 2024-01-23 06:18:25 -05:00
Jose Diaz-Gonzalez
1e559f20e5 refactor: use helper function to get process resources 2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
2336063ca2 refactor: move templating into pseudo-generated helm chart
The previous mechanism of constructing the helm chart was pretty obnoxious due to needing to have some things in the object and some in template files that were appended afterwards. This change simplifies that by using template files per type with minimal replacements.
2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
29760e8ecd feat: add support to tls for ingress-route
If tls is enabled on the process, we create add the https entrypoint and also add the requisite tls secret-name
2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
63a6e9087f feat: create tls certificate if tls is enabled and the app has domains 2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
b0485495e4 refactor: make domains a helm value
This will allow updating domains on the fly
2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
01ec08fd79 refactor: simplify port string 2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
b64c3a1859 chore: add missing import 2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
3d6225406d chore: rename input variable 2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
e4a74366ba chore: move around structs to be closer to the functions using them 2024-01-23 03:00:27 -05:00
Jose Diaz-Gonzalez
632b26905a feat: use common labels instead of custom ones 2024-01-23 03:00:27 -05:00