Skip to content

Commit cdf16ac

Browse files
committed
feat: move to flux
1 parent e0da580 commit cdf16ac

File tree

365 files changed

+3861
-4997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+3861
-4997
lines changed

.github/workflows/pipeline.yml

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,15 @@ on:
77
- main
88
workflow_dispatch:
99

10-
env:
11-
HELM_EXPERIMENTAL_OCI: true
12-
1310
jobs:
14-
conform:
15-
runs-on: ubuntu-latest
16-
name: Conform
17-
18-
steps:
19-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
20-
with:
21-
fetch-depth: 0
22-
23-
- uses: siderolabs/[email protected]
24-
with:
25-
token: ${{ secrets.GITHUB_TOKEN }}
26-
2711
lint:
2812
runs-on: ubuntu-latest
29-
name: Lint Charts
30-
strategy:
31-
max-parallel: 12
32-
matrix:
33-
python-version: ["3.11"]
34-
helm-version: ["3.13.0"]
35-
yamale-version: ["4.0.4"]
36-
directory:
37-
- applications
38-
- core
39-
- home-assistant
40-
- infrastructure
41-
- library
13+
name: Lint
4214

4315
steps:
4416
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
4517
with:
4618
fetch-depth: 0
4719

48-
- uses: yokawasa/[email protected]
49-
with:
50-
setup-tools: helm
51-
helm: ${{ matrix.helm-version }}
52-
53-
- uses: actions/setup-python@v4
54-
with:
55-
python-version: ${{ matrix.python-version }}
56-
57-
- uses: helm/[email protected]
58-
with:
59-
yamale_version: ${{ matrix.yamale-version }}
60-
61-
- name: Lint all charts
62-
run: ct lint --all --chart-dirs ${{ matrix.directory }}/charts --config ${{ github.workspace }}/ct.yml
20+
- run: |
21+
yamllint .

.github/workflows/pr.yml

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ name: Pull Request
44
on:
55
pull_request:
66

7-
env:
8-
HELM_EXPERIMENTAL_OCI: true
9-
107
jobs:
118
conform:
129
runs-on: ubuntu-latest
@@ -23,46 +20,12 @@ jobs:
2320

2421
lint:
2522
runs-on: ubuntu-latest
26-
name: Lint Charts
27-
strategy:
28-
max-parallel: 12
29-
matrix:
30-
python-version: ["3.11"]
31-
helm-version: ["3.13.0"]
32-
yamale-version: ["4.0.4"]
33-
directory:
34-
- applications
35-
- core
36-
- home-assistant
37-
- infrastructure
38-
- library
23+
name: Lint
3924

4025
steps:
4126
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
4227
with:
4328
fetch-depth: 0
4429

45-
- uses: yokawasa/[email protected]
46-
with:
47-
setup-tools: helm
48-
helm: ${{ matrix.helm-version }}
49-
50-
- uses: actions/setup-python@v4
51-
with:
52-
python-version: ${{ matrix.python-version }}
53-
54-
- uses: helm/[email protected]
55-
with:
56-
yamale_version: ${{ matrix.yamale-version }}
57-
58-
- name: List changed charts
59-
id: list-changed
60-
run: |
61-
changed=$(ct list-changed --chart-dirs ${{ matrix.directory }}/charts --config ${{ github.workspace }}/ct.yml)
62-
if [[ -n "$changed" ]]; then
63-
echo "changed=true" >> ${GITHUB_OUTPUT}
64-
fi
65-
66-
- name: Lint changed charts
67-
if: steps.list-changed.outputs.changed == 'true'
68-
run: ct lint --chart-dirs ${{ matrix.directory }}/charts --config ${{ github.workspace }}/ct.yml
30+
- run: |
31+
yamllint .

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ TODO.md
3333
!**/secret-*.enc.yml
3434
!**/secret-generator.yaml
3535
!**/secret-generator.yml
36+
local.env

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repos:
77
stages:
88
- commit-msg
99
- repo: https://github.com/pre-commit/pre-commit-hooks
10-
rev: v4.4.0
10+
rev: v4.5.0
1111
hooks:
1212
- id: check-json
1313
- id: check-merge-conflict
@@ -17,12 +17,12 @@ repos:
1717
- id: destroyed-symlinks
1818
- id: detect-aws-credentials
1919
args: [
20-
"--allow-missing-credentials"
20+
"--allow-missing-credentials"
2121
]
2222
- id: detect-private-key
2323
- id: trailing-whitespace
2424
args: [
25-
"--markdown-linebreak-ext=md"
25+
"--markdown-linebreak-ext=md"
2626
]
2727
# - id: no-commit-to-branch
2828
# args: [

