1
0
Fork 0
mirror of https://git.sr.ht/~goorzhel/turboprop synced 2024-12-14 11:37:37 +00:00
No description
Find a file
Antonio Gurgel ce881f0c0d Keep writing
2023-11-28 22:08:54 -08:00
charts Add Kubernetes dashboard 2023-11-26 16:41:55 -08:00
lib rm alwaysList 2023-11-27 11:40:13 -08:00
.gitignore Name Make recipe after output file 2023-11-23 17:12:33 -08:00
flake.lock rm alwaysList 2023-11-27 11:40:13 -08:00
flake.nix Keep writing 2023-11-28 22:08:54 -08:00
LICENSE License under Apache-2.0 2023-11-16 20:46:03 -08:00
Makefile Missed a spot in s/releases/services/ 2023-11-26 01:23:19 -08:00
README.md Keep writing 2023-11-28 22:08:54 -08:00

Turboprop

Problem: I have twenty or thirty Helm releases, all of which I template semi-manually to retain WYSIWYG control. Deploying new applications involves a lot of copy-pasta.

Solution: Use Nix. With Nix, I can ensure chart integrity, generate repetitive data in subroutines, and easily inherit data from elsewhere.

Prior art

Without farcaller's "Nix and Kubernetes: Deployments Done Right" (notes), this project would not exist.

I also used heywoodlh's Kubernetes flake as a starting point early on.

Usage

{ charts, lib, user, ... }: {  # 1
  builder = lib.builders.helmChart; # 2
  args = { # 3
    chart = charts.jetstack.cert-manager;
    values = {
      featureGates = "ExperimentalGatewayAPISupport=true";
      installCRDs = true;
      prometheus = {
        enabled = true;
        servicemonitor = {
          enabled = true;
          prometheusInstance = "monitoring";
        };
      };
      startupapicheck.podLabels."sidecar.istio.io/inject" = "false";
    };
  };
  extraObjects = [  # 4
    {
      apiVersion = "cert-manager.io/v1";
      kind = "ClusterIssuer";
      metadata.name = user.vars.k8sCert.name; # 5
      spec.ca.secretName = user.vars.k8sCert.name;
    }
  ];
}

lib

flake builders

charts

Signature, etc.

Architecture

Services expected to provide custom APIs (e.g.: Gateway API, Istio, Longhorn) go in ./system. All others in ./services, including system-service charts dependent on other APIs. This prevents infinite recursion when gathering APIs.

Each of the leaves of the services attrsets is a derivation (explained better in lib/flake-builders.nix). Here, they are gathered into one mega-derivation, with Kustomizations at each level for usage with k apply -k $path.

namespaces

Assign extra metadata in namespaces.nix. For example, svc = {labels."istio.io/rev" = "1-18-1"} is the equivalent of k label ns/svc istio.io/rev=1-18-1