Skip to content

Commit

Permalink
Merge pull request #576 from kube-hetzner/calico-fix
Browse files Browse the repository at this point in the history
Calico fix (with optional version variable)
  • Loading branch information
mysticaltech authored Feb 9, 2023
2 parents 9e88db6 + 88ea4a4 commit a56ca28
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
8 changes: 8 additions & 0 deletions data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ data "github_release" "kured" {
retrieve_by = "latest"
}

// github_release for kured
data "github_release" "calico" {
count = var.calico_version == null ? 1 : 0
repository = "calico"
owner = "projectcalico"
retrieve_by = "latest"
}

data "hcloud_load_balancer" "cluster" {
count = local.has_external_load_balancer ? 0 : 1
name = var.cluster_name
Expand Down
5 changes: 5 additions & 0 deletions kube.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ module "kube-hetzner" {
# Also, see the cilium_values at towards the end of this file, in the advanced section.
# cni_plugin = "cilium"

# You can choose the version of Calico that you want. By default, the latest is used.
# More info on available versions can be found at https://github.com/projectcalico/calico/releases
# Please note that if you are getting 403s from Github, it's also useful to set the version manually. However there is rarely a need for that!
# calico_version = "v3.25.0"

# If you want to disable the k3s default network policy controller, use this flag!
# Both Calico and Ciliun cni_plugin values override this value to true automatically, the default is "false".
# disable_network_policy = true
Expand Down
9 changes: 5 additions & 4 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ locals {
# Otherwise, a new one will be created by the module.
hcloud_ssh_key_id = var.hcloud_ssh_key_id == null ? hcloud_ssh_key.k3s[0].id : var.hcloud_ssh_key_id

ccm_version = var.hetzner_ccm_version != null ? var.hetzner_ccm_version : data.github_release.hetzner_ccm[0].release_tag
csi_version = var.hetzner_csi_version != null ? var.hetzner_csi_version : data.github_release.hetzner_csi[0].release_tag
kured_version = var.kured_version != null ? var.kured_version : data.github_release.kured[0].release_tag
ccm_version = var.hetzner_ccm_version != null ? var.hetzner_ccm_version : data.github_release.hetzner_ccm[0].release_tag
csi_version = var.hetzner_csi_version != null ? var.hetzner_csi_version : data.github_release.hetzner_csi[0].release_tag
kured_version = var.kured_version != null ? var.kured_version : data.github_release.kured[0].release_tag
calico_version = var.calico_version != null ? var.calico_version : data.github_release.calico[0].release_tag

additional_k3s_environment = join("\n",
[
Expand Down Expand Up @@ -275,7 +276,7 @@ locals {
}

cni_install_resources = {
"calico" = ["https://projectcalico.docs.tigera.io/manifests/calico.yaml"]
"calico" = ["https://raw.githubusercontent.com/projectcalico/calico/${local.calico_version}/manifests/calico.yaml"]
"cilium" = ["cilium.yaml"]
}

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,9 @@ variable "additional_tls_sans" {
default = []
type = list(string)
}

variable "calico_version" {
type = string
default = null
description = "Version of Calico."
}

0 comments on commit a56ca28

Please sign in to comment.