mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 16:10:05 +01:00
init cli docs
This commit is contained in:
parent
89e1e70bf0
commit
9f0ae6e362
2 changed files with 39 additions and 10 deletions
30
README.md
30
README.md
|
|
@ -10,12 +10,6 @@ Kubernetes resource management with Nix
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
<!-- Apply all resources with
|
|
||||||
|
|
||||||
nix run github:hall/kubenix . -- apply
|
|
||||||
|
|
||||||
> **HINT**: use ` --help` for more commands -->
|
|
||||||
|
|
||||||
A minimal example flake (build with `nix build`):
|
A minimal example flake (build with `nix build`):
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
|
|
@ -53,6 +47,30 @@ Either way the JSON manifests will be written to `./result`.
|
||||||
|
|
||||||
See [./docs/examples](./docs/examples) for more.
|
See [./docs/examples](./docs/examples) for more.
|
||||||
|
|
||||||
|
## CLI
|
||||||
|
|
||||||
|
> **NOTE**: this is a WIP CLI which currently reads the `k8s` attribute on a local flake
|
||||||
|
|
||||||
|
Render all resources with
|
||||||
|
|
||||||
|
nix run github:hall/kubenix -- render
|
||||||
|
|
||||||
|
> **HINT**: use ` --help` for more commands
|
||||||
|
|
||||||
|
### Support
|
||||||
|
|
||||||
|
The following table gives a general overview of currently supported functionality.
|
||||||
|
|
||||||
|
| | kubectl | kustomize | helm | helmfile |
|
||||||
|
| ------ | :-----: | :-------: | :---: | :------: |
|
||||||
|
| render | x | | x[^2] | |
|
||||||
|
| diff | | | | |
|
||||||
|
| apply | x[^1] | | | |
|
||||||
|
| hooks | - | - | | |
|
||||||
|
|
||||||
|
[^1]: currently create-only
|
||||||
|
[^2]: piping rendered helm charts to kubectl is a lossy process (e.g., [hooks](https://helm.sh/docs/topics/charts_hooks/) will not work)
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This project was forked from https://github.com/GTrunSec/kubenix which was forked from https://github.com/xtruder/kubenix.
|
This project was forked from https://github.com/GTrunSec/kubenix which was forked from https://github.com/xtruder/kubenix.
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@
|
||||||
coreutils,
|
coreutils,
|
||||||
nix,
|
nix,
|
||||||
jq,
|
jq,
|
||||||
|
kubectl,
|
||||||
}: let
|
}: let
|
||||||
name = "kubenix";
|
name = "kubenix";
|
||||||
in
|
in
|
||||||
lib.recursiveUpdate
|
lib.recursiveUpdate (writeShellScriptBin name ''
|
||||||
(writeShellScriptBin name ''
|
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
NAME=${name}
|
NAME=${name}
|
||||||
|
|
@ -18,16 +18,23 @@ in
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
apply - create resources in target cluster
|
apply - create resources in target cluster
|
||||||
|
diff - show a diff between rendered and live resources
|
||||||
render - print resource manifests to stdout
|
render - print resource manifests to stdout
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MANIFEST="$(${nix}/bin/nix eval '.#k8s.config.kubernetes.result' --raw)"
|
||||||
|
|
||||||
function apply() {
|
function apply() {
|
||||||
echo not impremented
|
${kubectl}/bin/kubectl apply -f $MANIFEST
|
||||||
}
|
}
|
||||||
|
|
||||||
function render() {
|
function render() {
|
||||||
${nix}/bin/nix eval '.#kubernetes' # | ${jq}/bin/jq 'fromjson'
|
cat $MANIFEST | ${jq}/bin/jq
|
||||||
|
}
|
||||||
|
|
||||||
|
function diff() {
|
||||||
|
${kubectl}/bin/kubectl diff -f $MANIFEST
|
||||||
}
|
}
|
||||||
|
|
||||||
while test $# -gt 0; do
|
while test $# -gt 0; do
|
||||||
|
|
@ -36,6 +43,10 @@ in
|
||||||
shift
|
shift
|
||||||
apply
|
apply
|
||||||
;;
|
;;
|
||||||
|
diff)
|
||||||
|
shift
|
||||||
|
diff
|
||||||
|
;;
|
||||||
render)
|
render)
|
||||||
shift
|
shift
|
||||||
render
|
render
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue