Skip to content

Commit

Permalink
chore: Tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
szinn committed Jan 15, 2025
1 parent 159f763 commit 2641b80
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 201 deletions.
45 changes: 2 additions & 43 deletions .taskfiles/Bootstrap/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ tasks:
get-certs:
desc: Fetch certificates from cluster
cmds:
- for: { var: certs, split: " " }
- for: {var: certs, split: " "}
cmd: kubectl --context {{.cluster}} get secrets -n networking {{.ITEM}}-tls -o yaml | grep -v "creationTimestamp:" | grep -v "resourceVersion:" | grep -v " uid:" > kubernetes/{{.cluster}}/apps/{{.ITEM}}-tls.yaml
requires:
vars:
Expand All @@ -99,52 +99,11 @@ tasks:
put-certs:
desc: Upload certificates to cluster
cmds:
- for: { var: certs, split: " " }
- for: {var: certs, split: " "}
cmd: kubectl --context {{.cluster}} apply -f kubernetes/{{.cluster}}/apps/{{.ITEM}}-tls.yaml
requires:
vars:
- cluster
vars:
certs:
sh: 'echo {{if eq .cluster "main"}} "tech-wildcard wildcard" {{else}} "wildcard" {{end}}'

# dump:
# desc: Dump resources
# preconditions:
# - which helmfile kubectl
# - test -f "${TALOSCONFIG}"
# - test -f {{.CLUSTER_DIR}}/bootstrap/helmfile.yaml
# - test -f {{.CLUSTER_DIR}}/bootstrap/templates/resources.yaml.j2
# - talosctl --context {{.cluster}} config info
# requires:
# vars:
# - cluster
# env:
# TALOSCONFIG: "{{.CLUSTER_DIR}}/talosconfig"
# vars:
# CLUSTER_DIR: "{{.KUBERNETES_DIR}}/{{.cluster}}"
# cmds:
# - op run --env-file {{.CLUSTER_DIR}}/bootstrap/bootstrap.env --no-masking -- minijinja-cli "{{.CLUSTER_DIR}}/bootstrap/templates/resources.yaml.j2"

