blob: 69430e876a08b1527851282a3570f9f8ae10008c [file] [log] [blame]
Mohammed Naser54ee9922023-07-22 18:40:25 +00001# Copyright (c) 2023 VEXXHOST, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
Oleksandr K.9dcaa8f2024-10-29 18:48:53 +010015- name: Replace unnecessary label in ovn-controller daemonset
16 run_once: true
17 when: atmosphere_network_backend == 'ovn'
18 block:
19 - name: Check if ovn_controller DaemonSet exists
20 kubernetes.core.k8s_info:
21 api_version: apps/v1
22 kind: DaemonSet
23 namespace: "{{ ovn_helm_release_namespace }}"
24 name: ovn-controller
25 kubeconfig: /etc/kubernetes/admin.conf
26 register: _ovn_controller_ds_info
27 failed_when: false
28
29 - name: Delete existing ovn controller DaemonSet if type label is found
30 kubernetes.core.k8s:
31 api_version: apps/v1
32 kind: DaemonSet
33 name: ovn-controller
34 namespace: "{{ ovn_helm_release_namespace }}"
35 state: absent
36 kubeconfig: /etc/kubernetes/admin.conf
37 when:
38 - _ovn_controller_ds_info.resources | length > 0
39 - "'type' in _ovn_controller_ds_info.resources[0].spec.selector.matchLabels"
40
guilhermesteinmuller7dd5c802025-01-16 16:51:48 -030041- name: Cache ovn-controller image before install or upgrade
42 block:
43 - name: Pull ovn-controller image
44 ansible.builtin.command: crictl pull {{ atmosphere_images['ovn_controller'] }}
45 register: pull_result
46 changed_when: false
47
48 - name: Verify ovn-controller image pull
49 ansible.builtin.assert:
50 that:
51 - pull_result.rc == 0
52 - "'Image is up to date' in pull_result.stdout or 'Image pulled' in pull_result.stdout"
53 fail_msg: "Failed to pull ovn-controller image"
54 success_msg: "Successfully pulled ovn-controller image"
55
Mohammed Naser54ee9922023-07-22 18:40:25 +000056- name: Deploy Helm chart
57 run_once: true
Mohammed Naser1d75a922023-07-23 19:24:49 +000058 when: atmosphere_network_backend == 'ovn'
Mohammed Naser54ee9922023-07-22 18:40:25 +000059 kubernetes.core.helm:
60 name: "{{ ovn_helm_release_name }}"
61 chart_ref: "{{ ovn_helm_chart_ref }}"
62 release_namespace: "{{ ovn_helm_release_namespace }}"
63 create_namespace: true
64 kubeconfig: /etc/kubernetes/admin.conf
65 values: "{{ _ovn_helm_values | combine(ovn_helm_values, recursive=True) }}"