From d0566d2e1d3f7821bf914fcbcd53a540e458730b Mon Sep 17 00:00:00 2001 From: Yan Song Liu Date: Thu, 7 Mar 2024 15:12:35 +0800 Subject: [PATCH] ibmcloud: replace k8s source list use k8s owned apt repo add kube_version variable Signed-off-by: Yan Song Liu --- ibmcloud/cluster/README.md | 1 + ibmcloud/cluster/ansible/tasks/k8s.yaml | 4 ++-- ibmcloud/cluster/main.tf | 2 +- ibmcloud/cluster/variables.tf | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ibmcloud/cluster/README.md b/ibmcloud/cluster/README.md index 4972b5b54..e595179c6 100644 --- a/ibmcloud/cluster/README.md +++ b/ibmcloud/cluster/README.md @@ -100,6 +100,7 @@ twice under different SSHs key names. This key needs to be password-less and on plane node and the rest will be worker nodes. If not set it defaults to `2`. > - `containerd_version` (optional) is the version of containerd installed on the Kubernetes nodes. If not set it defaults to `1.7.0-beta.3`. +> - `kube_version` (optional) is the version of kubeadmin and cluster. If not set it defaults to `1.28`. > **Hint:** In order to create a cluster based on a different type of VSI image you can use the `instance_profile_name` diff --git a/ibmcloud/cluster/ansible/tasks/k8s.yaml b/ibmcloud/cluster/ansible/tasks/k8s.yaml index 62ae9c2df..93f2beaf8 100644 --- a/ibmcloud/cluster/ansible/tasks/k8s.yaml +++ b/ibmcloud/cluster/ansible/tasks/k8s.yaml @@ -6,12 +6,12 @@ --- - name: "Add gpg key " apt_key: - url: https://packages.cloud.google.com/apt/doc/apt-key.gpg + url: https://pkgs.k8s.io/core:/stable:/v{{ kube_version }}/deb/Release.key state: present - name: "Add kubernetes source list " apt_repository: - repo: "deb http://packages.cloud.google.com/apt/ kubernetes-xenial main" + repo: "deb https://pkgs.k8s.io/core:/stable:/v{{ kube_version }}/deb/ /" state: present filename: "kubernetes" diff --git a/ibmcloud/cluster/main.tf b/ibmcloud/cluster/main.tf index a0ccac80b..5ae003a09 100644 --- a/ibmcloud/cluster/main.tf +++ b/ibmcloud/cluster/main.tf @@ -86,7 +86,7 @@ resource "null_resource" "ansible" { } provisioner "local-exec" { working_dir = "./ansible" - command = "ansible-playbook -i inventory -u root containerd.yaml -e containerd_release_version=${var.containerd_version}" + command = "ansible-playbook -i inventory -u root containerd.yaml -e containerd_release_version=${var.containerd_version} -e kube_version=${var.kube_version}" } } diff --git a/ibmcloud/cluster/variables.tf b/ibmcloud/cluster/variables.tf index e2308040a..72a1105a6 100644 --- a/ibmcloud/cluster/variables.tf +++ b/ibmcloud/cluster/variables.tf @@ -57,3 +57,7 @@ variable "zone" { variable "containerd_version" { default = "1.7.0-beta.3" } + +variable "kube_version" { + default = "1.28" +}