init cli docs

This commit is contained in:
Bryton Hall 2022-08-15 20:34:03 -04:00
parent 89e1e70bf0
commit 9f0ae6e362
2 changed files with 39 additions and 10 deletions

View file

@ -4,11 +4,11 @@
coreutils,
nix,
jq,
kubectl,
}: let
name = "kubenix";
in
lib.recursiveUpdate
(writeShellScriptBin name ''
lib.recursiveUpdate (writeShellScriptBin name ''
set -Eeuo pipefail
NAME=${name}
@ -18,16 +18,23 @@ in
commands:
apply - create resources in target cluster
diff - show a diff between rendered and live resources
render - print resource manifests to stdout
"
}
MANIFEST="$(${nix}/bin/nix eval '.#k8s.config.kubernetes.result' --raw)"
function apply() {
echo not impremented
${kubectl}/bin/kubectl apply -f $MANIFEST
}
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
@ -36,6 +43,10 @@ in
shift
apply
;;
diff)
shift
diff
;;
render)
shift
render