150 lines
4.9 KiB
Django/Jinja
Executable File
150 lines
4.9 KiB
Django/Jinja
Executable File
{%- set resourceName = kolla_kubernetes.cli.args.resource_name %}
|
|
{%- set netHostTrue = "yes" %}
|
|
{%- import "services/common/common-lib.yml.j2" as lib with context %}
|
|
apiVersion: extensions/v1beta1
|
|
kind: DaemonSet
|
|
metadata:
|
|
name: nova-compute
|
|
labels:
|
|
component: nova
|
|
system: nova-compute
|
|
namespace: {{ kolla_kubernetes_namespace }}
|
|
spec:
|
|
template:
|
|
metadata:
|
|
labels:
|
|
component: nova
|
|
system: nova-compute
|
|
annotations:
|
|
pod.alpha.kubernetes.io/init-containers: '[
|
|
{
|
|
"name": "initialize-nova-compute",
|
|
"image": "{{ kolla_toolbox_image_full }}",
|
|
"command": [
|
|
"sh",
|
|
"-xec",
|
|
"cp -a /config/..data/* /nova/;
|
|
IP=$(ip addr show dev {{ tunnel_interface }} | grep -G ''inet '' | awk ''{print $2}'' | sed ''s@/.*@@'');
|
|
mkdir -p /var/log/kolla/nova-init;
|
|
echo Using $IP | tee /var/log/kolla/nova-init/ip.log;
|
|
crudini --set /nova/nova.conf DEFAULT my_ip $IP;
|
|
crudini --set /nova/nova.conf vnc novncproxy_host $IP;
|
|
crudini --set /nova/nova.conf vnc vncserver_listen $IP;
|
|
crudini --set /nova/nova.conf vnc vncserver_proxyclient_address $IP;
|
|
crudini --set /nova/nova.conf vnc novncproxy_base_url {{ novncproxy_base_url }};
|
|
{%- if enable_libvirt_tcp == "yes" %}
|
|
sed -i ''s|^connection_uri.*=.*|connection_uri=\"qemu+tcp://127.0.0.1/system\"|g'' /nova/nova.conf;
|
|
{%- endif %}
|
|
{%- if enable_ceph == "yes" %}
|
|
cp -a /secret/a/..data/ceph.client.nova.keyring /nova/ceph.client.nova.keyring;
|
|
cp -a /config2/..data/ceph.conf /nova/ceph.conf;
|
|
{%- endif %}
|
|
"],
|
|
"volumeMounts": [
|
|
{%- if enable_ceph == "yes" %}
|
|
{
|
|
"name": "ceph-conf",
|
|
"mountPath": "/config2/"
|
|
},
|
|
{
|
|
"name": "ceph-client-nova-keyring",
|
|
"mountPath": "/secret/a/"
|
|
},
|
|
{%- endif %}
|
|
{
|
|
"name": "kolla-logs",
|
|
"mountPath": "/var/log/kolla/"
|
|
},
|
|
{
|
|
"name": "nova-compute-config",
|
|
"mountPath": "/config/"
|
|
},
|
|
{
|
|
"name": "nova-config",
|
|
"mountPath": "/nova/"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "initialize-nova",
|
|
"image": "{{ nova_compute_image_full }}",
|
|
"command": [
|
|
"sh",
|
|
"-ce",
|
|
"[ ! -d /var/lib/nova/instances ] && mkdir -p /var/lib/nova/instances;
|
|
chown nova: /var/lib/nova;
|
|
chown nova: /var/lib/nova/instances;
|
|
"],
|
|
"securityContext": {
|
|
"runAsUser": 0
|
|
},
|
|
"volumeMounts": [
|
|
{
|
|
"name": "nova-compute-persistent-storage",
|
|
"mountPath": "/var/lib/nova"
|
|
}
|
|
]
|
|
}
|
|
]'
|
|
spec:
|
|
hostNetwork: True
|
|
nodeSelector:
|
|
{%- set selector = kolla_kubernetes_hostlabel_compute %}
|
|
{{ selector.key }}: {{ selector.value }}
|
|
{%- if enable_libvirt_tcp != "yes" %}
|
|
hostIPC: True
|
|
{%- endif %}
|
|
containers:
|
|
- name: main
|
|
image: "{{ nova_compute_image_full }}"
|
|
securityContext:
|
|
privileged: true
|
|
volumeMounts:
|
|
{{ lib.common_volume_mounts(indent=12) }}
|
|
- mountPath: {{ container_config_directory }}
|
|
name: nova-config
|
|
- mountPath: /var/lib/nova
|
|
name: nova-compute-persistent-storage
|
|
- mountPath: /lib/modules
|
|
name: lib-modules
|
|
- mountPath: /var/run
|
|
name: run
|
|
- mountPath: /dev
|
|
name: dev
|
|
- mountPath: /sys/fs/cgroup
|
|
name: sys-fs-cgroup
|
|
env:
|
|
- name: KOLLA_CONFIG_STRATEGY
|
|
value: {{ config_strategy }}
|
|
{{ lib.common_containers(indent=8) }}
|
|
volumes:
|
|
{{ lib.common_volumes(indent=8) }}
|
|
- name: nova-compute-config
|
|
configMap:
|
|
name: nova-compute
|
|
- name: nova-compute-persistent-storage
|
|
hostPath:
|
|
path: /var/lib/nova
|
|
- name: lib-modules
|
|
hostPath:
|
|
path: /lib/modules
|
|
- name: run
|
|
hostPath:
|
|
path: /var/run
|
|
- name: dev
|
|
hostPath:
|
|
path: /dev
|
|
- name: sys-fs-cgroup
|
|
hostPath:
|
|
path: /sys/fs/cgroup
|
|
- name: nova-config
|
|
emptyDir: {}
|
|
{%- if enable_ceph == "yes" %}
|
|
- name: ceph-conf
|
|
configMap:
|
|
name: ceph-conf
|
|
- name: ceph-client-nova-keyring
|
|
secret:
|
|
secretName: ceph-client-nova-keyring
|
|
{%- endif %}
|