diff options
| author | Franck Cuny <franck@fcuny.net> | 2025-04-28 16:30:13 -0700 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2025-04-28 16:33:10 -0700 |
| commit | 51bed4aae8f3110d9c695fe7eb0c7452938c357b (patch) | |
| tree | 4cab776c3706df20e7d201afd4e1ab953e09c7c9 /nix | |
| parent | Merge pull request #19 from fcuny/dependabot/github_actions/DeterminateSystem... (diff) | |
| download | infra-51bed4aae8f3110d9c695fe7eb0c7452938c357b.tar.gz | |
add a script `nomad-prod` to open the nomad ui for the production cells
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/users/fcuny/work.nix | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/nix/users/fcuny/work.nix b/nix/users/fcuny/work.nix index b3b6325..34da876 100644 --- a/nix/users/fcuny/work.nix +++ b/nix/users/fcuny/work.nix @@ -1,4 +1,27 @@ { pkgs, ... }: +let + nomad-prod = pkgs.writeShellScriptBin "nomad-prod" '' + #!${pkgs.runtimeShell} + set -e + + if [ $# -ne 1 ]; then + echo "Usage: nomad-ui CELL_ID" + exit 1 + fi + + CELL_ID=$1 + + echo ">> Login to chi1 vault using Okta" + export VAULT_ADDR="https://chi1-vault.simulprod.com:8200" + export VAULT_TOKEN=$(${pkgs.vault}/bin/vault login -field=token -method=oidc username=$USER) + + echo ">> Accessing cell $CELL_ID" + export NOMAD_ADDR="https://$CELL_ID-nomad.simulprod.com" + export NOMAD_TOKEN=$(${pkgs.vault}/bin/vault read -field secret_id ''${CELL_ID}_nomad/creds/management) + + nomad ui --authenticate + ''; +in { imports = [ ./k8s.nix ]; @@ -14,6 +37,9 @@ # for tokens customPackages.hashi + + # for nomad + nomad-prod ]; programs.fish = { |
