Skip to content

Commit 9a5bf9a

Browse files
authored
Initial commit
0 parents  commit 9a5bf9a

File tree

140 files changed

+4333
-0
lines changed

Some content is hidden

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

140 files changed

+4333
-0
lines changed

.editorconfig

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
; https://editorconfig.org/
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.cue]
14+
indent_style = tab
15+
indent_size = 4
16+
17+
[*.md]
18+
indent_size = 4
19+
trim_trailing_whitespace = false
20+
21+
[*.sh]
22+
indent_size = 4

.gitattributes

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text=auto eol=lf
2+
*.env linguist-detectable linguist-language=SHELL
3+
*.json linguist-detectable linguist-language=JSON
4+
*.json5 linguist-detectable linguist-language=JSON5
5+
*.md linguist-detectable linguist-language=MARKDOWN
6+
*.sh linguist-detectable linguist-language=SHELL
7+
*.toml linguist-detectable linguist-language=TOML
8+
*.yml linguist-detectable linguist-language=YAML
9+
*.yaml linguist-detectable linguist-language=YAML
10+
*.yaml.j2 linguist-detectable linguist-language=YAML

.github/labeler.yaml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
area/bootstrap:
3+
- changed-files:
4+
- any-glob-to-any-file: bootstrap/**/*
5+
area/docs:
6+
- changed-files:
7+
- any-glob-to-any-file:
8+
- "README.md"
9+
area/github:
10+
- changed-files:
11+
- any-glob-to-any-file: .github/**/*
12+
area/kubernetes:
13+
- changed-files:
14+
- any-glob-to-any-file: kubernetes/**/*
15+
area/renovate:
16+
- changed-files:
17+
- any-glob-to-any-file:
18+
- ".renovate/**/*"
19+
- ".renovaterc.json5"
20+
area/scripts:
21+
- changed-files:
22+
- any-glob-to-any-file: scripts/**/*
23+
area/talos:
24+
- changed-files:
25+
- any-glob-to-any-file: talos/**/*
26+
area/taskfile:
27+
- changed-files:
28+
- any-glob-to-any-file:
29+
- ".taskfiles/**/*"
30+
- "Taskfile.yaml"
31+
area/templates:
32+
- changed-files:
33+
- any-glob-to-any-file: templates/**/*

.github/labels.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# Areas
3+
- name: area/bootstrap
4+
color: "0e8a16"
5+
- name: area/docs
6+
color: "0e8a16"
7+
- name: area/github
8+
color: "0e8a16"
9+
- name: area/kubernetes
10+
color: "0e8a16"
11+
- name: area/renovate
12+
color: "0e8a16"
13+
- name: area/scripts
14+
color: "0e8a16"
15+
- name: area/talos
16+
color: "0e8a16"
17+
- name: area/templates
18+
color: "0e8a16"
19+
- name: area/taskfile
20+
color: "0e8a16"
21+
# Renovate Types
22+
- name: renovate/container
23+
color: "027fa0"
24+
- name: renovate/github-action
25+
color: "027fa0"
26+
- name: renovate/grafana-dashboard
27+
color: "027fa0"
28+
- name: renovate/github-release
29+
color: "027fa0"
30+
- name: renovate/helm
31+
color: "027fa0"
32+
# Semantic Types
33+
- name: type/digest
34+
color: "ffeC19"
35+
- name: type/patch
36+
color: "ffeC19"
37+
- name: type/minor
38+
color: "ff9800"
39+
- name: type/major
40+
color: "f6412d"
41+
# Uncategorized
42+
- name: community
43+
color: "370fb2"
44+
- name: hold
45+
color: "ee0701"

.github/release.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- renovate

.github/tests/nodes.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
nodes:
2+
- name: k8s-0
3+
address: 10.10.10.100
4+
controller: true
5+
disk: /dev/sdfake
6+
mac_addr: 00:00:00:00:00:00
7+
schematic_id: "376567988ad370138ad8b2698212367b8edcb69b5fd68c80be1f2ec7d603b4ba"
8+
- name: k8s-1
9+
address: 10.10.10.101
10+
controller: false
11+
disk: /dev/sdfake
12+
mac_addr: 00:00:00:00:00:01
13+
schematic_id: "376567988ad370138ad8b2698212367b8edcb69b5fd68c80be1f2ec7d603b4ba"
14+
mtu: 1500
15+
secureboot: true
16+
encrypt_disk: true

.github/tests/private.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
node_cidr: "10.10.10.0/24"
3+
# node_default_gateway: ""
4+
# node_vlan_tag:
5+
# cluster_pod_cidr: ""
6+
# cluster_svc_cidr: ""
7+
# node_dns_servers: []
8+
# node_ntp_servers: []
9+
cluster_api_addr: "10.10.10.254"
10+
# cluster_api_tls_sans: []
11+
cluster_ingress_addr: "10.10.10.252"
12+
cluster_dns_gateway_addr: "10.10.10.253"
13+
repository_name: "onedr0p/cluster-template"
14+
# repository_branch: ""
15+
repository_visibility: "private"
16+
cloudflare_domain: "example.com"
17+
cloudflare_token: "fake"
18+
# cloudflare_cluster_issuer: ""
19+
cloudflare_ingress_addr: "10.10.10.251"
20+
# cilium_bgp_router_addr: ""
21+
# cilium_bgp_router_asn: ""
22+
# cilium_bgp_node_asn: ""
23+
# cilium_loadbalancer_mode: ""

.github/tests/public.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
node_cidr: "10.10.10.0/24"
3+
node_default_gateway: "10.10.10.1"
4+
node_vlan_tag: "100"
5+
cluster_pod_cidr: "10.42.0.0/16"
6+
cluster_svc_cidr: "10.43.0.0/16"
7+
node_dns_servers: ["1.1.1.1"]
8+
node_ntp_servers: ["162.159.200.123"]
9+
cluster_api_addr: "10.10.10.254"
10+
cluster_api_tls_sans: ["example.com"]
11+
cluster_ingress_addr: "10.10.10.252"
12+
cluster_dns_gateway_addr: "10.10.10.253"
13+
repository_name: "onedr0p/cluster-template"
14+
repository_branch: "main"
15+
repository_visibility: "public"
16+
cloudflare_domain: "example.com"
17+
cloudflare_token: "fake"
18+
cloudflare_cluster_issuer: "staging"
19+
cloudflare_ingress_addr: "10.10.10.251"
20+
cilium_loadbalancer_mode: "dsr"
21+
cilium_bgp_router_addr: "10.10.1.1"
22+
cilium_bgp_router_asn: "64513"
23+
cilium_bgp_node_asn: "64514"

.github/workflows/e2e.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
3+
name: "e2e"
4+
5+
on:
6+
workflow_dispatch:
7+
pull_request:
8+
branches: ["main"]
9+
paths-ignore:
10+
- kubernetes/**
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
configure:
18+
if: ${{ github.repository == 'onedr0p/cluster-template' }}
19+
name: configure
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
config-files:
25+
- public
26+
- private
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Setup mise
32+
uses: jdx/mise-action@v2
33+
env:
34+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
35+
36+
- name: Install dependencies
37+
run: mise run deps
38+
39+
- name: Run init task
40+
run: task init
41+
42+
- name: Prepare files
43+
run: |
44+
cp ./.github/tests/${{ matrix.config-files }}.yaml cluster.yaml
45+
cp ./.github/tests/nodes.yaml nodes.yaml
46+
echo '{"AccountTag":"fake","TunnelSecret":"fake","TunnelID":"fake"}' > cloudflare-tunnel.json
47+
touch kubeconfig
48+
49+
- name: Run configure task
50+
run: task configure --yes
51+
52+
- name: Run generate talconfig task
53+
run: |
54+
FILENAME=talos/talsecret.sops.yaml
55+
talhelper gensecret | sops --filename-override $FILENAME --encrypt /dev/stdin > $FILENAME
56+
task talos:generate-config
57+
58+
- name: Run flux-local test
59+
uses: docker://ghcr.io/allenporter/flux-local:v7.2.1@sha256:2c8d7f87f6d98e189378b7fc1af3974c0d701ebbd1fabb6bd883e781170f3057
60+
with:
61+
args: test --enable-helm --all-namespaces --path /github/workspace/kubernetes/flux/cluster -v
62+
63+
- name: Dry run bootstrap talos task
64+
run: task bootstrap:talos --dry
65+
66+
- name: Dry run bootstrap apps task
67+
run: task bootstrap:apps --dry
68+
69+
- name: Run reset task
70+
run: task template:reset --yes
71+
72+
- name: Run cleanup task
73+
run: task template:tidy --yes

.github/workflows/flux-local.yaml

+121
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
3+
name: "Flux Local"
4+
5+
on:
6+
pull_request:
7+
branches: ["main"]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
pre-job:
15+
name: Flux Local Pre-Job
16+
runs-on: ubuntu-latest
17+
outputs:
18+
any_changed: ${{ steps.changed-files.outputs.any_changed }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Get Changed Files
24+
id: changed-files
25+
uses: tj-actions/changed-files@v45
26+
with:
27+
files: kubernetes/**
28+
29+
test:
30+
name: Flux Local Test
31+
needs: pre-job
32+
runs-on: ubuntu-latest
33+
if: ${{ needs.pre-job.outputs.any_changed == 'true' }}
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Run flux-local test
39+
uses: docker://ghcr.io/allenporter/flux-local:v7.2.1
40+
with:
41+
args: test --enable-helm --all-namespaces --path /github/workspace/kubernetes/flux/cluster -v
42+
43+
diff:
44+
name: Flux Local Diff
45+
needs: pre-job
46+
runs-on: ubuntu-latest
47+
permissions:
48+
pull-requests: write
49+
strategy:
50+
matrix:
51+
resources: ["helmrelease", "kustomization"]
52+
max-parallel: 4
53+
fail-fast: false
54+
if: ${{ needs.pre-job.outputs.any_changed == 'true' }}
55+
steps:
56+
- name: Checkout Pull Request Branch
57+
uses: actions/checkout@v4
58+
with:
59+
path: pull
60+
61+
- name: Checkout Default Branch
62+
uses: actions/checkout@v4
63+
with:
64+
ref: "${{ github.event.repository.default_branch }}"
65+
path: default
66+
67+
- name: Run flux-local diff
68+
uses: docker://ghcr.io/allenporter/flux-local:v7.2.1
69+
with:
70+
args: >-
71+
diff ${{ matrix.resources }}
72+
--unified 6
73+
--path /github/workspace/pull/kubernetes/flux/cluster
74+
--path-orig /github/workspace/default/kubernetes/flux/cluster
75+
--strip-attrs "helm.sh/chart,checksum/config,app.kubernetes.io/version,chart"
76+
--limit-bytes 10000
77+
--all-namespaces
78+
--sources "flux-system"
79+
--output-file diff.patch
80+
81+
- name: Generate Diff
82+
id: diff
83+
run: |
84+
cat diff.patch;
85+
{
86+
echo 'diff<<EOF'
87+
cat diff.patch
88+
echo EOF
89+
} >> "$GITHUB_OUTPUT";
90+
{
91+
echo "### Diff"
92+
echo '```diff'
93+
cat diff.patch
94+
echo '```'
95+
} >> "$GITHUB_STEP_SUMMARY"
96+
97+
- name: Add Comment
98+
if: ${{ steps.diff.outputs.diff != '' }}
99+
continue-on-error: true
100+
uses: mshick/add-pr-comment@v2
101+
with:
102+
message-id: "${{ github.event.pull_request.number }}/kubernetes/${{ matrix.resources }}"
103+
message-failure: Diff was not successful
104+
message: |
105+
```diff
106+
${{ steps.diff.outputs.diff }}
107+
```
108+
109+
flux-local-status:
110+
name: Flux Local Success
111+
needs: ["test", "diff"]
112+
runs-on: ubuntu-latest
113+
if: ${{ always() }}
114+
steps:
115+
- name: Any jobs failed?
116+
if: ${{ contains(needs.*.result, 'failure') }}
117+
run: exit 1
118+
119+
- name: All jobs passed or skipped?
120+
if: ${{ !(contains(needs.*.result, 'failure')) }}
121+
run: echo "All jobs passed or skipped" && echo "${{ toJSON(needs.*.result) }}"

0 commit comments

Comments
 (0)