blob: ebc90a00b398c096efc9a33dd16b77cd4a4c5f70 [file] [log] [blame]
Mohammed Naserb7b97d62022-03-12 16:30:00 -05001# Copyright (c) 2022 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
Mohammed Naser94e07e12023-01-18 03:29:39 +000015# NOTE(mnaser): We should get rid of this task eventually as it is suspending
16# the old HelmRelease and removing it to avoid uninstalling the
17# Helm chart.
18- name: Uninstall the legacy HelmRelease
19 run_once: true
20 block:
21 - name: Suspend the existing HelmRelease
Mohammed Naserf0314a82023-04-11 18:53:30 +000022 failed_when: false
Mohammed Naser94e07e12023-01-18 03:29:39 +000023 kubernetes.core.k8s:
24 state: patched
25 api_version: helm.toolkit.fluxcd.io/v2beta1
26 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000027 name: "{{ placement_helm_release_name }}"
28 namespace: "{{ placement_helm_release_namespace }}"
Mohammed Naser94e07e12023-01-18 03:29:39 +000029 definition:
30 spec:
31 suspend: true
32
33 - name: Remove the existing HelmRelease
Mohammed Naserf0314a82023-04-11 18:53:30 +000034 failed_when: false
Mohammed Naser94e07e12023-01-18 03:29:39 +000035 kubernetes.core.k8s:
36 state: absent
37 api_version: helm.toolkit.fluxcd.io/v2beta1
38 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000039 name: "{{ placement_helm_release_name }}"
40 namespace: "{{ placement_helm_release_namespace }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050041
42- name: Deploy Helm chart
Mohammed Naser94e07e12023-01-18 03:29:39 +000043 run_once: true
44 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000045 name: "{{ placement_helm_release_name }}"
46 chart_ref: "{{ placement_helm_chart_ref }}"
47 release_namespace: "{{ placement_helm_release_namespace }}"
Mohammed Naser94e07e12023-01-18 03:29:39 +000048 create_namespace: true
49 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000050 values: "{{ _placement_helm_values | combine(placement_helm_values, recursive=True) }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050051
52- name: Create Ingress
53 ansible.builtin.include_role:
54 name: openstack_helm_ingress
55 vars:
56 openstack_helm_ingress_endpoint: placement
57 openstack_helm_ingress_service_name: placement-api
58 openstack_helm_ingress_service_port: 8778
Mohammed Naser2145fc32023-01-29 23:23:03 +000059 openstack_helm_ingress_annotations: "{{ placement_ingress_annotations }}"