.sops.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
creation_rules:
2-
- unencrypted_regex: "^(apiVersion|metadata|kind|type)$"
3+
- encrypted_regex: ^(data|stringData)$
34
gcp_kms: projects/tuxnet-385112/locations/europe/keyRings/infrastructure-encryption/cryptoKeys/infrastructure-encryption

.versionrc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

.yamllint

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
extends: default
3+
4+
ignore:
5+
- secret-*.enc.yml
6+
7+
rules:
8+
line-length:
9+
max: 300
10+
comments:
11+
min-spaces-from-content: 1
12+
truthy:
13+
ignore:
14+
- .github/

README.md

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,75 @@
11
# Homelab: Kubernetes Home Cluster - Applications
22

3-
[![Build status](https://img.shields.io/github/actions/workflow/status/muhlba91/homelab-kubernetes-home-applications/pipeline.yml?style=for-the-badge)](https://github.com/muhlba91/homelab-kubernetes-home-applications/actions/workflows/pipeline.yml)
4-
[![License](https://img.shields.io/github/license/muhlba91/homelab-kubernetes-home-applications?style=for-the-badge)](LICENSE.md)
3+
[![Build status](https://img.shields.io/github/actions/workflow/status/muhlba91/homelab-home-cluster-applications/pipeline.yml?style=for-the-badge)](https://github.com/muhlba91/homelab-home-cluster-applications/actions/workflows/pipeline.yml)
4+
[![License](https://img.shields.io/github/license/muhlba91/homelab-home-cluster-applications?style=for-the-badge)](LICENSE.md)
55

6-
This repository contains applications deployed on the `home-cluster` via [ArgoCD](https://argo-cd.readthedocs.io/en/stable/) using [GitOps](https://opengitops.dev).
6+
This repository contains applications deployed on the `home-cluster` via [Flux](https://fluxcd.io) using [GitOps](https://opengitops.dev).
77

88
---
99

1010
## Bootstrapping
1111

12-
A Kubernetes cluster needs to be bootstrapped with the [Cilium CNI](https://cilium.io) and ArgoCD with an `Application` pointing to this repository.
12+
A Kubernetes cluster needs to be bootstrapped with the [Cilium CNI](https://cilium.io) and Flux pointing to this repository.
1313

14-
For [ksops](https://github.com/viaduct-ai/kustomize-sops) and ArgoCD to decrypt the initial secrets for configuring the [External Secrets Operator](http://external-secrets.io) using [Doppler](http://doppler.com), a [Google Cloud Service Account](https://cloud.google.com/docs/authentication#service-accounts) with access to the correct KMS key needs to be set in the `argocd` namespace. You can check out [`infrastructure/charts/argocd/values.yaml`](infrastructure/charts/argocd/values.yaml) on how this secret is passed to ArgoCD.
14+
For [ksops](https://github.com/viaduct-ai/kustomize-sops) and ArgoCD to decrypt the initial secrets for configuring the [External Secrets Operator](http://external-secrets.io) using [Doppler](http://doppler.com), a [Google Cloud Service Account](https://cloud.google.com/docs/authentication#service-accounts) with access to the correct KMS key needs to be set in the `flux` namespace.
1515

16-
ArgoCD will then manage Cilium, itself, and all applications as defined in this repository.
16+
***Attention:*** some applications will be automatically deployed, others not (yet).
1717

1818
---
1919

20-
## ArgoCD App-of-Apps
20+
## App-of-Apps
2121

22-
The repository layout follows ArgoCD's [app-of-apps pattern](https://argo-cd.readthedocs.io/en/stable/operator-manual/cluster-bootstrapping/).
22+
The repository follows the app-of-apps pattern.
2323

24-
The first ArgoCD `Application` being defined needs to reference [`app-of-apps/values.yaml`](app-of-apps/values.yaml) and the environment specific `values-<ENVIRONMENT>.yaml` files.
24+
The first Flux `Kustomization` being defined needs to reference [`app-of-apps/`](app-of-apps/).
2525

26-
These are bootstrapping the main ArgoCD projects and applications, referring to the respective `<PROJECT>/applications/values[-<ENVIRONMENT>].yaml` files:
26+
These are bootstrapping the main Flux applications, referring to the respective `<PROJECT>/applications/` kosutomizations:
2727

28-
- [`infrastructure`](#infrastructure): core cluster infrastructure, like Cilium and ArgoCD
29-
- [`core`](#core-applications): core applications, like [cert-manager](http://cert-manager.io) and [traefik](https://traefik.io)
28+
- [`infrastructure`](#infrastructure): core cluster infrastructure
29+
- [`core`](#core-applications): core applications
3030
- [`applications`](#user-applications): (user) applications running on the cluster/network
3131
- [`home-assistant`](#home-assistant): [Home Assistant](http://home-assistant.io) related applications
3232

33-
Each of these applications follows the app-of-apps pattern again using subcharts defined in the respective `charts` directory.
34-
35-
### Additional Helm Value Files
36-
37-
In addition to the included `values[-<ENVIRONMENT].yaml` files, ArgoCD `Application`s load additonal Helm value files from an external repository defined with `global.spec.values.repoURL`.
38-
39-
For example, values only defined in the external repository are ingress domains.
40-
41-
## Library Charts
42-
43-
### Applications
44-
45-
To support bootstrapping these app-of-apps `Application`s, the library chart [applications](library/charts/applications) creates the ArgoCD `Project` and `Application` definitions based on the provided values.
33+
Each of these applications follows the app-of-apps pattern again using sub-kustomizations defined in the respective application directories.
4634

4735
---
4836

4937
## Hosted Services
5038

5139
### Infrastructure
5240

53-
The following applications are defined in [`infrastructure/charts`](infrastructure/charts).
41+
The following applications are defined in [`infrastructure/`](infrastructure/).
5442

55-
- [x] [ArgoCD](https://argo-cd.readthedocs.io/en/stable/) - Manages the applications deployed on the cluster using GitOps.
5643
- [x] [Cilium](https://cilium.io) - Provides the cluster CNI.
57-
- [x] [CSI NFS Driver](https://github.com/kubernetes-csi/csi-driver-nfs/tree/master) - Exposes the NAS' NFS storage as a Kubernetes `StorageClass`.
58-
- [x] [Descheduler](https://github.com/kubernetes-sigs/descheduler) - Finds pods to be evicted for optimizing node usage.
59-
- [x] [External Secrets Operator](http://external-secrets.io) - Synchronizes secrets from external stores to Kubernetes `Secret` objects.
44+
- [ ] [CSI NFS Driver](https://github.com/kubernetes-csi/csi-driver-nfs/tree/master) - Exposes the NAS' NFS storage as a Kubernetes `StorageClass`.
6045
- [x] [MetalLB](https://metallb.universe.tf) - Provides a Kubernetes network load balancer to expose Kubernetes `Service`s.
6146
- [x] [Longhorn](https://longhorn.io) - Exposes local storage to Kubernetes `StorageClass`es.
62-
63-
#### Kustomizations
64-
65-
- [x] [External Secrets Stores](infrastructure/kustomizations/external-secrets-stores) - Deploys the required `ClusterSecretStore`s and Doppler [Service Tokens](https://docs.doppler.com/docs/service-tokens) as Kubernetes `Secret`s.
47+
- [x] [External Secrets Operator](http://external-secrets.io) - Synchronizes secrets from external stores to Kubernetes `Secret` objects.
48+
- [x] [External Secrets Stores](infrastructure/external-secrets/) - Deploys the required `ClusterSecretStore`s and Doppler [Service Tokens](https://docs.doppler.com/docs/service-tokens) as Kubernetes `Secret`s.
49+
- [x] [Traefik](https://traefik.io) - Exposes Kubernetes `Ingress` resources to the "outside world".
6650

6751
### Core Applications
6852

69-
The following applications are defined in [`core/charts`](core/charts).
53+
The following applications are defined in [`core/`](core/).
7054

7155
- [x] [cert-manager](https://cert-manager.io) - Certificate management using ACME Let's Encrypt.
7256
- [x] [External DNS with Google Cloud DNS integration](https://github.com/kubernetes-sigs/external-dns) - Creates DNS records in Google Cloud DNS domains for publicly reachable services.
73-
- [x] [Traefik](https://traefik.io) - Exposes Kubernetes `Ingress` resources to the "outside world".
7457

7558
### (User) Applications
7659

77-
The following applications are defined in [`applications/charts`](applications/charts).
60+
The following applications are defined in [`applications/`](applications/).
7861

7962
- [x] [AdGuard](https://adguard.com/en/adguard-home/overview.html) - DNS server with ad filtering/blocking capabilities.
8063
- [x] [CoreDNS](https://coredns.io) - DNS resolver for internal, local only, domains.
8164
- [x] [dnsmasq](https://thekelleys.org.uk/dnsmasq/doc.html) - IPv4 and IPv6 DHCP server.
8265
- [x] [External DNS with CoreDNS/etcd integration](https://github.com/kubernetes-sigs/external-dns) - Creates DNS records in CoreDNS/etcs for internal, local only, reachable services.
8366
- [x] External Services - Deploys Kubernetes `Service`s and `Ingress`es to local endpoints, and existing services outside of the cluster.
8467
- [x] [Grafana](http://grafana.com) - Visualization of metrics, and other data.
85-
- [x] [MinIO](https://min.io) - Local object storage.
68+
- [ ] [MinIO](https://min.io) - Local object storage.
8669

8770
### Home Assistant
8871

89-
The following applications are defined in [`home-assistant/charts`](home-assistant/charts).
72+
The following applications are defined in [`home-assistant/`](home-assistant/).
9073

9174
- [x] [ecowitt2mqtt](https://github.com/bachya/ecowitt2mqtt) - Forwards data received from ecowitt devices to the MQTT broker.
9275
- [x] [EMQX](https://www.emqx.io) - A MQTT broker.
@@ -128,5 +111,5 @@ No (cluster-wide) backup and restore has been implemented as of yet.
128111

129112
## Continuous Integration and Automations
130113

131-
- [GitHub Actions](https://docs.github.com/en/actions) are linting and templating all Helm charts.
132-
- [Renovate Bot](https://github.com/renovatebot/renovate) is updating Helm (sub)charts and used container images in the `values.yaml` files, and GitHub Actions.
114+
- [GitHub Actions](https://docs.github.com/en/actions) are linting all YAML files.
115+
- [Renovate Bot](https://github.com/renovatebot/renovate) is updating Helm releases and used container images in the `values.yaml` files, and GitHub Actions.

app-of-apps/applications.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
apiVersion: kustomize.toolkit.fluxcd.io/v1
3+
kind: Kustomization
4+
metadata:
5+
name: applications
6+
spec:
7+
targetNamespace: flux-system
8+
sourceRef:
9+
kind: GitRepository
10+
name: cluster-applications
11+
path: ./applications/
12+
dependsOn:
13+
- name: infrastructure
14+
- name: core
15+
interval: 5m
16+
retryInterval: 2m
17+
timeout: 3m
18+
wait: true
19+
prune: true
20+
force: false
21+
patches:
22+
- patch: |-
23+
apiVersion: source.toolkit.fluxcd.io/v1beta2
24+
kind: HelmRepository
25+
metadata:
26+
name: not-used
27+
spec:
28+
interval: 10m
29+
target:
30+
kind: HelmRepository
31+
- patch: |-
32+
apiVersion: kustomize.toolkit.fluxcd.io/v1
33+
kind: Kustomization
34+
metadata:
35+
name: not-used
36+
spec:
37+
interval: 10m
38+
retryInterval: 2m
39+
timeout: 3m
40+
prune: true
41+
force: false
42+
target:
43+
kind: Kustomization
44+
- patch: |-
45+
apiVersion: helm.toolkit.fluxcd.io/v2beta1
46+
kind: HelmRelease
47+
metadata:
48+
name: not-used
49+
spec:
50+
interval: 10m
51+
maxHistory: 3
52+
install:
53+
createNamespace: true
54+
crds: Create
55+
remediation:
56+
retries: -1
57+
upgrade:
58+
crds: CreateReplace
59+
remediation:
60+
retries: -1
61+
rollback:
62+
recreate: true
63+
target:
64+
kind: HelmRelease

0 commit comments

Comments
 (0)