From 4fe54d9f789a28d4f0e834f41aff289d648c6e68 Mon Sep 17 00:00:00 2001 From: jaysa68 Date: Mon, 15 Dec 2025 23:44:22 -0800 Subject: [PATCH 1/4] kubernetes devenv init :D --- devenv.nix | 14 ++++++++++++++ devenv.yaml | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 devenv.nix create mode 100644 devenv.yaml diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..4f06bdf --- /dev/null +++ b/devenv.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, inputs, ... }: + +{ + + packages = with pkgs; [ + git + teleport + k9s + kubectl + inputs.transpire.packages.${pkgs.system}.transpire + ]; + + # See full reference at https://devenv.sh/reference/options/ +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..9c64067 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,17 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + transpire: + url: github:ocf/transpire + +# If you're using non-OSS software, you can set allowUnfree to true. +# allowUnfree: true + +# If you're willing to use a package that's vulnerable +# permittedInsecurePackages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend From a7edbab57e19f6695aa3fa8cddc546001007998d Mon Sep 17 00:00:00 2001 From: jaysa68 Date: Mon, 15 Dec 2025 23:49:58 -0800 Subject: [PATCH 2/4] update README to include some setup --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 49141dd..fdc3e57 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ This is the git repository for the [Open Computing Facility](https://ocf.berkeley.edu/)'s [Kubernetes](https://k8s.io/) cluster. The repository is a [transpire](https://github.com/ocf/transpire) toplevel repository built through GitHub Actions CI and pushed to [ocf/cluster](https://github.com/ocf/cluster), which is then deployed by ArgoCD. The goal is for every non-dynamic Kubernetes object to be generated by a transpire module. +## Contributing + +The [Open Computing Facility](https://ocf.berkeley.edu/) (OCF) is an all-volunteer student organization dedicated to free computing for all University of California, Berkeley students, faculty, and staff. Students from all backgrounds are encouraged to [join as staff](https://ocf.io/getinvolved)! If you're not a student, or just want to make a one time contribution, please use the standard GitHub pull request workflow. Thanks for helping out :) + +### Setup + +Install devenv and run `devenv shell` in the root of the repo after cloning it. You won't need to run this command if you have direnv installed; the tools defined in `devenv.nix` will become immediately available upon entering the repository. + ## Deploying Software 1. Create a new Python file in `apps/` with a function `objects()` that yields Kubernetes objects (dicts or `python-kubernetes` objects are both accepted). See the other Python files in that folder for examples. Helper functions are provided for Helm charts, although not all software will use helm charts. @@ -42,8 +50,3 @@ A bootstrap script is provided to help bring up new clusters when needed. It ins ```bash ./bootstrap.sh ``` - -## Contributing - -The [Open Computing Facility](https://ocf.berkeley.edu/) (OCF) is an all-volunteer student organization dedicated to free computing for all University of California, Berkeley students, faculty, and staff. Students from all backgrounds are encouraged to [join as staff](https://ocf.io/getinvolved)! If you're not a student, or just want to make a one time contribution, please use the standard GitHub pull request workflow. Thanks for helping out :) - From 16b49ffb04751deace39914f7b59efd6a9bfe103 Mon Sep 17 00:00:00 2001 From: jaysa68 Date: Tue, 16 Dec 2025 01:14:20 -0800 Subject: [PATCH 3/4] .envrc fix --- .envrc | 13 ++++++- .gitignore | 11 ++++++ devenv.lock | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++ devenv.nix | 3 -- 4 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 devenv.lock diff --git a/.envrc b/.envrc index 3550a30..cc5c18b 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,12 @@ -use flake +#!/usr/bin/env bash + +export DIRENV_WARN_TIMEOUT=20s + +eval "$(devenv direnvrc)" + +# `use devenv` supports the same options as the `devenv shell` command. +# +# To silence all output, use `--quiet`. +# +# Example usage: use devenv --quiet --impure --option services.postgres.enable:bool true +use devenv diff --git a/.gitignore b/.gitignore index d77c07f..dbca001 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,14 @@ coverage.xml htmlcov/ # VSCode lol .vscode + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..f4e94d8 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,103 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1765837513, + "owner": "cachix", + "repo": "devenv", + "rev": "ae61898e634c79b8a322214f59f2613d53795dac", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1765121682, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1765464257, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "09e45f2598e1a8499c3594fe11ec2943f34fe509", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1762808025, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1764580874, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "dcf61356c3ab25f1362b4a4428a6d871e84f1d1d", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": [ + "git-hooks" + ] + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix index 4f06bdf..dadd000 100644 --- a/devenv.nix +++ b/devenv.nix @@ -1,7 +1,6 @@ { pkgs, lib, config, inputs, ... }: { - packages = with pkgs; [ git teleport @@ -9,6 +8,4 @@ kubectl inputs.transpire.packages.${pkgs.system}.transpire ]; - - # See full reference at https://devenv.sh/reference/options/ } From 985ab5d7f510fbc3b7965bce240092004108ca8d Mon Sep 17 00:00:00 2001 From: jaysa68 Date: Tue, 16 Dec 2025 01:54:47 -0800 Subject: [PATCH 4/4] fix transpire pkg name --- devenv.lock | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++ devenv.nix | 2 +- devenv.yaml | 3 ++ 3 files changed, 99 insertions(+), 1 deletion(-) diff --git a/devenv.lock b/devenv.lock index f4e94d8..1dce351 100644 --- a/devenv.lock +++ b/devenv.lock @@ -87,6 +87,54 @@ "type": "github" } }, + "pyproject-build-systems": { + "inputs": { + "nixpkgs": [ + "transpire", + "nixpkgs" + ], + "pyproject-nix": [ + "transpire", + "pyproject-nix" + ], + "uv2nix": [ + "transpire", + "uv2nix" + ] + }, + "locked": { + "lastModified": 1763662255, + "owner": "pyproject-nix", + "repo": "build-system-pkgs", + "rev": "042904167604c681a090c07eb6967b4dd4dae88c", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "build-system-pkgs", + "type": "github" + } + }, + "pyproject-nix": { + "inputs": { + "nixpkgs": [ + "transpire", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1764134915, + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "rev": "2c8df1383b32e5443c921f61224b198a2282a657", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "pyproject.nix", + "type": "github" + } + }, "root": { "inputs": { "devenv": "devenv", @@ -94,7 +142,54 @@ "nixpkgs": "nixpkgs", "pre-commit-hooks": [ "git-hooks" + ], + "transpire": "transpire" + } + }, + "transpire": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "pyproject-build-systems": "pyproject-build-systems", + "pyproject-nix": "pyproject-nix", + "uv2nix": "uv2nix" + }, + "locked": { + "lastModified": 1765877276, + "owner": "ocf", + "repo": "transpire", + "rev": "3f6a1ce298af8538a11bafadc8b8bbf6b3ef0e2f", + "type": "github" + }, + "original": { + "owner": "ocf", + "repo": "transpire", + "type": "github" + } + }, + "uv2nix": { + "inputs": { + "nixpkgs": [ + "transpire", + "nixpkgs" + ], + "pyproject-nix": [ + "transpire", + "pyproject-nix" ] + }, + "locked": { + "lastModified": 1765631794, + "owner": "pyproject-nix", + "repo": "uv2nix", + "rev": "4cca323a547a1aaa9b94929c4901bed5343eafe8", + "type": "github" + }, + "original": { + "owner": "pyproject-nix", + "repo": "uv2nix", + "type": "github" } } }, diff --git a/devenv.nix b/devenv.nix index dadd000..0eb649a 100644 --- a/devenv.nix +++ b/devenv.nix @@ -6,6 +6,6 @@ teleport k9s kubectl - inputs.transpire.packages.${pkgs.system}.transpire + inputs.transpire.packages.${pkgs.system}.default ]; } diff --git a/devenv.yaml b/devenv.yaml index 9c64067..a0a0bc1 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -4,6 +4,9 @@ inputs: url: github:cachix/devenv-nixpkgs/rolling transpire: url: github:ocf/transpire + inputs: + nixpkgs: + follows: nixpkgs # If you're using non-OSS software, you can set allowUnfree to true. # allowUnfree: true