ops(k8s): create app of apps project, deploy flannel with it

This commit is contained in:
Kat Inskip 2024-01-17 15:34:53 -08:00
parent de91366e09
commit bcbc560217
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
7 changed files with 96 additions and 26 deletions

View file

@ -1,5 +1,7 @@
{ inputs, system }: {
let inputs,
system,
}: let
meta = import ./meta.nix {inherit inputs system;}; meta = import ./meta.nix {inherit inputs system;};
inherit (meta) pkgs; inherit (meta) pkgs;
nf-actions = pkgs.writeShellScriptBin "nf-actions" '' nf-actions = pkgs.writeShellScriptBin "nf-actions" ''
@ -29,6 +31,12 @@ let
cd "$NF_CONFIG_ROOT/tf" cd "$NF_CONFIG_ROOT/tf"
exec nix run ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#nf-lint-tf" -- "$@" exec nix run ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#nf-lint-tf" -- "$@"
''; '';
nf-kustomize = pkgs.writeShellScriptBin "kustomize" ''
exec nix run ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#pkgs.kustomize" -- "$@"
'';
nf-argocd = pkgs.writeShellScriptBin "argocd" ''
exec nix run ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#pkgs.argocd" -- "$@"
'';
in in
pkgs.mkShell { pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
@ -40,6 +48,8 @@ pkgs.mkShell {
nf-deploy nf-deploy
nf-tf nf-tf
nf-lint-tf nf-lint-tf
nf-kustomize
nf-argocd
]; ];
shellHook = '' shellHook = ''
export NIX_BIN_DIR=$(dirname $(readlink -f $(type -P nix))) export NIX_BIN_DIR=$(dirname $(readlink -f $(type -P nix)))
@ -51,4 +61,3 @@ pkgs.mkShell {
export NIX_SSHOPTS="''${NIX_SSHOPTS--p62954}" export NIX_SSHOPTS="''${NIX_SSHOPTS--p62954}"
''; '';
} }

17
k8s/application.yaml Normal file
View file

@ -0,0 +1,17 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: system
namespace: argocd
spec:
destination:
namespace: default
server: https://10.1.1.173:6443
project: default
source:
repoURL: 'https://github.com/gensokyo-zone/infrastructure'
path: k8s/system
targetRevision: main
syncPolicy:
automated:
selfHeal: true

4
k8s/kustomization.yaml Normal file
View file

@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- application.yaml

View file

@ -0,0 +1,21 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: flannel
namespace: argocd
spec:
project: system
source:
repoURL: 'https://flannel-io.github.io/flannel/'
targetRevision: v0.24.x
helm:
valuesObject:
podCidr: 10.42.0.0/16
chart: flannel
destination:
namespace: kube-flannel
server: https://10.1.1.173:6443
syncPolicy:
syncOptions:
- CreateNamespace=true
- ServerSideApply=true

18
k8s/system/project.yaml Normal file
View file

@ -0,0 +1,18 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: system
namespace: argocd
spec:
description: "Underlying services and controllers required for the operation of the cluster"
destinations:
- namespace: "*"
server: https://10.1.1.173:6443
clusterResourceWhitelist:
- group: "*"
kind: "*"
namespaceResourceWhitelist:
- group: "*"
kind: "*"
sourceRepos:
- "*"

View file

@ -13,6 +13,7 @@
disableAgent = false; # single node server+agent disableAgent = false; # single node server+agent
extraFlags = toString [ extraFlags = toString [
"--disable=servicelb" # we want to use metallb "--disable=servicelb" # we want to use metallb
# i guess it's kind of ok to keep the local path provisioner, even though i used to have the yaml files for deploying it on regular k8s
]; ];
}; };

View file

@ -23,7 +23,7 @@
}; };
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/efb3698c-2471-4b44-b82a-4b9d4a070da6"; device = "/dev/disk/by-uuid/5ab5efe2-0250-4bf1-8fd6-3725cdd15031";
fsType = "ext4"; fsType = "ext4";
}; };