Skip to content

Commit

Permalink
chore: update bootstrap and task components with latest updates from @…
Browse files Browse the repository at this point in the history
  • Loading branch information
mihirsamdarshi committed Jul 19, 2023
1 parent bbaa07b commit b345bfc
Show file tree
Hide file tree
Showing 226 changed files with 5,799 additions and 1,763 deletions.
124 changes: 0 additions & 124 deletions .config.sample.env

This file was deleted.

2 changes: 0 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#shellcheck disable=SC2148,SC2155
export KUBECONFIG=$(expand_path ./kubeconfig)
export ANSIBLE_CONFIG=$(expand_path ./ansible.cfg)
export ANSIBLE_HOST_KEY_CHECKING="False"
export K8S_AUTH_KUBECONFIG=$(expand_path ./kubeconfig)
export SOPS_AGE_KEY_FILE=$(expand_path ~/.config/sops/age/keys.txt)
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* text=auto eol=lf
*.yaml.j2 linguist-language=YAML
*.sops.* diff=sopsdiffer
*.sops.toml linguist-language=JSON
4 changes: 2 additions & 2 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ area/github:
- ".github/**/*"
area/kubernetes:
- "kubernetes/**/*"
area/templates:
- "tmpl/**/*"
area/bootstrap:
- "bootstrap/**/*"
2 changes: 1 addition & 1 deletion .github/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- name: area/template
color: "72ccf3"
description: >-
Changes made in the tmpl directory
Changes made in the template directory
# Renovate
- name: renovate/ansible
color: "ffc300"
Expand Down
40 changes: 30 additions & 10 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
":disableRateLimiting",
":dependencyDashboard",
":semanticCommits",
":enablePreCommit",
":automergeDigest",
":automergeBranch",
"github>onedr0p/flux-cluster-template//.github/renovate/autoMerge.json5",
Expand All @@ -20,28 +19,49 @@
"dependencyDashboardTitle": "Renovate Dashboard 🤖",
"suppressNotifications": ["prIgnoreNotification"],
"rebaseWhen": "conflicted",
"schedule": ["every saturday"],
"pre-commit": {
"enabled": true
"schedule": ["on saturday"],
"ansible-galaxy": {
"fileMatch": [
"(^|/)requirements\\.ya?ml(\\.j2)?$",
"(^|/)galaxy\\.ya?ml(\\.j2)?$"
]
},
"flux": {
"fileMatch": ["kubernetes/.+\\.ya?ml$"]
"fileMatch": [
"(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$",
"(^|/)addons/.+\\.ya?ml(\\.j2)?$"
]
},
"helm-values": {
"fileMatch": ["kubernetes/.+\\.ya?ml$"]
"fileMatch": [
"(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$",
"(^|/)addons/.+\\.ya?ml(\\.j2)?$"
]
},
"kubernetes": {
"fileMatch": [
"ansible/.+\\.ya?ml.j2$",
"kubernetes/.+\\.ya?ml$"
"(^|/)ansible/.+\\.ya?ml(\\.j2)?$",
"(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$",
"(^|/)addons/.+\\.ya?ml(\\.j2)?$"
]
},
"kustomize": {
"fileMatch": [
"(^|/)kustomization\\.ya?ml(\\.j2)?$"
]
},
"pip_requirements": {
"fileMatch": [
"(^|/)[\\w-]*requirements(-\\w+)?\\.(txt|pip)(\\.j2)?$"
]
},
"regexManagers": [
{
"description": "Process various other dependencies",
"fileMatch": [
"ansible/.+\\.ya?ml$",
"kubernetes/.+\\.ya?ml$"
"(^|/)ansible/.+\\.ya?ml(\\.j2)?$",
"(^|/)kubernetes/.+\\.ya?ml(\\.j2)?$",
"(^|/)addons/.+\\.ya?ml(\\.j2)?$"
],
"matchStrings": [
"datasource=(?<datasource>\\S+) depName=(?<depName>\\S+)( registryUrl=(?<registryUrl>\\S+))?\n.*?\"(?<currentValue>.*)\"\n"
Expand Down
4 changes: 2 additions & 2 deletions .sops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ creation_rules:
encrypted_regex: "^(data|stringData)$"
key_groups:
- age:
- age13p9s7k5su7ns4ys54qfj2cn2kekcv0h0jxg2hdgl68cy9yajvauqk82apf
- "age13p9s7k5su7ns4ys54qfj2cn2kekcv0h0jxg2hdgl68cy9yajvauqk82apf"
- path_regex: ansible/.*\.sops\.ya?ml
key_groups:
- age:
- age13p9s7k5su7ns4ys54qfj2cn2kekcv0h0jxg2hdgl68cy9yajvauqk82apf
- "age13p9s7k5su7ns4ys54qfj2cn2kekcv0h0jxg2hdgl68cy9yajvauqk82apf"
95 changes: 95 additions & 0 deletions .taskfiles/AnsibleTasks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
version: "3"

env:
K8S_AUTH_KUBECONFIG: "{{.ROOT_DIR}}/kubeconfig"

vars:
ANSIBLE_PLAYBOOK_DIR: "{{.ANSIBLE_DIR}}/playbooks"
ANSIBLE_INVENTORY_DIR: "{{.ANSIBLE_DIR}}/inventory"

tasks:

deps:
desc: Install / Upgrade Ansible galaxy deps
dir: "{{.ANSIBLE_DIR}}"
cmds:
- pip3 install --user --requirement requirements.txt
- ansible-galaxy install -r requirements.yaml --roles-path ~/.ansible/roles --force
- ansible-galaxy collection install -r requirements.yaml --collections-path ~/.ansible/collections --force
preconditions:
- test -f "{{.ANSIBLE_DIR}}/requirements.txt"
- test -f "{{.ANSIBLE_DIR}}/requirements.yaml"
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

list:
desc: List all the hosts
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --list-hosts
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

prepare:
desc: Prepare all the k8s nodes for running k3s
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-prepare.yaml
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

install:
desc: Install Kubernetes on the nodes
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-installation.yaml
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

rollout-update:
desc: Preform operating system updates and rollout restart the cluster
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-rollout-update.yaml
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

kube-vip:
desc: Apply new kube-vip configuration to the cluster
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-kube-vip.yaml
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

nuke:
desc: Uninstall Kubernetes on the nodes
dir: "{{.ANSIBLE_DIR}}"
interactive: true
cmd: ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-nuke.yaml
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

ping:
desc: Ping all the hosts
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --one-line -m 'ping'
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

uptime:
desc: Uptime of all the hosts
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml --one-line -a 'uptime'
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

force-reboot:
desc: Reboot all the k8s nodes
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible-playbook -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml {{.ANSIBLE_PLAYBOOK_DIR}}/cluster-reboot.yaml
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"

force-poweroff:
desc: Shutdown all the k8s nodes
dir: "{{.ANSIBLE_DIR}}"
cmd: ansible kubernetes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yaml -a '/usr/bin/systemctl poweroff' --become
env:
ANSIBLE_CONFIG: "{{.ANSIBLE_DIR}}/ansible.cfg"
Loading

0 comments on commit b345bfc

Please sign in to comment.