
A new fluxcd kustomize controller was added to ansible playbook in this commit: https://review.opendev.org/c/starlingx/ansible-playbooks/+/940832 This commit parameterizes the values.yaml file, aiming to allow the new controller to be optionally enabled via an ansible variable evaluated during bootstrap. The create parameter for the kustomize controller is set to false as a default. Test plan: PASS: build-pkgs && build-image. PASS: AIO-SX fresh install. PASS: check if only helm-controller and source-controller pods are up in the flux-helm namespace. PASS: stop AIO-SX installation before the ansible bootstrap step. PASS: manually run ansible-playbook setting the variable enable_kustomize_controller to true. PASS: check if kustomize-controller pod is up in the flux-helm namespace. PASS: build-pkgs && build-image. PASS: AIO-DX fresh install. PASS: check if only helm-controller and source-controller pods are up on flux-helm namespace. PASS: stop AIO-DX installation before the ansible bootstrap step. PASS: manually run ansible-playbook setting the variable enable_kustomize_controller to true. PASS: check if kustomize-controller pod is up in the flux-helm namespace. PASS: Do a STANDARD installation setting the variable enable_kustomize_controller to true. PASS: check if kustomize-controller pod is up in the flux-helm namespace and only on the controller node. Story: 2011354 Task: 51703 Change-Id: I3ed2dc9ecf3db81eda0452f0216aac9d5f559667 Signed-off-by: edias <edson.dias@windriver.com>
238 lines
8.7 KiB
YAML
238 lines
8.7 KiB
YAML
---
|
|
#
|
|
# Copyright (c) 2020-2024 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# ROLE DESCRIPTION:
|
|
# This role loads variables containing images.
|
|
#
|
|
|
|
- name: Fail if kubernetes_version is not defined
|
|
fail: msg="The mandatory parameter kubernetes_version is not defined."
|
|
when: kubernetes_version is not defined
|
|
|
|
- name: Set kubernetes long version
|
|
set_fact:
|
|
kubernetes_long_version: "{{ kubernetes_version if kubernetes_version.startswith('v')
|
|
else 'v' + kubernetes_version }}"
|
|
when: kubernetes_long_version is not defined
|
|
|
|
- name: Set kubernetes short version
|
|
set_fact:
|
|
kubernetes_short_version: "{{ kubernetes_long_version | replace('v','') }}"
|
|
|
|
- block:
|
|
- name: Get the list of kubernetes images
|
|
shell: "/usr/local/kubernetes/{{ kubernetes_short_version }}/stage1/usr/bin/kubeadm
|
|
--kubeconfig=/etc/kubernetes/admin.conf config images list
|
|
--kubernetes-version {{ kubernetes_long_version }}"
|
|
register: kubernetes_images_output
|
|
|
|
- set_fact:
|
|
kubernetes_images: "{{ kubernetes_images_output.stdout_lines }}"
|
|
|
|
- name: Read in system images list
|
|
include_vars:
|
|
dir: "vars/k8s-{{ kubernetes_long_version }}"
|
|
files_matching: "system-images.yml"
|
|
|
|
# Optional system images can be addded in {{ additional_system_images_conf_file }}
|
|
# under {{ additional_system_images_conf_path }}.
|
|
# Additional static images can be introduced in this file, e.g.
|
|
# additional_static_images_list:
|
|
# image1_name: <registry-url>/image1:v1.0
|
|
# image2_name: <registry-url>/image2:v2.0
|
|
# Additional static images required or a DC controller only can also be introduced
|
|
# in this file, e.g.
|
|
# additional_system_controller_static_images_list:
|
|
# image3_name: <registry-url>/image3:v3.0
|
|
# image4_name: <registry-url>/image4:v4.0
|
|
- name: Check if additional image config file exists
|
|
stat:
|
|
path: "{{ additional_system_images_conf_path + '/' + additional_system_images_conf_file }}"
|
|
register: additional_config_file
|
|
|
|
- name: Read in additional system images list(s) in localhost
|
|
include_vars:
|
|
file: "{{ additional_config_file.stat.path }}"
|
|
when: additional_config_file.stat.exists and
|
|
inventory_hostname == "localhost"
|
|
|
|
# When invoking the playbook remotely, the additional config file locates in the remote
|
|
# host may not also exist in the control host, fetch it to the control host to prevent
|
|
# include_vars failure.
|
|
- block:
|
|
- name: Create a temporary file on remote
|
|
tempfile:
|
|
state: file
|
|
prefix: "additional_images_"
|
|
register: additional_system_images_temp_file
|
|
|
|
- name: Fetch the additional images config in case the playbook is executed remotely
|
|
fetch:
|
|
src: "{{ additional_config_file.stat.path }}"
|
|
dest: "{{ additional_system_images_temp_file.path }}"
|
|
flat: yes
|
|
|
|
- name: Read in additional system images list(s) fetched from remote
|
|
include_vars:
|
|
file: "{{ additional_system_images_temp_file.path }}"
|
|
|
|
- name: Remove the temporary file on remote
|
|
file:
|
|
path: "{{ additional_system_images_temp_file.path }}"
|
|
state: absent
|
|
delegate_to: "{{ inventory_hostname }}"
|
|
|
|
- name: Remove override temp file on Ansible control host
|
|
file:
|
|
path: "{{ additional_system_images_temp_file.path }}"
|
|
state: absent
|
|
delegate_to: localhost
|
|
become: no
|
|
|
|
when: additional_config_file.stat.exists and
|
|
inventory_hostname != "localhost"
|
|
|
|
- name: Categorize system images
|
|
set_fact:
|
|
networking_images:
|
|
- "{{ calico_cni_img }}"
|
|
- "{{ calico_node_img }}"
|
|
- "{{ calico_kube_controllers_img }}"
|
|
- "{{ calico_flexvol_img if calico_flexvol_img is defined }}"
|
|
- "{{ multus_img }}"
|
|
- "{{ sriov_cni_img }}"
|
|
- "{{ sriov_network_device_img }}"
|
|
static_images:
|
|
- "{{ n3000_opae_img }}"
|
|
- "{{ kubernetes_entrypoint_img }}"
|
|
- "{{ pause_img }}"
|
|
- "{{ nginx_ingress_controller_img }}"
|
|
- "{{ nginx_kube_webhook_certgen_img }}"
|
|
- "{{ default_backend_img }}"
|
|
- "{{ nginx_opentelemetry_img if nginx_opentelemetry_img is defined }}"
|
|
- "{{ flux_helm_controller_img }}"
|
|
- "{{ flux_source_controller_img }}"
|
|
- "{{ flux_notification_controller_img }}"
|
|
- "{{ flux_kustomize_controller_img }}"
|
|
storage_images:
|
|
- "{{ snapshot_controller_img }}"
|
|
security_images:
|
|
- "{{ cert_manager_acmesolver_img }}"
|
|
- "{{ cert_manager_cainjector_img }}"
|
|
- "{{ cert_manager_controller_img }}"
|
|
- "{{ cert_manager_webhook_img }}"
|
|
- "{{ cert_manager_startupapicheck_img }}"
|
|
|
|
- block:
|
|
- name: Change security images if upgrading from 22.12
|
|
set_fact:
|
|
security_images_upgrade:
|
|
- "{{ cert_manager_acmesolver_img_2212 }}"
|
|
- "{{ cert_manager_cainjector_img_2212 }}"
|
|
- "{{ cert_manager_controller_img_2212 }}"
|
|
- "{{ cert_manager_webhook_img_2212 }}"
|
|
- "{{ cert_manager_ctl_img_2212 }}"
|
|
- "{{ cert_manager_acmesolver_img_171 }}"
|
|
- "{{ cert_manager_cainjector_img_171 }}"
|
|
- "{{ cert_manager_controller_img_171 }}"
|
|
- "{{ cert_manager_webhook_img_171 }}"
|
|
- "{{ cert_manager_ctl_img_171 }}"
|
|
|
|
- name: Merge security images list for upgrade
|
|
set_fact:
|
|
security_images: "{{ security_images + security_images_upgrade }}"
|
|
|
|
when:
|
|
- upgrade_in_progress is defined
|
|
- upgrade_in_progress
|
|
- previous_software_version == '22.12'
|
|
- cert_manager_controller_img_2212 is defined
|
|
|
|
- name: Add armada image if optimized upgrading from 21.12
|
|
set_fact:
|
|
static_images: "{{ static_images + [armada_img_2112] }}"
|
|
when:
|
|
- upgrade_in_progress is defined
|
|
- upgrade_in_progress
|
|
- previous_software_version == '21.12'
|
|
|
|
- name: Add FluxCD image if optimized upgrading from 22.12
|
|
set_fact:
|
|
static_images: "{{ static_images + [flux_helm_controller_img_2212, flux_source_controller_img_2212] }}"
|
|
when:
|
|
- upgrade_in_progress is defined
|
|
- upgrade_in_progress
|
|
- previous_software_version == '22.12'
|
|
|
|
- block:
|
|
- name: Look for the flag indicating that Rook is configured
|
|
shell: >-
|
|
tar --use-compress-program=pigz -tf {{ platform_backup_fqpn }} |
|
|
grep 'etc/platform/.node_rook_configured'
|
|
args:
|
|
warn: false
|
|
failed_when: false
|
|
register: rook_backend
|
|
|
|
- block:
|
|
- name: Get rook-ceph-images.yaml filepath
|
|
shell: >-
|
|
tar --use-compress-program=pigz -tf {{ platform_backup_fqpn }} |
|
|
grep 'rook-ceph-images.yaml'
|
|
failed_when: false
|
|
register: rook_ceph_images_backup_path_tgz
|
|
|
|
- block:
|
|
- name: Retrieve rook-ceph-images.yaml
|
|
command: >-
|
|
tar --use-compress-program=pigz -C /tmp --transform='s,.*/,,'
|
|
-xpf {{ platform_backup_fqpn }} {{ rook_ceph_images_backup_path_tgz.stdout_lines[0] }}
|
|
args:
|
|
warn: false
|
|
|
|
- name: Read rook-ceph-images.yaml file
|
|
shell: cat /tmp/rook-ceph-images.yaml
|
|
register: rook_ceph_images_output
|
|
|
|
- name: Get images downloaded from rook-ceph
|
|
set_fact:
|
|
additional_storage_images_list: "{{ (rook_ceph_images_output.stdout | from_yaml).download_images }}"
|
|
|
|
when: rook_ceph_images_backup_path_tgz.rc == 0
|
|
|
|
when: rook_backend.rc == 0
|
|
|
|
when: mode == "restore" and
|
|
(restore_registry_filesystem is not defined or
|
|
not restore_registry_filesystem|bool) and
|
|
not wipe_ceph_osds|bool
|
|
|
|
- name: Append additional storage images if rook-ceph backend is configured
|
|
set_fact:
|
|
storage_images: "{{ storage_images }} + [ '{{ item | replace('registry.local:9001/', '') }}' ] "
|
|
with_items: "{{ additional_storage_images_list }} "
|
|
when: additional_storage_images_list is defined
|
|
|
|
- name: Append additional static images if provisioned
|
|
set_fact:
|
|
static_images: "{{ static_images }} + [ '{{item.value}}' ]"
|
|
with_items: "{{ additional_static_images_list | default({})| dict2items }}"
|
|
when: additional_static_images_list is defined
|
|
|
|
- block:
|
|
- name: Append additional static images for a DC system controller if provisioned
|
|
set_fact:
|
|
static_images: "{{ static_images }} + [ '{{item.value}}' ]"
|
|
with_items: "{{ additional_system_controller_static_images_list | default({})| dict2items }}"
|
|
when: additional_system_controller_static_images_list is defined
|
|
|
|
when: (distributed_cloud_role is defined and
|
|
distributed_cloud_role == 'systemcontroller') or
|
|
(check_dc_controller is defined and
|
|
check_dc_controller.rc == 0)
|
|
|
|
when: kubernetes_version is defined
|