Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: removes cloud-init pins #1251

Merged
merged 4 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/roles/providers/files/cloud-init-features.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ERROR_ON_USER_DATA_FAILURE = False
13 changes: 0 additions & 13 deletions ansible/roles/providers/tasks/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,6 @@
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
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', '==')

- name: install aws clients
pip:
Expand Down
18 changes: 16 additions & 2 deletions ansible/roles/providers/tasks/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,35 @@
owner: root
group: root
mode: 0644
when: ansible_os_family == "Debian" and system_cloud_init_version is version('20.0.0', '>')
when: ansible_os_family == "Debian" and system_cloud_init_version is version('20.0.0', '>') and system_cloud_init_version is version('23.3.0', '<')

- name: patch cloud-init feature flags for Debian-based OS
ansible.builtin.blockinfile:
path: /usr/lib/python3/dist-packages/cloudinit/features.py
marker: "# {mark} ANSIBLE MANAGED BLOCK (by image-builder)"
block: "{{ lookup('file', 'cloud-init-features.patch') }}"
when: ansible_os_family == "Debian" and system_cloud_init_version is version('23.3.0', '>=')

- name: get python3 location for non-debian
register: python3_version
shell: python3 -c "import sysconfig; print(sysconfig.get_path('purelib'))"
when: ansible_os_family not in ["Debian", "Flatcar"]

- name: patch cloud-init feature flags for RedHat
ansible.builtin.blockinfile:
path: "{{ python3_version.stdout }}/cloudinit/features.py"
marker: "# {mark} ANSIBLE MANAGED BLOCK (by image-builder)"
block: "{{ lookup('file', 'cloud-init-features.patch') }}"
when: ansible_os_family == "RedHat" and system_cloud_init_version is version('23.3.0', '>=')

- name: set cloudinit feature flags for non debian systems
copy:
src: usr/lib/python3/dist-packages/cloudinit/feature_overrides.py
dest: "{{ python3_version.stdout }}/cloudinit/feature_overrides.py"
owner: root
group: root
mode: 0644
when: ansible_os_family not in ["Debian", "Flatcar"] and system_cloud_init_version is version('20.0.0', '>')
when: ansible_os_family not in ["Debian", "Flatcar"] and system_cloud_init_version is version('20.0.0', '>') and system_cloud_init_version is version('23.3.0', '<')

- name: Ensure chrony is running
systemd:
Expand Down
2 changes: 1 addition & 1 deletion bundles/redhat8.10/packages.txt.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sysstat
yum-utils
yum-plugin-versionlock
NetworkManager
cloud-init-23.1.1-10.el8
cloud-init
cloud-utils-growpart
container-selinux
{{ if .FetchKubernetesRPMs -}}
Expand Down
2 changes: 0 additions & 2 deletions bundles/ubuntu20.04/bundle.sh.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ sed -i 's/kubelet/kubelet='"{{ .KubernetesVersion }}-${KUBERNETES_DEB_BUILD_VERS
sed -i 's/kubectl/kubectl='"{{ .KubernetesVersion }}-${KUBERNETES_DEB_BUILD_VERSION}"'/' /tmp/packages
sed -i 's/kubeadm/kubeadm='"{{ .KubernetesVersion }}-${KUBERNETES_DEB_BUILD_VERSION}"'/' /tmp/packages
sed -i 's/cri-tools/cri-tools='"{{ .CRIToolsVersion }}-${CRI_TOOLS_DEB_BUILD_VERSION}"'/' /tmp/packages
# https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/4745 pins version for CAPA
sed -i 's/cloud-init/cloud-init='"23.1.2-0ubuntu0~20.04.2"'/' /tmp/packages

TMP_DIR="$(mktemp -d repodata-XXXX)"
chmod 777 -R "${TMP_DIR}"
Expand Down
5 changes: 0 additions & 5 deletions images/ami/ubuntu-2004.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
build_name: "ubuntu-20"
packer_builder_type: "amazon"
python_path: ""
# The latest cloud-init version '23.3.1-0ubuntu1~20.04.1 is unable to run #boothook created by CAPA
# https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/0bf78b04b305a77aec37a68c107102231faa7a16/pkg/cloud/services/secretsmanager/secret_fetch_script.go#L20
# This is a workaround to downgrade to older cloud-init version.
# TODO: remove it when base ubuntu AMI has fixed version of cloud-init available. https://d2iq.atlassian.net/browse/D2IQ-99637
pinned_debs: ["cloud-init=23.1.2-0ubuntu0~20.04.2"]
packer:
ami_filter_name: "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server*"
ami_filter_owners: "099720109477"
Expand Down
4 changes: 0 additions & 4 deletions images/ami/ubuntu-2204.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
build_name: "ubuntu-22"
packer_builder_type: "amazon"
python_path: ""
# The latest cloud-init version is unable to run #boothook created by CAPA https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/5115
# This is a workaround to downgrade to older cloud-init version.
# https://github.com/kubernetes-sigs/image-builder/pull/1590/files
pinned_debs: ["cloud-init=23.1.2-0ubuntu0~22.04.1"]
packer:
ami_filter_name: "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
ami_filter_owners: "099720109477"
Expand Down
Loading