blob: 69430e876a08b1527851282a3570f9f8ae10008c [file] [log] [blame]
# Copyright (c) 2023 VEXXHOST, Inc.
#
# 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: Replace unnecessary label in ovn-controller daemonset
run_once: true
when: atmosphere_network_backend == 'ovn'
block:
- name: Check if ovn_controller DaemonSet exists
kubernetes.core.k8s_info:
api_version: apps/v1
kind: DaemonSet
namespace: "{{ ovn_helm_release_namespace }}"
name: ovn-controller
kubeconfig: /etc/kubernetes/admin.conf
register: _ovn_controller_ds_info
failed_when: false
- name: Delete existing ovn controller DaemonSet if type label is found
kubernetes.core.k8s:
api_version: apps/v1
kind: DaemonSet
name: ovn-controller
namespace: "{{ ovn_helm_release_namespace }}"
state: absent
kubeconfig: /etc/kubernetes/admin.conf
when:
- _ovn_controller_ds_info.resources | length > 0
- "'type' in _ovn_controller_ds_info.resources[0].spec.selector.matchLabels"
- name: Cache ovn-controller image before install or upgrade
block:
- name: Pull ovn-controller image
ansible.builtin.command: crictl pull {{ atmosphere_images['ovn_controller'] }}
register: pull_result
changed_when: false
- name: Verify ovn-controller image pull
ansible.builtin.assert:
that:
- pull_result.rc == 0
- "'Image is up to date' in pull_result.stdout or 'Image pulled' in pull_result.stdout"
fail_msg: "Failed to pull ovn-controller image"
success_msg: "Successfully pulled ovn-controller image"
- name: Deploy Helm chart
run_once: true
when: atmosphere_network_backend == 'ovn'
kubernetes.core.helm:
name: "{{ ovn_helm_release_name }}"
chart_ref: "{{ ovn_helm_chart_ref }}"
release_namespace: "{{ ovn_helm_release_namespace }}"
create_namespace: true
kubeconfig: /etc/kubernetes/admin.conf
values: "{{ _ovn_helm_values | combine(ovn_helm_values, recursive=True) }}"