Getting NOVA pieces together to launch VM

This PS gets NOVA related pieces together in order to be able to
launch a VM. It builds upon the work done by wirehead.

Partially-Implements: blueprint nova-kubernetes

Change-Id: I528fc5d84e790bd739c8cb900a9ee14ba7bec9fb
This commit is contained in:
Serguei Bezverkhi 2016-08-22 20:25:47 -04:00
parent d30e5a2a1a
commit 316f546f04
10 changed files with 467 additions and 168 deletions

View File

@ -117,3 +117,11 @@ keystone_admin_url: "{{ admin_protocol }}://keystone-admin:{{ keystone_admin_por
keystone_internal_url: "{{ internal_protocol }}://keystone-internal:{{ keystone_public_port }}/v3"
keystone_public_url: "{{ public_protocol }}://{{ kolla_kubernetes_external_vip }}:{{ keystone_public_port }}/v3"
keystone_database_address: "mariadb"
########################
# NOVA variables
########################
openstack_nova_auth: "{'auth_url':'{{ keystone_auth_url }}','username':'{{ openstack_auth.username }}','password':'$KEYSTONE_ADMIN_PASSWORD','project_name':'{{ openstack_auth.project_name }}','domain_name':'default'}"
nova_admin_endpoint: "http://nova-api:{{ nova_api_port }}/v2/%(tenant_id)s"
nova_public_endpoint: "http://{{ kolla_kubernetes_external_vip }}:{{ nova_api_port }}/v2/%(tenant_id)s"
nova_internal_endpoint: "http://nova-api:{{ nova_api_port }}/v2/%(tenant_id)s"

View File

@ -1,6 +1,8 @@
apiVersion: batch/v1
kind: Job
spec:
parallelism: 1
completions: 1
template:
metadata:
name: nova-compute-generate

View File

@ -1,88 +1,101 @@
apiVersion: v1
kind: Pod
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: nova-compute
labels:
component: nova
system: nova-compute
namespace: default
spec:
hostNetwork: True
hostPID: True
containers:
- name: nova-compute
image: "{{ nova_compute_image_full }}"
securityContext:
privileged: true
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-compute-config
- mountPath: /var/lib/nova
name: nova-compute-persistent-storage
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /lib/modules
name: lib-modules
- mountPath: /run
name: run
- mountPath: /dev
name: dev
- mountPath: /sys/fs/cgroup
name: sys-fs-cgroup
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
- name: nova-libvirt
image: "{{ nova_libvirt_image_full }}"
securityContext:
privileged: true
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-libvirt-config
- mountPath: /var/lib/libvirt
name: nova-libvirt-persistent-storage
- mountPath: /var/lib/nova
name: nova-compute-persistent-storage
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /lib/modules
name: lib-modules
- mountPath: /run
name: run
- mountPath: /dev
name: dev
- mountPath: /sys/fs/cgroup
name: sys-fs-cgroup
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
volumes:
- name: nova-compute-config
configMap:
name: nova-compute-configmap
- name: nova-libvirt-config
configMap:
name: nova-libvirt-configmap
- name: nova-compute-persistent-storage
hostPath:
path: /var/lib/nova
- name: nova-libvirt-persistent-storage
hostPath:
path: /var/lib/libvirt
- name: etc-localtime
hostPath:
path: /etc/localtime
- name: lib-modules
hostPath:
path: /lib/modules
- name: run
hostPath:
path: /run
- name: dev
hostPath:
path: /dev
- name: sys-fs-cgroup
hostPath:
path: /sys/fs/cgroup
- name: kolla-logs
emptyDir: {}
template:
metadata:
name: nova-compute
labels:
component: nova
system: nova-compute
namespace: default
annotations:
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "initialize-nova-compute",
"image": "{{ nova_compute_image_full }}",
"command": [
"sh",
"-c",
"cp -a /config/..data/* /nova/;
ip=$(ip addr show dev {{ tunnel_interface }} | grep -G ''inet '' | awk ''{print $2}'');
sed -i ''s|^my_ip.*=.*|my_ip=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^novncproxy_host.*=.*|novncproxy_host=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^vncserver_listen.*=.*|vncserver_listen=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^vncserver_proxyclient_address.*=.*|vncserver_proxyclient_address=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^novncproxy_base_url.*=.*|novncproxy_base_url=http://''${ip%/*}'':6080/vnc_auto.html|g'' /nova/nova.conf;
sed -i ''s|^connection_uri.*=.*|connection_uri=\"qemu+tcp://''${ip%/*}''/system\"|g'' /nova/nova.conf;"],
"volumeMounts": [
{
"name": "nova-compute-config",
"mountPath": "/config/"
},
{
"name": "nova-config",
"mountPath": "/nova/"
}
]
}
]'
spec:
hostNetwork: True
containers:
- name: nova-compute
image: "{{ nova_compute_image_full }}"
securityContext:
privileged: true
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-config
- mountPath: /var/lib/nova
name: nova-compute-persistent-storage
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /lib/modules
name: lib-modules
- mountPath: /run
name: run
- mountPath: /dev
name: dev
- mountPath: /sys/fs/cgroup
name: sys-fs-cgroup
- mountPath: /nova
name: nova-config
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
volumes:
- name: nova-compute-config
configMap:
name: nova-compute-configmap
- name: nova-compute-persistent-storage
hostPath:
path: /var/lib/nova
- name: etc-localtime
hostPath:
path: /etc/localtime
- name: lib-modules
hostPath:
path: /lib/modules
- name: run
hostPath:
path: /run
- name: dev
hostPath:
path: /dev
- name: sys-fs-cgroup
hostPath:
path: /sys/fs/cgroup
- name: nova-config
emptyDir: {}
- name: kolla-logs
emptyDir: {}
metadata:
name: nova-compute

