From bba49668d64923b2f24c62c3d1071a8356bf4760 Mon Sep 17 00:00:00 2001 From: faiq Date: Mon, 25 Nov 2024 11:25:17 -0800 Subject: [PATCH 1/5] fix: pins cloud init to last known working version for 8.10 --- ansible/roles/providers/tasks/aws.yml | 14 ++++++++++++++ bundles/redhat8.10/packages.txt.gotmpl | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ansible/roles/providers/tasks/aws.yml b/ansible/roles/providers/tasks/aws.yml index 42d484957..def6fe3f2 100644 --- a/ansible/roles/providers/tasks/aws.yml +++ b/ansible/roles/providers/tasks/aws.yml @@ -33,6 +33,20 @@ when: - ansible_distribution == "Flatcar" +- name: Install cloud-init packages + yum: + name: "{{ packages }}" + state: present + enablerepo: "{{ 'offline' if offline_mode_enabled else '' }}" + disablerepo: "{{ '*' if offline_mode_enabled else '' }}" + vars: + packages: + - "cloud-init{{ '-23.1.1-10.el8' if ansible_distribution_version is version('8.10', '=') else ''}}" + #this pins the version of cloud-init to avoid the issue here https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4745 + - cloud-utils-growpart + - "python{{ '3' if ansible_distribution_major_version|int >= 9 else '2'}}-pip" + when: ansible_os_family == "RedHat" + - name: install aws clients pip: name: "awscli" diff --git a/bundles/redhat8.10/packages.txt.gotmpl b/bundles/redhat8.10/packages.txt.gotmpl index e5bd9ea4c..6dfab9f31 100644 --- a/bundles/redhat8.10/packages.txt.gotmpl +++ b/bundles/redhat8.10/packages.txt.gotmpl @@ -11,7 +11,7 @@ sysstat yum-utils yum-plugin-versionlock NetworkManager -cloud-init +cloud-init-23.1.1-10.el8 cloud-utils-growpart container-selinux {{ if .FetchKubernetesRPMs -}} From b347a64b3cb1357dd10a72380a7c7a67b63cd689 Mon Sep 17 00:00:00 2001 From: faiq Date: Mon, 25 Nov 2024 18:35:44 -0800 Subject: [PATCH 2/5] fix: specify --oldpackage to allow downgrading cloud-init on rhel 8.10 --- ansible/roles/providers/tasks/aws.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/ansible/roles/providers/tasks/aws.yml b/ansible/roles/providers/tasks/aws.yml index def6fe3f2..5ee799072 100644 --- a/ansible/roles/providers/tasks/aws.yml +++ b/ansible/roles/providers/tasks/aws.yml @@ -33,7 +33,8 @@ when: - ansible_distribution == "Flatcar" -- name: Install cloud-init packages + +- name: install cloud-init deps yum: name: "{{ packages }}" state: present @@ -41,12 +42,27 @@ disablerepo: "{{ '*' if offline_mode_enabled else '' }}" vars: packages: - - "cloud-init{{ '-23.1.1-10.el8' if ansible_distribution_version is version('8.10', '=') else ''}}" - #this pins the version of cloud-init to avoid the issue here https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4745 - cloud-utils-growpart - "python{{ '3' if ansible_distribution_major_version|int >= 9 else '2'}}-pip" when: ansible_os_family == "RedHat" +- name: install cloud-init for RHEL + yum: + name: cloud-init + state: present + enablerepo: "{{ 'offline' if offline_mode_enabled else '' }}" + disablerepo: "{{ '*' if offline_mode_enabled else '' }}" + when: + - ansible_os_family == "RedHat" + - ansible_distribution_version is version('8.10', '!=') + + #this pins the version of cloud-init to avoid the issue here https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4745 +- name: Install cloud-init 23.1.1 for RHEL 8.10 + shell: rpm -Uvh --oldpackage /opt/dkp/packages/offline-repo/cloud-init-23.1.1-10.el8.noarch.rpm + when: + - ansible_os_family == "RedHat" + - ansible_distribution_version is version('8.10', '==') + - name: install aws clients pip: name: "awscli" From 80dd2fd4b64bae01dee9aa375ce72b2d77e1fa27 Mon Sep 17 00:00:00 2001 From: faiq Date: Tue, 26 Nov 2024 08:26:15 -0800 Subject: [PATCH 3/5] fixup! fix: use variable instead of hardcoded path --- ansible/roles/providers/tasks/aws.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/providers/tasks/aws.yml b/ansible/roles/providers/tasks/aws.yml index 5ee799072..f540f7b2b 100644 --- a/ansible/roles/providers/tasks/aws.yml +++ b/ansible/roles/providers/tasks/aws.yml @@ -58,7 +58,7 @@ #this pins the version of cloud-init to avoid the issue here https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4745 - name: Install cloud-init 23.1.1 for RHEL 8.10 - shell: rpm -Uvh --oldpackage /opt/dkp/packages/offline-repo/cloud-init-23.1.1-10.el8.noarch.rpm + shell: rpm -Uvh --oldpackage "{{ os_packages_remote_filesystem_repo_path }}/cloud-init-23.1.1-10.el8.noarch.rpm" when: - ansible_os_family == "RedHat" - ansible_distribution_version is version('8.10', '==') From e26403a5815cab7c3513cba60515d20cbc60e81b Mon Sep 17 00:00:00 2001 From: faiq Date: Tue, 26 Nov 2024 08:55:55 -0800 Subject: [PATCH 4/5] fixup! fix: variable is in offline object --- ansible/roles/providers/tasks/aws.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/providers/tasks/aws.yml b/ansible/roles/providers/tasks/aws.yml index f540f7b2b..4fdda4a40 100644 --- a/ansible/roles/providers/tasks/aws.yml +++ b/ansible/roles/providers/tasks/aws.yml @@ -58,7 +58,7 @@ #this pins the version of cloud-init to avoid the issue here https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4745 - name: Install cloud-init 23.1.1 for RHEL 8.10 - shell: rpm -Uvh --oldpackage "{{ os_packages_remote_filesystem_repo_path }}/cloud-init-23.1.1-10.el8.noarch.rpm" + shell: rpm -Uvh --oldpackage "{{ offline.os_packages_remote_filesystem_repo_path }}/cloud-init-23.1.1-10.el8.noarch.rpm" when: - ansible_os_family == "RedHat" - ansible_distribution_version is version('8.10', '==') From e3cfd71f1bce392765532265e91512c61bb17fc4 Mon Sep 17 00:00:00 2001 From: faiq Date: Tue, 26 Nov 2024 09:32:32 -0800 Subject: [PATCH 5/5] fix: use allow downgrade with yum --- ansible/roles/providers/tasks/aws.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ansible/roles/providers/tasks/aws.yml b/ansible/roles/providers/tasks/aws.yml index 4fdda4a40..23833ca22 100644 --- a/ansible/roles/providers/tasks/aws.yml +++ b/ansible/roles/providers/tasks/aws.yml @@ -57,8 +57,13 @@ - ansible_distribution_version is version('8.10', '!=') #this pins the version of cloud-init to avoid the issue here https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4745 -- name: Install cloud-init 23.1.1 for RHEL 8.10 - shell: rpm -Uvh --oldpackage "{{ offline.os_packages_remote_filesystem_repo_path }}/cloud-init-23.1.1-10.el8.noarch.rpm" +- name: install cloud-init 23.1.1 for RHEL 8.10 + yum: + name: cloud-init-23.1.1-10.el8 + allow_downgrade: true + state: present + enablerepo: "{{ 'offline' if offline_mode_enabled else '' }}" + disablerepo: "{{ '*' if offline_mode_enabled else '' }}" when: - ansible_os_family == "RedHat" - ansible_distribution_version is version('8.10', '==')