blob: eb7df7659965f190fb8bafb9d0054d53f8c55bdc [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
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000015- name: Uninstall the legacy HelmRelease
16 run_once: true
17 block:
18 - name: Suspend the existing HelmRelease
Mohammed Naserf0314a82023-04-11 18:53:30 +000019 failed_when: false
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000020 kubernetes.core.k8s:
21 state: patched
22 api_version: helm.toolkit.fluxcd.io/v2beta1
23 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000024 name: "{{ nova_helm_release_name }}"
25 namespace: "{{ nova_helm_release_namespace }}"
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000026 definition:
27 spec:
28 suspend: true
29
30 - name: Remove the existing HelmRelease
Mohammed Naserf0314a82023-04-11 18:53:30 +000031 failed_when: false
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000032 kubernetes.core.k8s:
33 state: absent
34 api_version: helm.toolkit.fluxcd.io/v2beta1
35 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000036 name: "{{ nova_helm_release_name }}"
37 namespace: "{{ nova_helm_release_namespace }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050038
Mohammed Naser01338322022-03-22 14:51:31 -040039- name: Generate public key for SSH private key
Mohammed Naser0a13cee2023-03-02 11:28:29 +010040 ansible.builtin.import_tasks:
41 file: generate_public_key.yml
Mohammed Naser01338322022-03-22 14:51:31 -040042
Mohammed Naserb7b97d62022-03-12 16:30:00 -050043- name: Deploy Helm chart
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000044 run_once: true
45 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000046 name: "{{ nova_helm_release_name }}"
47 chart_ref: "{{ nova_helm_chart_ref }}"
48 release_namespace: "{{ nova_helm_release_namespace }}"
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000049 create_namespace: true
50 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000051 values: "{{ _nova_helm_values | combine(nova_helm_values, recursive=True) }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050052
53- name: Create Ingress
54 ansible.builtin.include_role:
55 name: openstack_helm_ingress
56 vars:
57 openstack_helm_ingress_endpoint: compute
58 openstack_helm_ingress_service_name: nova-api
59 openstack_helm_ingress_service_port: 8774
Mohammed Naser2145fc32023-01-29 23:23:03 +000060 openstack_helm_ingress_annotations: "{{ nova_ingress_annotations }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050061
62- name: Create Ingress
63 ansible.builtin.include_role:
64 name: openstack_helm_ingress
65 vars:
66 openstack_helm_ingress_endpoint: compute_novnc_proxy
67 openstack_helm_ingress_service_name: nova-novncproxy
68 openstack_helm_ingress_service_port: 6080
Mohammed Naser2145fc32023-01-29 23:23:03 +000069 openstack_helm_ingress_annotations: "{{ nova_ingress_annotations }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050070
Mohammed Naserb7b97d62022-03-12 16:30:00 -050071- name: Create flavors
Mohammed Naser2145fc32023-01-29 23:23:03 +000072 when: nova_flavors | length > 0
Mohammed Naserc8e1a452022-08-11 16:16:13 -040073 block:
74 - name: Wait until compute api service ready
75 kubernetes.core.k8s_info:
76 api_version: apps/v1
77 kind: Deployment
78 name: nova-api-osapi
79 namespace: openstack
80 wait_sleep: 10
81 wait_timeout: 600
82 wait: true
83 wait_condition:
84 type: Available
85 status: true
86
87 - name: Create flavors
88 openstack.cloud.compute_flavor:
89 cloud: atmosphere
90 # Flavor settings
91 flavorid: "{{ item.flavorid | default(omit) }}"
92 name: "{{ item.name }}"
93 vcpus: "{{ item.vcpus }}"
94 ram: "{{ item.ram }}"
95 disk: "{{ item.disk | default(omit) }}"
96 ephemeral: "{{ item.ephemeral | default(omit) }}"
97 swap: "{{ item.swap | default(omit) }}"
98 is_public: "{{ item.is_public | default(omit) }}"
99 rxtx_factor: "{{ item.rxtx_factor | default(omit) }}"
100 extra_specs: "{{ item.extra_specs | default(omit) }}"
Mohammed Naser2145fc32023-01-29 23:23:03 +0000101 loop: "{{ nova_flavors }}"
Mohammed Naser6f85b3a2022-09-21 14:57:56 -0400102 # NOTE(mnaser): This often fails with a 503 since we're sending a request
103 # way too fast after the service is ready, retry for now
104 # but the Helm chart should be fixed.
105 #
106 # See: https://github.com/vexxhost/atmosphere/issues/72
107 retries: 60
108 delay: 5
109 register: _result
110 until: _result is not failed