View File

@ -1,26 +1,55 @@
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1alpha1
kind: PetSet
spec:
serviceName: "nova"
replicas: {{ nova_api_replicas }}
selector:
service: nova
type: api
template:
metadata:
labels:
service: nova
type: api
annotations:
pod.alpha.kubernetes.io/initialized: "true"
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "initialize-nova-api",
"image": "{{ nova_api_image_full }}",
"command": [
"sh",
"-c",
"cp -a /config/..data/* /nova/;
ip=$(ip addr show dev {{ tunnel_interface }} | grep -G ''inet '' | awk ''{print $2}'');
sed -i ''s|^my_ip.*=.*|my_ip=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^novncproxy_host.*=.*|novncproxy_host=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^vncserver_listen.*=.*|vncserver_listen=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^vncserver_proxyclient_address.*=.*|vncserver_proxyclient_address=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^novncproxy_base_url.*=.*|novncproxy_base_url=http://''${ip%/*}'':6080/vnc_auto.html|g'' /nova/nova.conf;
sed -i ''s|^connection_uri.*=.*|connection_uri=qemu+tcp://''${ip%/*}''/system|g'' /nova/nova.conf;" ],
"volumeMounts": [
{
"name": "nova-api-config",
"mountPath": "/config/"
},
{
"name": "nova-config",
"mountPath": "/nova/"
}
]
}
]'
spec:
containers:
- name: nova-api
image: "{{ nova_api_image_full }}"
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-api-config
name: nova-config
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /lib/modules
name: lib-modules
- mountPath: /nova
name: nova-config
- mountPath: /var/log/kolla
name: kolla-logs
env:
@ -43,7 +72,9 @@ spec:
- name: lib-modules
hostPath:
path: /lib/modules
- name: nova-config
emptyDir: {}
- name: kolla-logs
emptyDir: {}
metadata:
name: nova-api
name: nova-api

View File

@ -0,0 +1,41 @@
apiVersion: batch/v1
kind: Job
spec:
parallelism: 1
completions: 1
template:
metadata:
name: nova-control-database-upgrade
spec:
containers:
- image: "{{ nova_api_image_full }}"
name: nova-control-database-upgrade
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-api-config
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /lib/modules
name: lib-modules
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_BOOTSTRAP
value: ""
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
volumes:
- name: nova-api-config
configMap:
name: nova-api-configmap
- name: etc-localtime
hostPath:
path: /etc/localtime
- name: lib-modules
hostPath:
path: /lib/modules
- name: kolla-logs
emptyDir: {}
restartPolicy: OnFailure
metadata:
name: nova-control-databse-upgrade

View File

@ -0,0 +1,84 @@
apiVersion: batch/v1
kind: Job
spec:
parallelism: 1
completions: 1
template:
metadata:
name: nova-control-bootstrap-create-nova-db
spec:
containers:
- image: "{{ kolla_toolbox_image_full }}"
name: creating-nova-database-and-users
command: ["sh", "-c"]
args:
- ansible localhost -m mysql_db -a
"login_host=mariadb
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='$DATABASE_PASSWORD'
name='{{ nova_database_name }}'" &&
ansible localhost -m mysql_db -a
"login_host=mariadb
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='$DATABASE_PASSWORD'
name='{{ nova_api_database_name }}'" &&
ansible localhost -m mysql_user -a
"login_host=mariadb
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='$DATABASE_PASSWORD'
name='{{ nova_database_name }}'
password='$NOVA_DATABASE_PASSWORD'
host='%'
priv='{{ nova_database_name }}.*:ALL'
append_privs='yes'" &&
ansible localhost -m mysql_user -a
"login_host=mariadb
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='$DATABASE_PASSWORD'
name='{{ nova_api_database_name }}'
password='$NOVA_API_DATABASE_PASSWORD'
host='%'
priv='{{ nova_api_database_name }}.*:ALL'
append_privs='yes'"
volumeMounts:
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: ANSIBLE_NOCOLOR
value: "1"
- name: ANSIBLE_LIBRARY
value: "/usr/share/ansible"
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: database-password
key: password
- name: NOVA_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: nova-database-password
key: password
- name: NOVA_API_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: nova-api-database-password
key: password
volumes:
- name: nova-api-config
configMap:
name: nova-api-configmap
- name: etc-localtime
hostPath:
path: /etc/localtime
- name: lib-modules
hostPath:
path: /lib/modules
- name: kolla-logs
emptyDir: {}
restartPolicy: OnFailure
metadata:
name: nova-control-bootstrap-create-nova-db

View File

@ -1,71 +1,13 @@
apiVersion: batch/v1
kind: Job
spec:
parallelism: 1
completions: 1
template:
metadata:
name: nova-compute-generate
name: nova-control-bootstrap-create-endpoints
spec:
containers:
- image: "{{ kolla_toolbox_image_full }}"
name: creating-nova-database-and-users
command: ["sh", "-c"]
args:
- ansible localhost -vvvv -m mysql_db -a
"login_host={{ nova_database_address }}
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ nova_database_name }}'" &&
ansible localhost -vvvv -m mysql_db -a
"login_host={{ nova_api_database_address }}
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ nova_api_database_name }}'" &&
ansible localhost -m mysql_user -a
"login_host={{ nova_database_address }}
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ nova_database_name }}'
password='{{ nova_database_password }}'
host='%'
priv='{{ nova_database_name }}.*:ALL'
append_privs='yes'" &&
ansible localhost -m mysql_user -a
"login_host={{ nova_api_database_address }}
login_port='{{ mariadb_port }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ nova_api_database_name }}'
password='{{ nova_api_database_password }}'
host='%'
priv='{{ nova_api_database_name }}.*:ALL'
append_privs='yes'"
volumeMounts:
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: ANSIBLE_NOCOLOR
value: "1"
- name: ANSIBLE_LIBRARY
value: "/usr/share/ansible"
- image: "{{ nova_api_image_full }}"
name: nova-api
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-api-config
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /lib/modules
name: lib-modules
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_BOOTSTRAP
value: ""
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
- image: "{{ kolla_toolbox_image_full }}"
name: creating-nova-endpoints
command: ["sh", "-c"]
@ -104,7 +46,7 @@ spec:
-m kolla_keystone_user
-a "project=service
user=nova
password={{ nova_keystone_password }}
password=$NOVA_KEYSTONE_PASSWORD
role=admin
region_name={{ openstack_region_name }}
auth={{ '{{ openstack_nova_auth }}' }}"
@ -117,6 +59,16 @@ spec:
value: "1"
- name: ANSIBLE_LIBRARY
value: "/usr/share/ansible"
- name: KEYSTONE_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: keystone-admin-password
key: password
- name: NOVA_KEYSTONE_PASSWORD
valueFrom:
secretKeyRef:
name: nova-keystone-password
key: password
volumes:
- name: nova-api-config
configMap:
@ -131,4 +83,4 @@ spec:
emptyDir: {}
restartPolicy: OnFailure
metadata:
name: nova-control-bootstrap
name: nova-control-bootstrap-create-endpoints

View File

@ -1,24 +1,53 @@
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1alpha1
kind: PetSet
spec:
serviceName: "nova"
replicas: {{ nova_conductor_replicas }}
selector:
service: nova
type: conductor
template:
metadata:
labels:
service: nova
type: conductor
annotations:
pod.alpha.kubernetes.io/initialized: "true"
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "initialize-nova-conductor",
"image": "{{ nova_conductor_image_full }}",
"command": [
"sh",
"-c",
"cp -a /config/..data/* /nova/;
ip=$(ip addr show dev {{ tunnel_interface }} | grep -G ''inet '' | awk ''{print $2}'');
sed -i ''s|^my_ip.*=.*|my_ip=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^novncproxy_host.*=.*|novncproxy_host=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^vncserver_listen.*=.*|vncserver_listen=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^vncserver_proxyclient_address.*=.*|vncserver_proxyclient_address=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^novncproxy_base_url.*=.*|novncproxy_base_url=http://''${ip%/*}'':6080/vnc_auto.html|g'' /nova/nova.conf;
sed -i ''s|^connection_uri.*=.*|connection_uri=qemu+tcp://''${ip%/*}''/system|g'' /nova/nova.conf;" ],
"volumeMounts": [
{
"name": "nova-conductor-config",
"mountPath": "/config/"
},
{
"name": "nova-config",
"mountPath": "/nova/"
}
]
}
]'
spec:
containers:
- name: nova-conductor
image: "{{ nova_conductor_image_full }}"
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-conductor-config
name: nova-config
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /nova
name: nova-config
- mountPath: /var/log/kolla
name: kolla-logs
env:
@ -34,6 +63,8 @@ spec:
- name: lib-modules
hostPath:
path: /lib/modules
- name: nova-config
emptyDir: {}
- name: kolla-logs
emptyDir: {}
metadata:

View File

@ -1,29 +1,62 @@
apiVersion: v1
kind: ReplicationController
apiVersion: apps/v1alpha1
kind: PetSet
spec:
serviceName: "nova"
replicas: {{ nova_scheduler_replicas }}
selector:
service: nova
type: scheduler
template:
metadata:
labels:
service: nova
type: scheduler
type: scheduler
annotations:
pod.alpha.kubernetes.io/initialized: "true"
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "initialize-nova-scheduler",
"image": "{{ nova_scheduler_image_full }}",
"command": [
"sh",
"-c",
"cp -a /config/..data/* /nova/;
ip=$(ip addr show dev {{ tunnel_interface }} | grep -G ''inet '' | awk ''{print $2}'');
sed -i ''s|^my_ip.*=.*|my_ip=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^novncproxy_host.*=.*|novncproxy_host=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^vncserver_listen.*=.*|vncserver_listen=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^vncserver_proxyclient_address.*=.*|vncserver_proxyclient_address=''${ip%/*}''|g'' /nova/nova.conf;
sed -i ''s|^novncproxy_base_url.*=.*|novncproxy_base_url=http://''${ip%/*}'':6080/vnc_auto.html|g'' /nova/nova.conf;
sed -i ''s|^connection_uri.*=.*|connection_uri=qemu+tcp://''${ip%/*}''/system|g'' /nova/nova.conf;" ],
"volumeMounts": [
{
"name": "nova-scheduler-config",
"mountPath": "/config/"
},
{
"name": "nova-config",
"mountPath": "/nova/"
}
]
}
]'
spec:
containers:
- name: nova-scheduler
image: "{{ nova_scheduler_image_full }}"
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-scheduler-config
name: nova-config
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /nova
name: nova-config
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
securityContext:
privileged: true
command: ["sh", "-c"]
args:
volumes:
- name: nova-scheduler-config
configMap:
@ -34,6 +67,8 @@ spec:
- name: lib-modules
hostPath:
path: /lib/modules
- name: nova-config
emptyDir: {}
- name: kolla-logs
emptyDir: {}
metadata:

View File

@ -0,0 +1,102 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: nova-libvirt
labels:
component: nova
system: nova-libvirt
namespace: default
spec:
template:
metadata:
name: nova-libvirt
labels:
component: nova
system: nova-libvirt
namespace: default
annotations:
pod.alpha.kubernetes.io/init-containers: '[
{
"name": "initialize-nova-libvirt",
"image": "{{ nova_libvirt_image_full }}",
"command": [
"sh",
"-c",
"cp -a /config/..data/* /nova/;
ip=$(ip addr show dev {{ tunnel_interface }} | grep -G ''inet '' | awk ''{print $2}'');
sed -i ''s|^listen_addr.*=.*|listen_addr=\"''${ip%/*}''\"|g'' /nova/libvirtd.conf;"],
"volumeMounts": [
{
"name": "nova-libvirt-config",
"mountPath": "/config/"
},
{
"name": "nova-config",
"mountPath": "/nova/"
}
]
}
]'
spec:
hostNetwork: True
hostPID: True
containers:
- name: nova-libvirt
image: "{{ nova_libvirt_image_full }}"
securityContext:
privileged: true
volumeMounts:
- mountPath: {{ container_config_directory }}
name: nova-config
- mountPath: /var/lib/libvirt
name: nova-libvirt-persistent-storage
- mountPath: /var/lib/nova
name: nova-compute-persistent-storage
- mountPath: /etc/localtime
name: etc-localtime
- mountPath: /lib/modules
name: lib-modules
- mountPath: /run
name: run
- mountPath: /dev
name: dev
- mountPath: /sys/fs/cgroup
name: sys-fs-cgroup
- mountPath: /nova
name: nova-config
- mountPath: /var/log/kolla
name: kolla-logs
env:
- name: KOLLA_CONFIG_STRATEGY
value: {{ config_strategy }}
volumes:
- name: nova-compute-persistent-storage
hostPath:
path: /var/lib/nova
- name: nova-libvirt-config
configMap:
name: nova-libvirt-configmap
- name: nova-libvirt-persistent-storage
hostPath:
path: /var/lib/libvirt
- name: etc-localtime
hostPath:
path: /etc/localtime
- name: lib-modules
hostPath:
path: /lib/modules
- name: run
hostPath:
path: /run
- name: dev
hostPath:
path: /dev
- name: sys-fs-cgroup
hostPath:
path: /sys/fs/cgroup
- name: nova-config
emptyDir: {}
- name: kolla-logs
emptyDir: {}
metadata:
name: nova-libvirt