From 1c410a7e031f4bc6ef44965755eec9eeda67fd6b Mon Sep 17 00:00:00 2001 From: Bryton Hall Date: Thu, 11 Aug 2022 23:41:33 -0400 Subject: [PATCH] update contributing guide and format repo --- .vscode/extensions.json | 6 +++++ CONTRIBUTING.md | 50 ++++++++++++++++++++++++++----------- flake.nix | 7 +++--- jobs/generators/default.nix | 4 +-- modules/k8s.nix | 1 - 5 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 .vscode/extensions.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..0781211 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "EditorConfig.EditorConfig", + "mkhl.direnv" + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bfa68a8..20f4216 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,25 +1,47 @@ # Contributing +Thanks for your interest in contributing! +We welcome ideas, code, docs, etc -- just open an issue or MR. + +## Setup + +This project uses [flakes](https://nixos.wiki/wiki/Flakes) so a development environment can be created with + + nix develop + +where you will find a [devshell](https://numtide.github.io/devshell) prompt (which supports [direnv](https://direnv.net/) so a one-time `direnv allow` at the base of the repo should automate the dev shell process). + +## Commits + +There's no formal commit process at this time. + +Do try to format the repo before submission, however. + + nix develop -c treefmt + ## Kubernetes versions -Edit [`./jobs/generators/default.nix`](./jobs/generators/default.nix) and add a block for the new version of Kubernetes in `generate.k8s`. For example: +To support a new Kubernetes version: -```nix -{ - name = "v1.23.nix"; - path = generateK8S "v1.23" (builtins.fetchurl { - url = "https://github.com/kubernetes/kubernetes/raw/v1.23.0/api/openapi-spec/swagger.json"; - sha256 = "0jivg8nlxka1y7gzqpcxkmbvhcbxynyrxmjn0blky30q5064wx2a"; - }); -} -``` +- Edit [`./jobs/generators/default.nix`](./jobs/generators/default.nix) and add a block for the version under `k8s`; for example: -Then build and copy all specs to [`modules/generated/`](./modules/generated/): + ```nix + { + name = "v1.23.nix"; + path = generateK8S "v1.23" (builtins.fetchurl { + url = "https://github.com/kubernetes/kubernetes/raw/v1.23.0/api/openapi-spec/swagger.json"; + sha256 = "0jivg8nlxka1y7gzqpcxkmbvhcbxynyrxmjn0blky30q5064wx2a"; + }); + } + ``` - nix build '.#jobs.x86_64-linux.generators.k8s' - cp ./result/* modules/generated/ +- Build and copy the updated specs to [`modules/generated/`](./modules/generated/) -Now add the version in [`./modules/k8s.nix`](./modules/k8s.nix) under `options.kubernetes.version.type` as well as a new check in [`./flake.nix`](./flake.nix) (e.g., `tests-k8s-1_23`). + nix build '.#jobs.x86_64-linux.generators.k8s' + cp ./result/* modules/generated/ + +- Add the version in [`./modules/k8s.nix`](./modules/k8s.nix) under `options.kubernetes.version.type` +- Add a new check in [`./flake.nix`](./flake.nix) (e.g., `tests-k8s-1_23`) ## Tests diff --git a/flake.nix b/flake.nix index 0ecf8a8..dd532a3 100644 --- a/flake.nix +++ b/flake.nix @@ -61,9 +61,10 @@ }; } ]; - specialArgs = {inherit kubenix; - inherit pkgs; - }; + specialArgs = { + inherit kubenix; + inherit pkgs; + }; } attrs'); in { diff --git a/jobs/generators/default.nix b/jobs/generators/default.nix index 93b7a8b..bf27849 100644 --- a/jobs/generators/default.nix +++ b/jobs/generators/default.nix @@ -1,6 +1,6 @@ { - pkgs, - lib, + pkgs, + lib, }: let generateIstio = import ./istio { inherit diff --git a/modules/k8s.nix b/modules/k8s.nix index bc4e01f..768acf1 100644 --- a/modules/k8s.nix +++ b/modules/k8s.nix @@ -282,7 +282,6 @@ in { default = null; }; - customResources = mkOption { description = "Setup custom resources"; type = types.listOf types.attrs;