Skip to content

Commit

Permalink
Massive revamp
Browse files Browse the repository at this point in the history
- Modified ansible roles to set priority labels on nodes
- Adding correct label to worker nodes
- Added pihole and switched back to adguard
- Migrated home-assistant and deleted the old one
- Modified all services to support priority node selector
  • Loading branch information
LarryGF committed Aug 25, 2023
1 parent 0f6bc99 commit 826340c
Show file tree
Hide file tree
Showing 40 changed files with 147 additions and 277 deletions.
6 changes: 6 additions & 0 deletions ansible/roles/k3s/master/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,9 @@
daemon_reload: yes
state: started
enabled: yes


- name: Add priority label to master servers
become: no
local_action:
module: command kubectl --kubeconfig ~/.kube/config label nodes {{ inventory_hostname }} priority=critical --overwrite
10 changes: 10 additions & 0 deletions ansible/roles/k3s/node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@
daemon_reload: yes
state: restarted
enabled: yes

- name: Add label to agent server if not already labeled
become: no
local_action:
module: command kubectl --kubeconfig ~/.kube/config label nodes {{ inventory_hostname }} node-role.kubernetes.io/worker={{ inventory_hostname }} --overwrite

- name: Add priority label to agent servers
become: no
local_action:
module: command kubectl --kubeconfig ~/.kube/config label nodes {{ inventory_hostname }} priority=low --overwrite
13 changes: 10 additions & 3 deletions terraform/applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ plex:
jellyseerr:
name: jellyseerr
namespace: services
priority: low
deploy: true
volumes:
config:
Expand All @@ -156,6 +157,7 @@ tautulli:
name: tautulli
namespace: services
deploy: false
priority: low
volumes:
config:
enabled: false
Expand Down Expand Up @@ -220,6 +222,7 @@ renovate:
home-assistant:
name: home-assistant
namespace: services
priority: low
deploy: true
volumes:
config:
Expand Down Expand Up @@ -276,6 +279,7 @@ filebrowser:
name: filebrowser
namespace: services
deploy: true
priority: low
volumes:
config:
enabled: false
Expand Down Expand Up @@ -307,10 +311,11 @@ sabnzbd:
bazarr:
name: bazarr
namespace: services
deploy: false
deploy: true
priority: low
volumes:
config:
enabled: false
enabled: true
name: bazarr-config
size: 200Mi
access_modes:
Expand All @@ -322,7 +327,8 @@ bazarr:
flood:
name: flood
namespace: services
deploy: true
deploy: false
priority: low
volumes:
config:
enabled: false
Expand Down Expand Up @@ -369,6 +375,7 @@ mylar:
name: mylar
namespace: services
deploy: false
priority: low
volumes:
config:
enabled: false
Expand Down
1 change: 1 addition & 0 deletions terraform/gitops.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module "argocd_application" {
name = each.value.name
namespace = each.value.namespace
storage_definitions = each.value.volumes
priority = try(each.value.priority,"critical")
deploy = each.value.deploy
project = module.gitops.project
server_side = try(each.value.server_side, "false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ authelia:
## Authelia must be served from the domain or a subdomain under it.
domain: ${duckdns_domain}.duckdns.org

nodeSelector:
priority: ${priority}

ingress:
enabled: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ bazarr:
PGID: 1001
PUID: 1001
TZ: ${timezone}

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
annotations:
cert-manager.io/cluster-issuer: letsencrypt
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.entrypoints: websecure-ext
gethomepage.dev/enabled: "true"
gethomepage.dev/name: "Bazarr"
gethomepage.dev/description: "Bazarr is a companion application to Sonarr and Radarr that manages and downloads subtitles"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ dex:
# See the [API reference](https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#hostname-and-name-resolution)
hostAliases: []

nodeSelector:
priority: ${priority}

configSecret:
create: true
name: ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
duplicati:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
filebrowser:
nodeSelector:
kubernetes.io/hostname: "${master_hostname}"

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
rtorrent-flood:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
grafana:

nodeSelector:
priority: ${priority}

ingress:
enabled: true
annotations:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
home-assistant:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
homepage:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
jellyseerr:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
kube-prometheus-stack:

nodeSelector:
priority: ${priority}

alertmanager:
ingress:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
kubeview:

nodeSelector:
priority: ${priority}

ingress:
ingressClassName: traefik
annotations:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
loki:

nodeSelector:
priority: ${priority}

Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
mylar:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
annotations:
cert-manager.io/cluster-issuer: letsencrypt
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.entrypoints: websecure-ext
gethomepage.dev/enabled: "true"
gethomepage.dev/name: "Mylar"
gethomepage.dev/description: "Automated Comic Book (cbr/cbz) downloader for use with NZB and torrents "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ nzbget:
PUID: 1001
TZ: ${timezone}

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ plex:
PLEX_PREFERENCE_1: "FriendlyName=plexHome"
TZ: ${timezone}


nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
promtail:

nodeSelector:
# kubernetes.io/hostname: ${master_hostname}
kubernetes.io/arch : amd64
priority: ${priority}

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
prowlarr:
nodeSelector:
kubernetes.io/hostname: "${master_hostname}"

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
radarr:

nodeSelector:
kubernetes.io/hostname: "${master_hostname}"
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
readarr:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
renovate:

nodeSelector:
priority: ${priority}

cronjob:
# -- Schedules the job to run using cron notation
schedule: '45 * * * *' # At 01:00 every day
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
sabnzbd:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
sonarr:

nodeSelector:
kubernetes.io/hostname: "${master_hostname}"
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ tautulli:
env:
TZ: ${timezone}

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
radarr:

nodeSelector:
priority: ${priority}

ingress:
main:
ingressClassName: traefik
Expand Down
2 changes: 1 addition & 1 deletion terraform/modules/argocd_application/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "argocd_application" "application" {
helm {

value_files = local.values_files
values = templatefile("${path.module}/applications/${var.name}/values.yaml",merge(var.override_values,{"namespace":var.namespace}))
values = templatefile("${path.module}/applications/${var.name}/values.yaml",merge(var.override_values,{"namespace":var.namespace,"priority":var.priority}))
}
}

Expand Down
6 changes: 6 additions & 0 deletions terraform/modules/argocd_application/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,10 @@ variable "server_side" {
default = "false"
description = "Determines if the app is going to be deployed using server side apply"

}

variable "priority" {
type = string
description = "Determines in which node to run the helm chart"

}
Loading

0 comments on commit 826340c

Please sign in to comment.