# NOTE: Nodes must all be part of the Ceph cluster
# rook:
# desc: Bootstrap Rook-Ceph [cluster={{.cluster}}]
# preconditions:
# - which kubectl talosctl
# - talosctl config info
# requires:
# vars:
# - cluster
# vars:
# BLUESTORE_DISKS_RAW:
# sh: talosctl --context {{.cluster}} get discoveredvolumes -o json | jq -r 'select(.spec.type=="disk" and .spec.name=="bluestore") | {"node":.node, "disk":.spec.dev_dath}' | jq -crs '.'
# BLUESTORE_DISKS:
# ref: "fromJson .BLUESTORE_DISKS_RAW"
# cmds:
# - for:
# var: BLUESTORE_DISKS
# vars:
# NODE:
# sh: kubectl --context {{.cluster}} get nodes -o json | jq -r '.items[] | select(.status.addresses[].address=="{{.ITEM.node}}") | .metadata.name'
# DISK: "{{ .ITEM.disk }}"
# task: :rook:wipe-disk
2 changes: 1 addition & 1 deletion .taskfiles/rook/resources/wipe-rook.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
- -c
args:
- |
apk add --no-cache findutils nvme-cli;
apk add --no-cache nvme-cli;
DISK={{ ENV.DISK }};
nvme id-ns -H $DISK
echo "=== Wiping $DISK ===";
Expand Down
2 changes: 1 addition & 1 deletion .taskfiles/sops/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ tasks:
SECRET_FILES:
sh: find . -type f -name '*.sops.yaml' ! -name ".sops.yaml"
cmds:
- for: { var: SECRET_FILES }
- for: {var: SECRET_FILES}
cmd: |
echo "Re-encrypting {{ .ITEM }}"
sops --decrypt --in-place "{{ .ITEM }}"
Expand Down
128 changes: 1 addition & 127 deletions .taskfiles/talos/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ tasks:
sh: ls {{.CLUSTER_CONFIG_ROOT}}/*.yaml
TALOSCONFIG: "{{.CLUSTER_DIR}}/talosconfig"
cmds:
- for: { var: CONFIG_FILES }
- for: {var: CONFIG_FILES}
task: _apply-machineconfig
vars:
cluster: "{{.cluster}}"
Expand Down Expand Up @@ -167,129 +167,3 @@ tasks:
"{{.KUBECONFIG}}"
- cmd: kubectl config delete-context "admin@{{.cluster}}"
ignore_error: true

# bootstrap-core:
# desc: Bootstrap core apps needed for Talos
# summary: |
# Args:
# cluster: Cluster to run command against (required)
# cmds:
# - echo {{.KUBECONFIG}}
# - kubectl config view
# - until kubectl --context {{.cluster}} wait --for=condition=Ready=False nodes --all --timeout=10m; do sleep 10; done
# - helmfile --quiet --kube-context {{.cluster}} --file {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos/apps/helmfile.yaml apply --skip-diff-on-install --suppress-diff
# - until kubectl --context {{.cluster}} wait --for=condition=Ready=True nodes --all --timeout=10m; do sleep 10; done
# requires:
# vars:
# - cluster
# preconditions:
# - test -f {{.KUBERNETES_DIR}}/{{.cluster}}/talosconfig
# - talosctl --talosconfig {{.KUBERNETES_DIR}}/{{.cluster}}/talosconfig --context {{.cluster}} config info >/dev/null 2>&1
# - test -f {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos/apps/helmfile.yaml

# rolling-upgrade:
# desc: Upgrade all Talos nodes
# summary: |
# Args:
# cluster: Cluster to run command against (required)
# cmds:
# - flux --context {{.cluster}} suspend kustomization --all
# # - task: :postgres:maintenance-{{.cluster}}
# # vars:
# # command: set
# - for: {var: nodes}
# task: upgrade
# vars:
# cluster: "{{.cluster}}"
# node: "{{.ITEM}}"
# rollout: "true"
# # - task: :postgres:maintenance-{{.cluster}}
# # vars:
# # command: unset
# - flux --context {{.cluster}} resume kustomization --all
# - task: :kubernetes:delete-failed-pods
# vars:
# cluster: "{{.cluster}}"
# vars:
# TARGET_TALOS_VERSION:
# sh: yq -r ".talosVersion" {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos/talconfig.yaml
# nodes:
# sh: talosctl --context {{.cluster}} config info --output json | jq '.nodes[]' | xargs -L 1 dig -x | awk '{print $5}' | sed -e 's/.$//'
# requires:
# vars:
# - cluster
# preconditions:
# - test -f {{.KUBERNETES_DIR}}/{{.cluster}}/talosconfig
# - talosctl --talosconfig {{.KUBERNETES_DIR}}/{{.cluster}}/talosconfig --context {{.cluster}} config info >/dev/null 2>&1
# # - talosctl --context {{.cluster}} --nodes {{.nodes}} get machineconfig >/dev/null 2>&1

# # task talos:upgrade cluster=main node=k8s-1
# # task talos:upgrade cluster=staging node=stage-1
# upgrade:
# desc: Upgrade Talos version for a node
# summary: |
# Args:
# cluster: Cluster to run command against (required)
# node: The node to upgrade
# cmd:
# bash {{.TALOS_SCRIPTS_DIR}}/upgrade.sh "{{.cluster}}" "{{.node}}" "{{.TALOS_IMAGE}}" "{{.rollout}}"
# # - echo "Upgrading node {{.node}}.zinn.tech on cluster {{.cluster}} to image {{.TALOS_IMAGE}}"
# # - read -p "Press any key to resume ..."
# # - talosctl --context {{.cluster}} upgrade -n {{.node}}.zinn.tech --image {{.TALOS_IMAGE}}
# vars:
# rollout: '{{.rollout | default "false"}}'
# TALOS_VERSION:
# sh: |
# yq -r ".talosVersion" {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos/talconfig.yaml
# TALOS_IMAGE:
# sh: |
# talhelper genurl installer \
# --env-file {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos/talenv.sops.yaml \
# --config-file {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos/talconfig.yaml \
# | grep {{.node}} \
# | awk '{split($0,u," "); print u[2]}'
# requires:
# vars:
# - cluster
# - node
# preconditions:
# - which talhelper
# - talosctl config get-contexts | grep {{.cluster}}
# - test -f {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos/talenv.sops.yaml
# - test -f {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos/talconfig.yaml
# - msg: "Talos image could not be determined for {{.node}}"
# sh: 'test -n "{{.TALOS_IMAGE}}"'

# # task talos:upgrade-k8s cluster=main
# # task talos:upgrade-k8s cluster=staging
# upgrade-k8s:
# desc: Upgrade Kubernetes version for a Talos cluster
# summary: |
# Args:
# cluster: Cluster to run command against (required)
# cmds:
# - echo "Upgrading k8s on cluster {{.cluster}} to {{.KUBERNETES_VERSION}} via node {{.CONTROLPLANE_NODE}}"
# - read -p "Press any key to resume ..."
# - talosctl --talosconfig {{.KUBERNETES_DIR}}/{{.cluster}}/talosconfig --context {{.cluster}} upgrade-k8s -n {{.CONTROLPLANE_NODE}} --to {{.KUBERNETES_VERSION}}
# vars:
# KUBERNETES_VERSION:
# sh: |
# yq -r ".kubernetesVersion" {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos//talconfig.yaml
# CONTROLPLANE_NODE:
# sh: |
# talosctl --context {{.cluster}} config info \
# | grep Endpoints: \
# | awk '{split($0,u," "); print u[2]}' \
# | sed -E 's/,//'
# requires:
# vars:
# - cluster
# preconditions:
# - which talhelper
# - talosctl config get-contexts | grep {{.cluster}}
# - test -f {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos//talenv.sops.yaml
# - test -f {{.KUBERNETES_DIR}}/{{.cluster}}/bootstrap/talos//talconfig.yaml
# - msg: "Kubernetes version could not be determined for cluster {{.cluster}}"
# sh: 'test -n "{{.KUBERNETES_VERSION}}"'
# - msg: "Control plane node could not be determined for cluster {{.cluster}}"
# sh: 'test -n "{{.CONTROLPLANE_NODE}}"'
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"files.associations": {
"*.json5": "jsonc",
"ansible/**/*.sops.toml": "plaintext",
"kubernetes/**/*.sops.toml": "plaintext",
"terraform/**/*.tf": "terraform"
"kubernetes/**/*.sops.toml": "plaintext"
},
"files.exclude": {
".direnv/": true,
Expand Down
28 changes: 1 addition & 27 deletions ansible/files/pikvm/override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,6 @@
# #
####################################################################
#
#########
# Wrong #
#########
# kvmd:
# gpio:
# drivers: ...
# kvmd:
# gpio:
# scheme: ...
#
###########
# Correct #
###########
# kvmd:
# gpio:
# drivers: ...
# scheme: ...
#
###########
# Example #
###########
# vnc:
# # See https://github.com/pikvm/pikvm/blob/master/pages/vnc.md
# keymap: /usr/share/kvmd/keymaps/ru # Set russian keymap
# auth:
# vncauth:
# enabled: true # Enable auth via /etc/kvmd/vncpasswd
kvmd:
gpio:
drivers:
Expand Down Expand Up @@ -206,5 +179,6 @@ kvmd:
- ["#Ragnar", server7_led, server7_switch|Switch]
- ["#Ares", server8_led, server8_switch|Switch]
- ["#Artemis", server9_led, server9_switch|Switch]
# - ["#DontUse - USB not working", server10_led, server10_switch|Switch]
- ["#Apollo", server11_led, server11_switch|Switch]
- ["#Hera", server12_led, server12_switch|Switch]

0 comments on commit 2641b80

Please sign in to comment.