diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 641bf838748..913c0f474a8 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -36,7 +36,7 @@ }, "kustomize": { "fileMatch": [ - "(^|/)kustomization\\.ya?ml(\\.j2)?$" + "(^|/)kustomization\\.ya?ml(\\.j2)?(\\.j2)?$" ] }, // commit message topics @@ -228,7 +228,7 @@ "(^|/)addons/.+\\.ya?ml(\\.j2)?(\\.j2)?$", "(^|/)ansible/.+\\.ya?ml(\\.j2)?(\\.j2)?$", "(^|/)kubernetes/.+\\.ya?ml(\\.j2)?(\\.j2)?$", - "(^|/)k0s/.+\\.ya?ml(\\.j2)?(\\.j2)?$" + "(^|/)k0s-config.ya?ml(\\.j2)?(\\.j2)?$" ], "matchStrings": [ // Example: `k3s_release_version: "v1.27.3+k3s1"` diff --git a/.gitignore b/.gitignore index 1e9b603b3cc..0aec0a75ae7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ kubeconfig *.agekey *.pub *.key +# Private +.private # Ansible .venv* # Taskfile diff --git a/.taskfiles/FluxTasks.yaml b/.taskfiles/FluxTasks.yaml index c03b5965972..94c912dc6c5 100644 --- a/.taskfiles/FluxTasks.yaml +++ b/.taskfiles/FluxTasks.yaml @@ -29,12 +29,6 @@ tasks: - { msg: "Flux already appears installed", sh: "kubectl get namespace flux-system &>/dev/null && exit 1 || exit 0" } - { msg: "Age private key not found", sh: "test -f {{.ROOT_DIR}}/age.key" } - github-deploy-key: - cmds: - - sops --decrypt {{.KUBERNETES_DIR}}/bootstrap/github-deploy-key.sops.yaml | kubectl apply -f - - preconditions: - - { msg: "Flux is not installed", sh: "kubectl get namespace flux-system &>/dev/null && exit 0 || exit 1" } - apply: desc: Apply a Flux Kustomization resource for a cluster summary: | @@ -61,3 +55,9 @@ tasks: reconcile: desc: Force update Flux to pull in changes from your Git repository cmd: flux reconcile --namespace flux-system kustomization cluster --with-source + + github-deploy-key: + cmds: + - sops --decrypt {{.KUBERNETES_DIR}}/bootstrap/github-deploy-key.sops.yaml | kubectl apply --server-side --filename - + preconditions: + - { msg: "Flux is not installed", sh: "kubectl get namespace flux-system &>/dev/null && exit 0 || exit 1" } diff --git a/.taskfiles/RepoTasks.yaml b/.taskfiles/RepoTasks.yaml new file mode 100644 index 00000000000..b0af817ace3 --- /dev/null +++ b/.taskfiles/RepoTasks.yaml @@ -0,0 +1,36 @@ +--- +# yaml-language-server: $schema=https://taskfile.dev/schema.json +version: "3" + +tasks: + + clean: + desc: Clean files and directories no longer needed after cluster bootstrap + cmds: + # Move bootstrap directory to gitignored directory + - mkdir -p {{.ROOT}}/.private + - mv {{.ROOT}}/bootstrap {{.ROOT}}/.private + # Update renovate.json5 + - sed -i '' 's/(..\.j2)\?(..\.j2)\?//g' {{.ROOT}}/.github/renovate.json5 + - sed -i '' 's/addons/d' {{.ROOT}}/.github/renovate.json5 + preconditions: + - { msg: "bootstrap dir not found", sh: "test -d {{.ROOT}}/bootstrap" } + - { msg: "renovate.json5 not found", sh: "test -f {{.ROOT_DIR}}/.github/renovate.json5" } + + reset: + desc: Remove templated configuration files + prompt: Remove templated configuration files... continue? + cmds: + - rm -rf {{.ROOT}}/.sops.yaml + - rm -rf {{.ROOT}}/k0s-config.yaml + - rm -rf {{.ROOT}}/ansible + - rm -rf {{.ROOT}}/kubernetes + + reset-repo: + desc: Set repo back to HEAD + prompt: Set repo back to HEAD... continue? + cmds: + - task: reset + - git reset --hard HEAD + - git clean -f -d + - git pull diff --git a/Taskfile.yaml b/Taskfile.yaml index f207e3692ff..a99504996ea 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -18,6 +18,7 @@ includes: taskfile: .taskfiles/KubernetesTasks.yaml flux: .taskfiles/FluxTasks.yaml k0s: .taskfiles/K0sTasks.yaml + repo: .taskfiles/RepoTasks.yaml tasks: