blob: 813f042a8a799615050847ecebb8048691f83375 [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
41 kubeconfig: /etc/kubernetes/admin.conf
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 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_novnc_proxy
58 openstack_helm_ingress_service_name: nova-novncproxy
59 openstack_helm_ingress_service_port: 6080
Oleksandr Kozachenkoaf9972f2023-10-17 19:25:12 +020060 openstack_helm_ingress_annotations: "{{ _nova_novnc_ingress_annotations | combine(nova_novnc_ingress_annotations) }}"
Mohammed Naserb7b97d62022-03-12 16:30:00 -050061
Mohammed Naserb7b97d62022-03-12 16:30:00 -050062- name: Create flavors
Mohammed Naser2145fc32023-01-29 23:23:03 +000063 when: nova_flavors | length > 0
Mohammed Naserc8e1a452022-08-11 16:16:13 -040064 block:
65 - name: Wait until compute api service ready
66 kubernetes.core.k8s_info:
67 api_version: apps/v1
68 kind: Deployment
69 name: nova-api-osapi
70 namespace: openstack
71 wait_sleep: 10
72 wait_timeout: 600
73 wait: true
74 wait_condition:
75 type: Available
76 status: true
77
78 - name: Create flavors
79 openstack.cloud.compute_flavor:
80 cloud: atmosphere
81 # Flavor settings
82 flavorid: "{{ item.flavorid | default(omit) }}"
83 name: "{{ item.name }}"
84 vcpus: "{{ item.vcpus }}"
85 ram: "{{ item.ram }}"
86 disk: "{{ item.disk | default(omit) }}"
87 ephemeral: "{{ item.ephemeral | default(omit) }}"
88 swap: "{{ item.swap | default(omit) }}"
89 is_public: "{{ item.is_public | default(omit) }}"
90 rxtx_factor: "{{ item.rxtx_factor | default(omit) }}"
91 extra_specs: "{{ item.extra_specs | default(omit) }}"
Mohammed Naser2145fc32023-01-29 23:23:03 +000092 loop: "{{ nova_flavors }}"
Mohammed Naser6f85b3a2022-09-21 14:57:56 -040093 # NOTE(mnaser): This often fails with a 503 since we're sending a request
94 # way too fast after the service is ready, retry for now
95 # but the Helm chart should be fixed.
96 #
97 # See: https://github.com/vexxhost/atmosphere/issues/72
98 retries: 60
99 delay: 5
100 register: _result
101 until: _result is not failed