Skip to content

Commit

Permalink
just: add runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
malt3 committed Apr 17, 2024
1 parent 611aa3b commit 8d19394
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
18 changes: 17 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Undeploy, rebuild, deploy.
default target=default_deploy_target cli=default_cli: soft-clean coordinator initializer openssl port-forwarder service-mesh-proxy (deploy target cli) set verify (wait-for-workload target)
default target=default_deploy_target cli=default_cli: soft-clean coordinator initializer openssl port-forwarder service-mesh-proxy node-installer runtime (apply "runtime") (deploy target cli) set verify (wait-for-workload target)

# Build and push a container image.
push target:
Expand Down Expand Up @@ -31,6 +31,18 @@ workspace_dir := "workspace"
# Generate policies, apply Kubernetes manifests.
deploy target=default_deploy_target cli=default_cli: (populate target) (generate cli) (apply target)

# Populate the workspace with a runtime class deployment
runtime:
#!/usr/bin/env bash
set -euo pipefail
mkdir -p ./{{ workspace_dir }}/runtime
nix shell .#contrast --command resourcegen runtime ./{{ workspace_dir }}/runtime/runtime.yml
nix run .#scripts.patch-contrast-image-hashes -- ./{{ workspace_dir }}/runtime
nix run .#kypatch images -- ./{{ workspace_dir }}/runtime \
--replace ghcr.io/edgelesssys ${container_registry}
nix run .#kypatch namespace -- ./{{ workspace_dir }}/runtime \
--replace edg-default kube-system
# Populate the workspace with a Kubernetes deployment
populate target=default_deploy_target:
#!/usr/bin/env bash
Expand Down Expand Up @@ -66,6 +78,10 @@ generate cli=default_cli:
apply target=default_deploy_target:
#!/usr/bin/env bash
case {{ target }} in
"runtime")
kubectl apply -f ./{{ workspace_dir }}/runtime
exit 0
;;
"simple" | "openssl" | "emojivoto")
:
;;
Expand Down
5 changes: 4 additions & 1 deletion packages/scripts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ with pkgs;
runtimeInputs = [
crane
kypatch
jq
];
text = ''
targetPath=$1
Expand All @@ -107,13 +108,15 @@ with pkgs;
opensslHash=$(crane digest --tarball "$tmpdir/openssl.tar")
forwarderHash=$(crane digest --tarball "$tmpdir/port-forwarder.tar")
serviceMeshProxyHash=$(crane digest --tarball "$tmpdir/service-mesh-proxy.tar")
nodeInstallerHash=$(jq -r '.manifests[0].digest' "${contrast-node-installer-image}/index.json")
kypatch images "$targetPath" \
--replace "contrast/coordinator:latest" "contrast/coordinator@$coordHash" \
--replace "contrast/initializer:latest" "contrast/initializer@$initHash" \
--replace "contrast/openssl:latest" "contrast/openssl@$opensslHash" \
--replace "contrast/port-forwarder:latest" "contrast/port-forwarder@$forwarderHash" \
--replace "contrast/service-mesh-proxy:latest" "contrast/service-mesh-proxy@$serviceMeshProxyHash"
--replace "contrast/service-mesh-proxy:latest" "contrast/service-mesh-proxy@$serviceMeshProxyHash" \
--replace "contrast/node-installer:latest" "contrast/node-installer@$nodeInstallerHash"
'';
};

Expand Down

0 comments on commit 8d19394

Please sign in to comment.