@dmgnr/kuber 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +35 -1
  2. package/dist/index.js +72 -72
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -357,7 +357,8 @@ your shell configuration. Fish and PowerShell are also supported through
357
357
  - `exec <deployment> <command...>`: execute a command inside a running
358
358
  deployment pod over an interactive WebSocket
359
359
  - `restart [deployment]`: roll out a restart across managed deployments
360
- - `stop`: scale managed deployments to zero
360
+ - `stop`: delete the matching name-scoped HPAs (so autoscaling cannot scale
361
+ replicas back up) and scale managed deployments to zero
361
362
  - `rollback` (alias `fuck`) `[deployment]`: roll one deployment back to its
362
363
  previous release, or all managed deployments when no name is given
363
364
  - `down [-f]`: delete managed resources while keeping ingress, PVCs, managed
@@ -485,6 +486,39 @@ Translation rules:
485
486
  - `host:port:protected` -> Traefik `IngressRoute` with middleware `routing/cf-auth` and host-wide matching
486
487
  - `host:port:protected(path1,path2,...)` -> Traefik `IngressRoute` with middleware `routing/cf-auth` and explicit `PathPrefix(...)` matches only
487
488
 
489
+ ### Replicas and Autoscaling
490
+
491
+ `deploy.replicas` (or the top-level `scale` field) controls the Deployment
492
+ replica count. A plain integer or numeric string renders a fixed `replicas`
493
+ value, with `scale` taking precedence over `deploy.replicas`.
494
+
495
+ A `"min-max"` range string requests autoscaling instead of a fixed count:
496
+
497
+ ```yml
498
+ services:
499
+ app:
500
+ image: app
501
+ deploy:
502
+ replicas: "2-6"
503
+ ```
504
+
505
+ kuber renders:
506
+
507
+ - a `Deployment` with `replicas` set to the range minimum (`2`)
508
+ - a `HorizontalPodAutoscaler` (`autoscaling/v2`) targeting that Deployment,
509
+ with `minReplicas: 2`, `maxReplicas: 6`, and a CPU target of 80%
510
+ utilization
511
+ - a `100m` CPU request injected into the container, unless `x-container`
512
+ already specifies a CPU request (the HPA needs a CPU request to scale on)
513
+
514
+ For both fixed counts above one and autoscaled ranges whose maximum exceeds
515
+ one, kuber also adds a `topologySpreadConstraints` entry spreading pods across
516
+ hosts (`kubernetes.io/hostname`, `maxSkew: 1`,
517
+ `whenUnsatisfiable: ScheduleAnyway`).
518
+
519
+ Malformed non-numeric replica values (for example `"lots"`) are rejected with
520
+ a clear error instead of silently defaulting.
521
+
488
522
  ### Managed Postgres
489
523
 
490
524
  You can declare a managed Postgres database with a pseudo-volume: