From f4551b689c6135371d0f4582cabb2693bb3558f4 Mon Sep 17 00:00:00 2001 From: Pragadeeswaran Sathyanarayanan Date: Wed, 15 May 2024 09:48:46 +0530 Subject: [PATCH] [reproducer] Add support for installing kustomize This change installs kustomize binary on the controller type nodes as required by kustomize_deploy role. Signed-off-by: Pragadeeswaran Sathyanarayanan --- roles/reproducer/defaults/main.yml | 2 + .../reproducer/tasks/configure_controller.yml | 4 + roles/reproducer/tasks/install_kustomize.yml | 73 +++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 roles/reproducer/tasks/install_kustomize.yml diff --git a/roles/reproducer/defaults/main.yml b/roles/reproducer/defaults/main.yml index f7c73942da..2505935ff4 100644 --- a/roles/reproducer/defaults/main.yml +++ b/roles/reproducer/defaults/main.yml @@ -37,3 +37,5 @@ cifmw_reproducer_supported_hypervisor_os: minimum_version: 9 RedHat: minimum_version: 9.3 +cifmw_reproducer_kustomize_install_script: >- + https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh diff --git a/roles/reproducer/tasks/configure_controller.yml b/roles/reproducer/tasks/configure_controller.yml index 3171e5bf46..e4b977d3a8 100644 --- a/roles/reproducer/tasks/configure_controller.yml +++ b/roles/reproducer/tasks/configure_controller.yml @@ -83,6 +83,10 @@ - wget - jq + - name: Install kustomize binary + ansible.builtin.include_tasks: + file: install_kustomize.yml + - name: Build job inventory for hook usage tags: - bootstrap diff --git a/roles/reproducer/tasks/install_kustomize.yml b/roles/reproducer/tasks/install_kustomize.yml new file mode 100644 index 0000000000..11377ca979 --- /dev/null +++ b/roles/reproducer/tasks/install_kustomize.yml @@ -0,0 +1,73 @@ +--- +# Copyright Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +- name: Ensure the directories exist + ansible.builtin.file: + path: "{{ item.dir_name }}" + mode: "{{ item.mode }}" + state: "directory" + owner: "{{ ansible_user_id }}" + group: "{{ ansible_user_id }}" + loop: + - dir_name: >- + {{ + (cifmw_reproducer_basedir, 'tmp') | ansible.builtin.path_join + }} + mode: "0755" + - dir_name: >- + {{ + (ansible_user_dir, '.local') | ansible.builtin.path_join + }} + mode: "0700" + - dir_name: >- + {{ + (ansible_user_dir, '.local', 'bin') | ansible.builtin.path_join + }} + mode: "0755" + loop_control: + label: "{{ item.dir_name }}" + +- name: Download the kustomize install script + ansible.builtin.get_url: + url: "{{ cifmw_reproducer_kustomize_install_script }}" + dest: >- + {{ + ( + cifmw_reproducer_basedir, + 'tmp', + 'install-kustomize.sh' + ) | ansible.builtin.path_join + }} + mode: '0755' + validate_certs: false + +- name: Execute the kustomize install script + ansible.builtin.command: + chdir: >- + {{ + (ansible_user_dir, '.local', 'bin') | ansible.builtin.path_join + }} + cmd: >- + {{ + (cifmw_reproducer_basedir, 'tmp', 'install-kustomize.sh') + | ansible.builtin.path_join + }} + creates: >- + {{ + (ansible_user_dir, '.local', 'bin', 'kustomize') + | ansible.builtin.path_join + }}