Skip to content

Commit

Permalink
commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rkfella committed Nov 20, 2024
0 parents commit f1cc914
Show file tree
Hide file tree
Showing 391 changed files with 17,906 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
FROM alpine:3.20@sha256:1e42bbe2508154c9126d48c2b8a75420c3544343bf86fd041fb7527e017a4b4a

ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG FLUX_VERSION=2.4.0

ENV SHELL=/bin/bash

WORKDIR /tmp

RUN echo "**** Installing packages ****" && \
apk add --no-cache \
coreutils \
curl \
cosign \
jq \
nano \
bash \
openssl \
ca-certificates \
git \
github-cli \
libstdc++ \
direnv \
yq \
unzip && \
echo "**** Creating user and group ****" && \
addgroup -g $USER_GID $USERNAME && \
adduser -u $USER_UID -G $USERNAME -s /bin/sh -D $USERNAME && \
echo "**** Adding direnv hook ****" && \
echo 'eval "$(direnv hook bash)"' >> /home/$USERNAME/.bashrc && \
echo "**** Installing binaries ****" && \
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256" && \
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check --strict && \
chmod +x ./kubectl && \
mv ./kubectl /usr/local/bin/kubectl && \
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && \
chmod +x get_helm.sh && \
./get_helm.sh && \
curl -LO https://github.com/getsops/sops/releases/download/$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name')/sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').linux.amd64 && \
curl -LO https://github.com/getsops/sops/releases/download/$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name')/sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').checksums.txt && \
curl -LO https://github.com/getsops/sops/releases/download/$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name')/sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').checksums.pem && \
curl -LO https://github.com/getsops/sops/releases/download/$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name')/sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').checksums.sig && \
cosign verify-blob sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').checksums.txt \
--certificate sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').checksums.pem \
--signature sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').checksums.sig \
--certificate-identity-regexp=https://github.com/getsops \
--certificate-oidc-issuer=https://token.actions.githubusercontent.com && \
grep "sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').linux.amd64" sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').checksums.txt > checksum-linux-amd64.txt && \
echo "$(cat checksum-linux-amd64.txt)" | sha256sum --check --strict && \
mv sops-$(curl -s https://api.github.com/repos/getsops/sops/releases/latest | jq -r '.tag_name').linux.amd64 /usr/local/bin/sops && \
chmod +x /usr/local/bin/sops && \
curl -sL https://talos.dev/install | sh && \
curl -LO https://github.com/helmfile/helmfile/releases/download/$(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest | jq -r '.tag_name')/helmfile_$(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest | jq -r '.tag_name' | sed 's/^v//')_checksums.txt && \
curl -LO https://github.com/helmfile/helmfile/releases/download/$(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest | jq -r '.tag_name')/helmfile_$(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest | jq -r '.tag_name' | sed 's/^v//')_linux_amd64.tar.gz && \
grep "helmfile_$(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest | jq -r '.tag_name' | sed 's/^v//')_linux_amd64.tar.gz" helmfile_$(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest | jq -r '.tag_name' | sed 's/^v//')_checksums.txt > checksum-helmfile-linux-amd64.txt && \
echo "$(cat checksum-helmfile-linux-amd64.txt)" | sha256sum --check --strict && \
tar -xvzf helmfile_$(curl -s https://api.github.com/repos/helmfile/helmfile/releases/latest | jq -r '.tag_name' | sed 's/^v//')_linux_amd64.tar.gz && \
chmod +x ./helmfile && \
mv helmfile /usr/local/bin/helmfile && \
curl -fsSL -o get_task.sh https://taskfile.dev/install.sh && \
chmod +x ./get_task.sh && \
./get_task.sh -d -b /usr/local/bin && \
curl -s https://fluxcd.io/install.sh | FLUX_VERSION=$FLUX_VERSION bash && \
echo "**** Cleaning up ****" && \
rm -rf /root/.cache /tmp/*

WORKDIR /project

USER $USERNAME

CMD ["/bin/bash"]
65 changes: 65 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//devcontainer.json
{
"name": "Kubernetes Management",

"image": "ghcr.io/darkfella91/devcontainer:v1.0.0@sha256:44022f9e83154e942e865b833b53c6247fa5818cba01defc51afa55c9cd2eb63",

"postStartCommand": "/usr/bin/direnv allow /project/.envrc",

"workspaceFolder": "/project",
"workspaceMount": "source=${localWorkspaceFolder},target=/project,type=bind,consistency=cached",

"customizations": {
"vscode": {
"settings": {
"editor.bracketPairColorization.enabled": true,
"editor.fontFamily": "FiraCode Nerd Font",
"editor.fontLigatures": true,
"editor.guides.bracketPairs": true,
"editor.guides.bracketPairsHorizontal": true,
"editor.guides.highlightActiveBracketPair": true,
"editor.hover.delay": 1500,
"editor.rulers": [
100
],
"editor.stickyScroll.enabled": false,
"explorer.autoReveal": false,
"files.associations": {
"**/*.json5": "jsonc"
},
"files.trimTrailingWhitespace": true,
"material-icon-theme.files.associations": {
"*.secret.sops.env": "lock",
"*.secret.sops.yaml": "lock"
},
"material-icon-theme.folders.associations": {
".archive": "archive",
".github/workflows": "robot",
"actions-runner-system": "github",
"cert-manager": "guard",
"digester-system": "hook",
"external-secrets": "secure",
"flux-system": "pipe",
"flux": "pipe",
"kube-system": "kubernetes",
"network": "connection",
"observability": "event",
"rook-ceph": "base",
"storage": "dump",
"system-upgrade": "update",
"tools": "tools",
"volsync": "aws",
"cloudflared": "cloudflare",
"kubernetes/main": "kubernetes",
"talos": "linux"
},
"sops.defaults.ageKeyFile": "./age.key",
"yaml.schemaStore.enable": true,
"yaml.schemas": {
"kubernetes": "./kubernetes/**/*.yaml"
}
},
"extensions": ["signageos.signageos-vscode-sops","PKief.material-icon-theme","BriteSnow.vscode-toggle-quotes","redhat.vscode-yaml","mitchdenny.ecdc","mikestead.dotenv","fcrespo82.markdown-table-formatter","albert.TabOut"]
}
}
}
1 change: 1 addition & 0 deletions .devcontainer/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1.0.0
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
; https://editorconfig.org/

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
indent_style = tab
indent_size = 4

[*.md]
indent_size = 4
trim_trailing_whitespace = false

[{Dockerfile,*.bash,*.sh}]
indent_style = space
indent_size = 4
8 changes: 8 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#shellcheck disable=SC2148,SC2155
# Kubernetes
export KUBECONFIG="$(expand_path ./kubernetes/main/kubeconfig)"
export SOPS_AGE_KEY_FILE="$(expand_path ./age.key)"
export TALOSCONFIG="$(expand_path ./kubernetes/main/talosconfig)"
# Taskfile
export TASK_X_ENV_PRECEDENCE=1
export TASK_X_MAP_VARIABLES=0
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto eol=lf
*.sops.* diff=sopsdiffer
22 changes: 22 additions & 0 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# Areas
area/docs:
- changed-files:
- any-glob-to-any-file:
- "docs/**/*"
- "README.md"
area/github:
- changed-files:
- any-glob-to-any-file: ".github/**/*"
area/kubernetes:
- changed-files:
- any-glob-to-any-file: "kubernetes/**/*"
area/taskfile:
- changed-files:
- any-glob-to-any-file:
- ".taskfiles/**/*"
- "Taskfile.yaml"
# Clusters
cluster/main:
- changed-files:
- any-glob-to-any-file: "kubernetes/main/**/*"
38 changes: 38 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# Areas
- name: area/docs
color: "0e8a16"
- name: area/github
color: "0e8a16"
- name: area/kubernetes
color: "0e8a16"
- name: area/taskfile
color: "0e8a16"
# Clusters
- name: cluster/main
color: "ffc300"
# Renovate Types
- name: renovate/container
color: "027fa0"
- name: renovate/github-action
color: "027fa0"
- name: renovate/grafana-dashboard
color: "027fa0"
- name: renovate/github-release
color: "027fa0"
- name: renovate/helm
color: "027fa0"
# Semantic Types
- name: type/digest
color: "ffeC19"
- name: type/patch
color: "ffeC19"
- name: type/minor
color: "ff9800"
- name: type/major
color: "f6412d"
# Uncategorized
- name: community
color: "370fb2"
- name: hold
color: "ee0701"
45 changes: 45 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
"docker:enableMajor",
"replacements:k8s-registry-move",
":automergeBranch",
":disableRateLimiting",
":dependencyDashboard",
":semanticCommits",
":skipStatusChecks",
":timezone(Europe/Sofia)",
"github>Darkfella91/home-ops//.github/renovate/allowedVersions.json5",
"github>Darkfella91/home-ops//.github/renovate/autoMerge.json5",
"github>Darkfella91/home-ops//.github/renovate/clusters.json5",
"github>Darkfella91/home-ops//.github/renovate/commitMessage.json5",
"github>Darkfella91/home-ops//.github/renovate/customManagers.json5",
"github>Darkfella91/home-ops//.github/renovate/grafanaDashboards.json5",
"github>Darkfella91/home-ops//.github/renovate/groups.json5",
"github>Darkfella91/home-ops//.github/renovate/labels.json5",
"github>Darkfella91/home-ops//.github/renovate/packageRules.json5",
"github>Darkfella91/home-ops//.github/renovate/semanticCommits.json5"
],
"dependencyDashboardTitle": "Renovate Dashboard 🤖",
"suppressNotifications": ["prEditedNotification", "prIgnoreNotification"],
"onboarding": false,
"requireConfig": "ignored",
"ignorePaths": ["**/*.sops.*", "**/.archive/**", "**/resources/**"],
"flux": {
"fileMatch": [
"(^|/)kubernetes/.+\\.ya?ml(?:\\.j2)?$"
]
},
"helm-values": {
"fileMatch": [
"(^|/)kubernetes/.+\\.ya?ml(?:\\.j2)?$"
]
},
"kubernetes": {
"fileMatch": [
"(^|/)\\.taskfiles/.+\\.ya?ml(?:\\.j2)?$",
"(^|/)kubernetes/.+\\.ya?ml(?:\\.j2)?$"
]
}
}
10 changes: 10 additions & 0 deletions .github/renovate/allowedVersions.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"matchDatasources": ["docker"],
"matchPackagePatterns": ["postgresql"],
"allowedVersions": "<18"
}
]
}
21 changes: 21 additions & 0 deletions .github/renovate/autoMerge.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"description": ["Auto-merge container digests updates for trusted containers"],
"matchDatasources": ["docker"],
"automerge": true,
"automergeType": "branch",
"matchUpdateTypes": ["digest"],
"matchPackagePatterns": ["ghcr.io/bjw-s", "ghcr.io/onedr0p"]
},
{
"description": ["Auto-merge GitHub Actions for minor and patch"],
"matchManagers": ["github-actions"],
"matchDatasources": ["github-tags"],
"automerge": true,
"automergeType": "branch",
"matchUpdateTypes": ["minor", "patch"]
}
]
}
10 changes: 10 additions & 0 deletions .github/renovate/clusters.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"description": ["Separate PRs for main cluster"],
"matchFileNames": ["**/kubernetes/main/**"],
"additionalBranchPrefix": "main-"
}
]
}
16 changes: 16 additions & 0 deletions .github/renovate/commitMessage.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"commitMessageTopic": "{{depName}}",
"commitMessageExtra": "to {{newVersion}}",
"commitMessageSuffix": "",
"packageRules": [
{
"matchDatasources": ["helm"],
"commitMessageTopic": "chart {{depName}}"
},
{
"matchDatasources": ["docker"],
"commitMessageTopic": "image {{depName}}"
}
]
}
35 changes: 35 additions & 0 deletions .github/renovate/customManagers.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"customManagers": [
{
"customType": "regex",
"description": ["Process YAML custom dependencies"],
"fileMatch": [
"(^|/)kubernetes/.+\\.env$",
"(^|/)kubernetes/.+\\.ya?ml$"
],
"matchStrings": [
// # renovate: datasource=github-releases depName=k3s-io/k3s
// k3s_release_version: &version v1.29.0+k3s1
// # renovate: datasource=helm depName=cilium repository=https://helm.cilium.io
// version: 1.15.1
// # renovate: datasource=docker depName=ghcr.io/siderolabs/kubelet
// KUBERNETES_VERSION=v1.31.1
"datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( repository=(?<registryUrl>\\S+))?\\n.+(:\\s|=)(&\\S+\\s)?(?<currentValue>\\S+)",
// # renovate: datasource=github-releases depName=rancher/system-upgrade-controller
// https://github.com/rancher/system-upgrade-controller/releases/download/v0.13.2/crd.yaml
"datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)\\n.+/(?<currentValue>(v|\\d)[^/]+)",
"datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( repository=(?<registryUrl>\\S+))?\n.+?\"(?<currentValue>\\S+)\""
],
"datasourceTemplate": "{{#if datasource}}{{{datasource}}}{{else}}github-releases{{/if}}"
},
{
"customType": "regex",
"description": ["Process CloudnativePG Postgresql version"],
"fileMatch": ["(^|/)kubernetes/.+\\.ya?ml$"],
"matchStrings": ["imageName: (?<depName>\\S+):(?<currentValue>.*\\-.*)"],
"datasourceTemplate": "docker",
"versioningTemplate": "redhat"
}
]
}
Loading

0 comments on commit f1cc914

Please sign in to comment.