blob: a86aa0c71fc9d14103f38bad0ecf7cfcee68118e [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 Naser01338322022-03-22 14:51:31 -040015- name: Generate public key for SSH private key
Mohammed Naser0a13cee2023-03-02 11:28:29 +010016 ansible.builtin.import_tasks:
17 file: generate_public_key.yml
Mohammed Naser01338322022-03-22 14:51:31 -040018
ricolind0f23d82023-08-03 15:32:32 +080019# NOTE(okozachenko1203): We cannot set helm hook for jobs.
20# As a workaround, remove them before upgrade nova helm release.
21- name: Remove nova-bootstrap and nova-cell-setup job
Oleksandr Kozachenkof5adeb52023-05-30 21:23:51 +020022 changed_when: false
23 failed_when: false
24 kubernetes.core.k8s:
25 state: absent
26 api_version: batch/v1
27 kind: Job
ricolind0f23d82023-08-03 15:32:32 +080028 name: "{{ item }}"
Oleksandr Kozachenkof5adeb52023-05-30 21:23:51 +020029 namespace: "{{ nova_helm_release_namespace }}"
ricolind0f23d82023-08-03 15:32:32 +080030 loop:
31 - nova-bootstrap
32 - nova-cell-setup
Oleksandr Kozachenkof5adeb52023-05-30 21:23:51 +020033
Mohammed Naserb7b97d62022-03-12 16:30:00 -050034- name: Deploy Helm chart
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000035 run_once: true
36 kubernetes.core.helm:
Mohammed Naser2145fc32023-01-29 23:23:03 +000037 name: "{{ nova_helm_release_name }}"
38 chart_ref: "{{ nova_helm_chart_ref }}"
39 release_namespace: "{{ nova_helm_release_namespace }}"
guilhermesteinmuller700eb2f2023-01-24 19:08:31 +000040 create_namespace: true
Austin Talbot78a774a2024-09-25 10:15:36 -060041 kubeconfig: "{{ nova_helm_kubeconfig }}"
Mohammed Naser2145fc32023-01-29 23:23:03 +000042 values: "{{ _nova_helm_values | combine(nova_helm_values, recursive=True) }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050043
44- name: Create Ingress
45 ansible.builtin.include_role:
46 name: openstack_helm_ingress
47 vars:
48 openstack_helm_ingress_endpoint: compute
49 openstack_helm_ingress_service_name: nova-api
50 openstack_helm_ingress_service_port: 8774
Oleksandr Kozachenkoaf9972f2023-10-17 19:25:12 +020051 openstack_helm_ingress_annotations: "{{ nova_api_ingress_annotations }}"
Mohammed Naserc139abc2025-02-05 14:03:20 -050052 openstack_helm_ingress_class_name: "{{ nova_api_ingress_class_name }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050053
54- name: Create Ingress
55 ansible.builtin.include_role:
56 name: openstack_helm_ingress
57 vars:
58 openstack_helm_ingress_endpoint: compute_novnc_proxy
59 openstack_helm_ingress_service_name: nova-novncproxy
60 openstack_helm_ingress_service_port: 6080
Oleksandr Kozachenkoaf9972f2023-10-17 19:25:12 +020061 openstack_helm_ingress_annotations: "{{ _nova_novnc_ingress_annotations | combine(nova_novnc_ingress_annotations) }}"
Mohammed Naserc139abc2025-02-05 14:03:20 -050062 openstack_helm_ingress_class_name: "{{ nova_novnc_ingress_class_name }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050063
Mohammed Naserb7b97d62022-03-12 16:30:00 -050064- name: Create flavors
Mohammed Naser2145fc32023-01-29 23:23:03 +000065 when: nova_flavors | length > 0
Mohammed Naserc8e1a452022-08-11 16:16:13 -040066 block:
67 - name: Wait until compute api service ready
68 kubernetes.core.k8s_info:
69 api_version: apps/v1
70 kind: Deployment
71 name: nova-api-osapi
72 namespace: openstack
73 wait_sleep: 10
74 wait_timeout: 600
75 wait: true
76 wait_condition:
77 type: Available
78 status: true
79
80 - name: Create flavors
81 openstack.cloud.compute_flavor:
82 cloud: atmosphere
83 # Flavor settings
84 flavorid: "{{ item.flavorid | default(omit) }}"
85 name: "{{ item.name }}"
86 vcpus: "{{ item.vcpus }}"
87 ram: "{{ item.ram }}"
88 disk: "{{ item.disk | default(omit) }}"
89 ephemeral: "{{ item.ephemeral | default(omit) }}"
90 swap: "{{ item.swap | default(omit) }}"
91 is_public: "{{ item.is_public | default(omit) }}"
92 rxtx_factor: "{{ item.rxtx_factor | default(omit) }}"
93 extra_specs: "{{ item.extra_specs | default(omit) }}"
Mohammed Naser2145fc32023-01-29 23:23:03 +000094 loop: "{{ nova_flavors }}"
Mohammed Naser6f85b3a2022-09-21 14:57:56 -040095 # NOTE(mnaser): This often fails with a 503 since we're sending a request
96 # way too fast after the service is ready, retry for now
97 # but the Helm chart should be fixed.
98 #
99 # See: https://github.com/vexxhost/atmosphere/issues/72
100 retries: 60
101 delay: 5
102 register: _result
103 until: _result is not failed