Skip to content

Commit 1f86491

Browse files
authored
Merge pull request #1128 from kube-hetzner/staging
Deploy staging
2 parents 8433096 + ae11c4e commit 1f86491

File tree

7 files changed

+62
-14
lines changed

7 files changed

+62
-14
lines changed

docs/terraform.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
| <a name="input_network_ipv4_cidr"></a> [network\_ipv4\_cidr](#input\_network\_ipv4\_cidr) | The main network cidr that all subnets will be created upon. | `string` | `"10.0.0.0/8"` | no |
181181
| <a name="input_network_region"></a> [network\_region](#input\_network\_region) | Default region for network. | `string` | `"eu-central"` | no |
182182
| <a name="input_nginx_values"></a> [nginx\_values](#input\_nginx\_values) | Additional helm values file to pass to nginx as 'valuesContent' at the HelmChart. | `string` | `""` | no |
183+
| <a name="input_nginx_version"></a> [nginx\_version](#input\_nginx\_version) | Version of Nginx helm chart. | `string` | `""` | no |
183184
| <a name="input_placement_group_disable"></a> [placement\_group\_disable](#input\_placement\_group\_disable) | Whether to disable placement groups. | `bool` | `false` | no |
184185
| <a name="input_postinstall_exec"></a> [postinstall\_exec](#input\_postinstall\_exec) | Additional to execute after the install calls, for example restoring a backup. | `list(string)` | `[]` | no |
185186
| <a name="input_preinstall_exec"></a> [preinstall\_exec](#input\_preinstall\_exec) | Additional to execute before the install calls, for example fetching and installing certs. | `list(string)` | `[]` | no |
@@ -200,10 +201,12 @@
200201
| <a name="input_traefik_additional_ports"></a> [traefik\_additional\_ports](#input\_traefik\_additional\_ports) | Additional ports to pass to Traefik. These are the ones that go into the ports section of the Traefik helm values file. | <pre>list(object({<br> name = string<br> port = number<br> exposedPort = number<br> }))</pre> | `[]` | no |
201202
| <a name="input_traefik_additional_trusted_ips"></a> [traefik\_additional\_trusted\_ips](#input\_traefik\_additional\_trusted\_ips) | Additional Trusted IPs to pass to Traefik. These are the ones that go into the trustedIPs section of the Traefik helm values file. | `list(string)` | `[]` | no |
202203
| <a name="input_traefik_autoscaling"></a> [traefik\_autoscaling](#input\_traefik\_autoscaling) | Should traefik enable Horizontal Pod Autoscaler. | `bool` | `true` | no |
204+
| <a name="input_traefik_image_tag"></a> [traefik\_image\_tag](#input\_traefik\_image\_tag) | Traefik image tag. Useful to use the beta version for new features. Example: v3.0.0-beta5 | `string` | `""` | no |
203205
| <a name="input_traefik_pod_disruption_budget"></a> [traefik\_pod\_disruption\_budget](#input\_traefik\_pod\_disruption\_budget) | Should traefik enable pod disruption budget. Default values are maxUnavailable: 33% and minAvailable: 1. | `bool` | `true` | no |
204206
| <a name="input_traefik_redirect_to_https"></a> [traefik\_redirect\_to\_https](#input\_traefik\_redirect\_to\_https) | Should traefik redirect http traffic to https. | `bool` | `true` | no |
205207
| <a name="input_traefik_resource_limits"></a> [traefik\_resource\_limits](#input\_traefik\_resource\_limits) | Should traefik enable default resource requests and limits. Default values are requests: 100m & 50Mi and limits: 300m & 150Mi. | `bool` | `true` | no |
206208
| <a name="input_traefik_values"></a> [traefik\_values](#input\_traefik\_values) | Additional helm values file to pass to Traefik as 'valuesContent' at the HelmChart. | `string` | `""` | no |
209+
| <a name="input_traefik_version"></a> [traefik\_version](#input\_traefik\_version) | Version of Traefik helm chart. | `string` | `""` | no |
207210
| <a name="input_use_cluster_name_in_node_name"></a> [use\_cluster\_name\_in\_node\_name](#input\_use\_cluster\_name\_in\_node\_name) | Whether to use the cluster name in the node name. | `bool` | `true` | no |
208211
| <a name="input_use_control_plane_lb"></a> [use\_control\_plane\_lb](#input\_use\_control\_plane\_lb) | When this is enabled, rather than the first node, all external traffic will be routed via a control-plane loadbalancer, allowing for high availability. | `bool` | `false` | no |
209212

init.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ resource "null_resource" "kustomization" {
131131
coalesce(var.kured_version, "N/A"),
132132
coalesce(var.calico_version, "N/A"),
133133
coalesce(var.cilium_version, "N/A"),
134+
coalesce(var.traefik_version, "N/A"),
135+
coalesce(var.nginx_version, "N/A"),
134136
])
135137
options = join("\n", [
136-
for option, value in var.kured_options : "${option}=${value}"
138+
for option, value in local.kured_options : "${option}=${value}"
137139
])
138140
}
139141

@@ -156,6 +158,7 @@ resource "null_resource" "kustomization" {
156158
content = templatefile(
157159
"${path.module}/templates/traefik_ingress.yaml.tpl",
158160
{
161+
version = var.traefik_version
159162
values = indent(4, trimspace(local.traefik_values))
160163
target_namespace = local.ingress_target_namespace
161164
})
@@ -167,6 +170,7 @@ resource "null_resource" "kustomization" {
167170
content = templatefile(
168171
"${path.module}/templates/nginx_ingress.yaml.tpl",
169172
{
173+
version = var.nginx_version
170174
values = indent(4, trimspace(local.nginx_values))
171175
target_namespace = local.ingress_target_namespace
172176
})

kube.tf.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ module "kube-hetzner" {
430430
# Example:
431431
# traefik_additional_options = ["--log.level=DEBUG", "--tracing=true"]
432432

433+
# By default traefik image tag is an empty string which uses latest image tag.
434+
# The default is "".
435+
# traefik_image_tag = "v3.0.0-beta5"
436+
433437
# By default traefik is configured to redirect http traffic to https, you can set this to "false" to disable the redirection.
434438
# The default is true.
435439
# traefik_redirect_to_https = false
@@ -833,6 +837,9 @@ persistence:
833837
defaultClass: true
834838
EOT */
835839

840+
# If you want to use a specific Traefik helm chart version, set it below; otherwise, leave them as-is for the latest versions.
841+
# traefik_version = ""
842+
836843
# Traefik, all Traefik helm values can be found at https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml
837844
# The following is an example, please note that the current indentation inside the EOT is important.
838845
/* traefik_values = <<EOT
@@ -875,6 +882,9 @@ ports:
875882
- 10.0.0.0/8
876883
EOT */
877884

885+
# If you want to use a specific Nginx helm chart version, set it below; otherwise, leave them as-is for the latest versions.
886+
# nginx_version = ""
887+
878888
# Nginx, all Nginx helm values can be found at https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml
879889
# 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.
880890
# The following is an example, please note that the current indentation inside the EOT is important.

locals.tf

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ locals {
7979
"https://github.com/kubereboot/kured/releases/download/${local.kured_version}/kured-${local.kured_version}-dockerhub.yaml",
8080
"https://raw.githubusercontent.com/rancher/system-upgrade-controller/master/manifests/system-upgrade-controller.yaml",
8181
],
82-
var.disable_hetzner_csi ? [] : [
83-
"hcloud-csi.yml"
84-
],
82+
var.disable_hetzner_csi ? [] : ["hcloud-csi.yml"],
8583
lookup(local.ingress_controller_install_resources, local.ingress_controller, []),
8684
lookup(local.cni_install_resources, var.cni_plugin, []),
8785
var.enable_longhorn ? ["longhorn.yaml"] : [],
@@ -90,14 +88,24 @@ locals {
9088
var.enable_rancher ? ["rancher.yaml"] : [],
9189
var.rancher_registration_manifest_url != "" ? [var.rancher_registration_manifest_url] : []
9290
),
93-
patchesStrategicMerge = concat(
94-
[
95-
file("${path.module}/kustomize/system-upgrade-controller.yaml"),
96-
"kured.yaml",
97-
"ccm.yaml",
98-
],
99-
lookup(local.cni_install_resource_patches, var.cni_plugin, [])
100-
)
91+
patches = [
92+
{
93+
target = {
94+
group = "apps"
95+
version = "v1"
96+
kind = "Deployment"
97+
name = "system-upgrade-controller"
98+
namespace = "system-upgrade"
99+
}
100+
patch = file("${path.module}/kustomize/system-upgrade-controller.yaml")
101+
},
102+
{
103+
path = "kured.yaml"
104+
},
105+
{
106+
path = "ccm.yaml"
107+
}
108+
]
101109
})
102110

103111
apply_k3s_selinux = ["/sbin/semodule -v -i /usr/share/selinux/packages/k3s.pp"]
@@ -484,6 +492,8 @@ controller:
484492
EOT
485493

486494
traefik_values = var.traefik_values != "" ? var.traefik_values : <<EOT
495+
image:
496+
tag: ${var.traefik_image_tag}
487497
deployment:
488498
replicas: ${local.ingress_replica_count}
489499
globalArguments: []
@@ -618,6 +628,7 @@ installCRDs: true
618628
"pre-reboot-node-labels" : "kured=rebooting",
619629
"post-reboot-node-labels" : "kured=done",
620630
"period" : "5m",
631+
"lock-ttl" : "30m"
621632
}, var.kured_options)
622633

623634
k3s_registries_update_script = <<EOF

templates/nginx_ingress.yaml.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v1
33
kind: Namespace
44
metadata:
5-
name: nginx
5+
name: ${target_namespace}
66
---
77
apiVersion: helm.cattle.io/v1
88
kind: HelmChart
@@ -11,6 +11,7 @@ metadata:
1111
namespace: kube-system
1212
spec:
1313
chart: ingress-nginx
14+
version: "${version}"
1415
repo: https://kubernetes.github.io/ingress-nginx
1516
targetNamespace: ${target_namespace}
1617
bootstrap: true

templates/traefik_ingress.yaml.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v1
33
kind: Namespace
44
metadata:
5-
name: traefik
5+
name: ${target_namespace}
66
---
77
apiVersion: helm.cattle.io/v1
88
kind: HelmChart
@@ -11,6 +11,7 @@ metadata:
1111
namespace: kube-system
1212
spec:
1313
chart: traefik
14+
version: "${version}"
1415
repo: https://traefik.github.io/charts
1516
targetNamespace: ${target_namespace}
1617
bootstrap: true

variables.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,12 @@ variable "ingress_max_replica_count" {
358358
}
359359
}
360360

361+
variable "traefik_image_tag" {
362+
type = string
363+
default = ""
364+
description = "Traefik image tag. Useful to use the beta version for new features. Example: v3.0.0-beta5"
365+
}
366+
361367
variable "traefik_autoscaling" {
362368
type = bool
363369
default = true
@@ -404,12 +410,24 @@ variable "traefik_additional_trusted_ips" {
404410
description = "Additional Trusted IPs to pass to Traefik. These are the ones that go into the trustedIPs section of the Traefik helm values file."
405411
}
406412

413+
variable "traefik_version" {
414+
type = string
415+
default = ""
416+
description = "Version of Traefik helm chart."
417+
}
418+
407419
variable "traefik_values" {
408420
type = string
409421
default = ""
410422
description = "Additional helm values file to pass to Traefik as 'valuesContent' at the HelmChart."
411423
}
412424

425+
variable "nginx_version" {
426+
type = string
427+
default = ""
428+
description = "Version of Nginx helm chart."
429+
}
430+
413431
variable "nginx_values" {
414432
type = string
415433
default = ""

0 commit comments

Comments
 (0)