Skip to content

Commit

Permalink
Merge pull request #307 from kube-hetzner/change-nginx
Browse files Browse the repository at this point in the history
Nginx-ingress to ingess-nginx
  • Loading branch information
mysticaltech authored Sep 13, 2022
2 parents 87bdbee + b5b23c1 commit 2a5e31d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions agents.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ resource "null_resource" "agents" {
}

resource "hcloud_volume" "longhorn_volume" {
for_each = { for k, v in local.agent_nodes : k => v if lookup(v, "longhorn_volume_size", 0) >= 10 && lookup(v, "longhorn_volume_size", 0) <= 10000 }
for_each = { for k, v in local.agent_nodes : k => v if((lookup(v, "longhorn_volume_size", 0) >= 10) && (lookup(v, "longhorn_volume_size", 0) <= 10000) && var.enable_longhorn) }

labels = {
provisioner = "terraform"
Expand All @@ -103,7 +103,7 @@ resource "hcloud_volume" "longhorn_volume" {
}

resource "null_resource" "configure_longhorn_volume" {
for_each = { for k, v in local.agent_nodes : k => v if lookup(v, "longhorn_volume_size", 0) >= 10 && lookup(v, "longhorn_volume_size", 0) <= 10000 }
for_each = { for k, v in local.agent_nodes : k => v if((lookup(v, "longhorn_volume_size", 0) >= 10) && (lookup(v, "longhorn_volume_size", 0) <= 10000) && var.enable_longhorn) }

triggers = {
agent_id = module.agents[each.key].id
Expand All @@ -114,7 +114,7 @@ resource "null_resource" "configure_longhorn_volume" {
inline = [
"mkdir /var/longhorn >/dev/null 2>&1",
"mount -o discard,defaults ${hcloud_volume.longhorn_volume[each.key].linux_device} /var/longhorn",
var.longhorn_fstype == "ext4" ? "resize2fs" : "xfs_growfs" + " ${hcloud_volume.longhorn_volume[each.key].linux_device}",
"${var.longhorn_fstype == "ext4" ? "resize2fs" : "xfs_growfs"} ${hcloud_volume.longhorn_volume[each.key].linux_device}",
"echo '${hcloud_volume.longhorn_volume[each.key].linux_device} /var/longhorn ${var.longhorn_fstype} discard,nofail,defaults 0 0' >> /etc/fstab"
]
}
Expand Down
2 changes: 1 addition & 1 deletion kube.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ module "kube-hetzner" {
# If you want to specify the Kured version, set it below - otherwise it'll use the latest version available.
# kured_version = ""

# If you want to enable the Nginx ingress controller instead of Traefik, you can set this to "true". Default is "false".
# If you want to enable the Nginx ingress controller (https://kubernetes.github.io/ingress-nginx/) instead of Traefik, you can set this to "true". Default is "false".
# FOR THIS TO NOT BE IGNORED, you also need to set "enable_traefik = false".
# By the default we load an optimal Nginx ingress controller config for Hetzner, however you may need to tweak it to your needs, so to do,
# we allow you to add a nginx_ingress_values.yaml file to the root of your module, next to the kube.tf file, it is simply a helm values config file.
Expand Down
4 changes: 2 additions & 2 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ locals {
default_agent_taints = concat([], var.cni_plugin == "cilium" ? ["node.cilium.io/agent-not-ready:NoExecute"] : [])


packages_to_install = concat(var.enable_longhorn ? ["open-iscsi", "nfs-client"] : [], var.extra_packages_to_install)
packages_to_install = concat(var.enable_longhorn ? ["open-iscsi", "nfs-client", "xfsprogs"] : [], var.extra_packages_to_install)

# The following IPs are important to be whitelisted because they communicate with Hetzner services and enable the CCM and CSI to work properly.
# Source https://github.com/hetznercloud/csi-driver/issues/204#issuecomment-848625566
Expand Down Expand Up @@ -290,7 +290,7 @@ locals {
ingress_controller = var.enable_traefik ? "traefik" : var.enable_nginx ? "nginx" : "none"
ingress_controller_service_names = {
"traefik" = "traefik"
"nginx" = "ngx-nginx-ingress"
"nginx" = "ngx-ingress-nginx-controller"
}

ingress_controller_install_resources = {
Expand Down
1 change: 1 addition & 0 deletions nginx_ingress_values.yaml.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# All Nginx Ingress helm values can be found at https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml
# You can also have a look at https://kubernetes.github.io/ingress-nginx/, to understand how it works, and all the options at your disposal.

controller:
# These options can be found here https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/
Expand Down
4 changes: 2 additions & 2 deletions templates/nginx_ingress.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ metadata:
name: ngx
namespace: kube-system
spec:
chart: nginx-ingress
repo: https://helm.nginx.com/stable
chart: ingress-nginx
repo: https://kubernetes.github.io/ingress-nginx
targetNamespace: kube-system
bootstrap: true
valuesContent: |-
Expand Down

0 comments on commit 2a5e31d

Please sign in to comment.