blob: f1d868edd3c5804f1d6e0adecab1ae034a823c9b [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
19 kubernetes.core.k8s:
20 state: patched
21 api_version: helm.toolkit.fluxcd.io/v2beta1
22 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000023 name: "{{ nova_helm_release_name }}"
24 namespace: "{{ nova_helm_release_namespace }}"
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000025 definition:
26 spec:
27 suspend: true
28
29 - name: Remove the existing HelmRelease
30 kubernetes.core.k8s:
31 state: absent
32 api_version: helm.toolkit.fluxcd.io/v2beta1
33 kind: HelmRelease
Mohammed Naser2145fc32023-01-29 23:23:03 +000034 name: "{{ nova_helm_release_name }}"
35 namespace: "{{ nova_helm_release_namespace }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050036
Mohammed Naser01338322022-03-22 14:51:31 -040037- name: Generate public key for SSH private key
Mohammed Naser0a13cee2023-03-02 11:28:29 +010038 ansible.builtin.import_tasks:
39 file: generate_public_key.yml
Mohammed Naser01338322022-03-22 14:51:31 -040040
Mohammed Naserb7b97d62022-03-12 16:30:00 -050041- name: Deploy Helm chart
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000042 run_once: true
43 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000044 name: "{{ nova_helm_release_name }}"
45 chart_ref: "{{ nova_helm_chart_ref }}"
46 release_namespace: "{{ nova_helm_release_namespace }}"
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000047 create_namespace: true
48 kubeconfig: /etc/kubernetes/admin.conf
Mohammed Naser2145fc32023-01-29 23:23:03 +000049 values: "{{ _nova_helm_values | combine(nova_helm_values, recursive=True) }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050050
51- name: Create Ingress
52 ansible.builtin.include_role:
53 name: openstack_helm_ingress
54 vars:
55 openstack_helm_ingress_endpoint: compute
56 openstack_helm_ingress_service_name: nova-api
57 openstack_helm_ingress_service_port: 8774
Mohammed Naser2145fc32023-01-29 23:23:03 +000058 openstack_helm_ingress_annotations: "{{ nova_ingress_annotations }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050059
60- name: Create Ingress
61 ansible.builtin.include_role:
62 name: openstack_helm_ingress
63 vars:
64 openstack_helm_ingress_endpoint: compute_novnc_proxy
65 openstack_helm_ingress_service_name: nova-novncproxy
66 openstack_helm_ingress_service_port: 6080
Mohammed Naser2145fc32023-01-29 23:23:03 +000067 openstack_helm_ingress_annotations: "{{ nova_ingress_annotations }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050068
Mohammed Naserb7b97d62022-03-12 16:30:00 -050069- name: Create flavors
Mohammed Naser2145fc32023-01-29 23:23:03 +000070 when: nova_flavors | length > 0
Mohammed Naserc8e1a452022-08-11 16:16:13 -040071 block:
72 - name: Wait until compute api service ready
73 kubernetes.core.k8s_info:
74 api_version: apps/v1
75 kind: Deployment
76 name: nova-api-osapi
77 namespace: openstack
78 wait_sleep: 10
79 wait_timeout: 600
80 wait: true
81 wait_condition:
82 type: Available
83 status: true
84
85 - name: Create flavors
86 openstack.cloud.compute_flavor:
87 cloud: atmosphere
88 # Flavor settings
89 flavorid: "{{ item.flavorid | default(omit) }}"
90 name: "{{ item.name }}"
91 vcpus: "{{ item.vcpus }}"
92 ram: "{{ item.ram }}"
93 disk: "{{ item.disk | default(omit) }}"
94 ephemeral: "{{ item.ephemeral | default(omit) }}"
95 swap: "{{ item.swap | default(omit) }}"
96 is_public: "{{ item.is_public | default(omit) }}"
97 rxtx_factor: "{{ item.rxtx_factor | default(omit) }}"
98 extra_specs: "{{ item.extra_specs | default(omit) }}"
Mohammed Naser2145fc32023-01-29 23:23:03 +000099 loop: "{{ nova_flavors }}"
Mohammed Naser6f85b3a2022-09-21 14:57:56 -0400100 # NOTE(mnaser): This often fails with a 503 since we're sending a request
101 # way too fast after the service is ready, retry for now
102 # but the Helm chart should be fixed.
103 #
104 # See: https://github.com/vexxhost/atmosphere/issues/72
105 retries: 60
106 delay: 5
107 register: _result
108 until: _result is not failed