@dmgnr/kuber 2.0.0 → 2.2.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 +49 -1
  2. package/dist/index.js +105 -104
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -28,6 +28,20 @@ a per-project namespace, reconciles managed Postgres and S3 claims, rolls
28
28
  deployments back, streams logs, and exposes interactive `exec` sessions over a
29
29
  WebSocket.
30
30
 
31
+ ## Directory Trust
32
+
33
+ Before `kuber up`, run `kuber trust` from the configured project directory.
34
+ Trust is exactly the configured namespace plus a SHA-256 fingerprint of the
35
+ resolved current working directory. The local mode-0600 store lets `up` fail
36
+ before builds from an untrusted directory. The server stores only namespace and
37
+ fingerprint registrations in labelled ConfigMaps in its `kuber-system` control
38
+ plane namespace, then checks the pair when resource reconciliation begins.
39
+
40
+ This is an accidental-targeting safeguard, not a security boundary: a client
41
+ that intentionally forges a registered fingerprint can pass it. `kuber trust
42
+ status` shows local/server awareness without printing paths; `kuber trust revoke`
43
+ removes the current directory registration.
44
+
31
45
  ## Environment Assumptions
32
46
 
33
47
  kuber targets a specific self-hosted cluster and workstation setup. It is not
@@ -357,7 +371,8 @@ your shell configuration. Fish and PowerShell are also supported through
357
371
  - `exec <deployment> <command...>`: execute a command inside a running
358
372
  deployment pod over an interactive WebSocket
359
373
  - `restart [deployment]`: roll out a restart across managed deployments
360
- - `stop`: scale managed deployments to zero
374
+ - `stop`: delete the matching name-scoped HPAs (so autoscaling cannot scale
375
+ replicas back up) and scale managed deployments to zero
361
376
  - `rollback` (alias `fuck`) `[deployment]`: roll one deployment back to its
362
377
  previous release, or all managed deployments when no name is given
363
378
  - `down [-f]`: delete managed resources while keeping ingress, PVCs, managed
@@ -485,6 +500,39 @@ Translation rules:
485
500
  - `host:port:protected` -> Traefik `IngressRoute` with middleware `routing/cf-auth` and host-wide matching
486
501
  - `host:port:protected(path1,path2,...)` -> Traefik `IngressRoute` with middleware `routing/cf-auth` and explicit `PathPrefix(...)` matches only
487
502
 
503
+ ### Replicas and Autoscaling
504
+
505
+ `deploy.replicas` (or the top-level `scale` field) controls the Deployment
506
+ replica count. A plain integer or numeric string renders a fixed `replicas`
507
+ value, with `scale` taking precedence over `deploy.replicas`.
508
+
509
+ A `"min-max"` range string requests autoscaling instead of a fixed count:
510
+
511
+ ```yml
512
+ services:
513
+ app:
514
+ image: app
515
+ deploy:
516
+ replicas: "2-6"
517
+ ```
518
+
519
+ kuber renders:
520
+
521
+ - a `Deployment` with `replicas` set to the range minimum (`2`)
522
+ - a `HorizontalPodAutoscaler` (`autoscaling/v2`) targeting that Deployment,
523
+ with `minReplicas: 2`, `maxReplicas: 6`, and a CPU target of 80%
524
+ utilization
525
+ - a `100m` CPU request injected into the container, unless `x-container`
526
+ already specifies a CPU request (the HPA needs a CPU request to scale on)
527
+
528
+ For both fixed counts above one and autoscaled ranges whose maximum exceeds
529
+ one, kuber also adds a `topologySpreadConstraints` entry spreading pods across
530
+ hosts (`kubernetes.io/hostname`, `maxSkew: 1`,
531
+ `whenUnsatisfiable: ScheduleAnyway`).
532
+
533
+ Malformed non-numeric replica values (for example `"lots"`) are rejected with
534
+ a clear error instead of silently defaulting.
535
+
488
536
  ### Managed Postgres
489
537
 
490
538
  You can declare a managed Postgres database with a pseudo-volume: