fuel-ccp-glance/service/glance-api.yaml

135 lines
4.5 KiB
YAML

dsl_version: 0.4.0
service:
name: glance-api
ports:
- {{ glance.api_port }}
annotations:
service:
prometheus.io/probe: "true"
prometheus.io/probe_path: "/healthcheck"
containers:
- name: glance-api
image: glance-api
pre:
- name: glance-db-create
dependencies:
- {{ service.database }}
type: single
command:
mysql -u root -p{{ db.root_password }} -h {{ address(service.database) }} -e "create database {{ glance.db.name }};
create user '{{ glance.db.username }}'@'%' identified by '{{ glance.db.password }}'
{% if db.tls.enabled %} require ssl {% endif %};
grant all privileges on {{ glance.db.name }}.* to '{{ glance.db.username }}'@'%' identified by '{{ glance.db.password }}'
{% if db.tls.enabled %} require ssl {% endif %};"
- name: glance-db-sync
files:
- glance-api
dependencies:
- glance-db-create
type: single
command: glance-manage db_sync
- name: glance-user-create
dependencies:
- keystone-create-domain
type: single
command: openstack user create --domain {{ service_account.domain }} --password {{ glance.password }} {{ glance.user }}
- name: glance-role-add
dependencies:
- glance-user-create
type: single
command: openstack role add --project {{ service_account.project }} --user {{ glance.user }} admin
- name: glance-service-create
dependencies:
- keystone
type: single
command: openstack service create --name glance --description "OpenStack Image service" image
- name: glance-public-endpoint-create
dependencies:
- glance-service-create
type: single
command: openstack endpoint create --region RegionOne image public {{ address('glance-api', glance.api_port, external=True, with_scheme=True) }}
- name: glance-internal-endpoint-create
dependencies:
- glance-service-create
type: single
command: openstack endpoint create --region RegionOne image internal {{ address('glance-api', glance.api_port, with_scheme=True) }}
- name: glance-admin-endpoint-create
dependencies:
- glance-service-create
type: single
command: openstack endpoint create --region RegionOne image admin {{ address('glance-api', glance.api_port, with_scheme=True) }}
daemon:
files:
- glance-api
# {% if glance.tls.enabled %}
- ca_cert
# {% endif %}
# {% if glance.ceph.enable %}
- ceph-conf
- glance-ceph-key
# {% endif %}
# {% if glance.swift.enable %}
- glance-swift-conf
# {% endif %}
command: glance-api
dependencies:
- memcached
# {% if glance.bootstrap.enable %}
post:
- name: glance-cirros-image-upload
type: single
command: /opt/ccp/bin/glance-cirros-image-upload.sh
files:
- glance-cirros-image-upload.sh
# {% endif %}
# {% if glance.tls.enabled %}
- name: nginx-glance-api
image: nginx
daemon:
files:
- upstreams
- servers
- server-cert
- server-key
command: nginx
# {% endif %}
files:
glance-api:
path: /etc/glance/glance-api.conf
content: glance-api.conf.j2
ceph-conf:
path: /etc/ceph/ceph.conf
content: ceph.conf.j2
glance-ceph-key:
path: /etc/ceph/ceph.client.{{ glance.ceph.username }}.keyring
content: ceph.client.glance.keyring.j2
glance-swift-conf:
path: /etc/glance/glance-swift-store.conf
content: glance-swift-store.conf.j2
glance-cirros-image-upload.sh:
path: /opt/ccp/bin/glance-cirros-image-upload.sh
content: glance-cirros-image-upload.sh.j2
perm: "500"
# {% if glance.tls.enabled %}
servers:
path: /etc/nginx/conf.d/servers.conf
content: nginx-api.conf.j2
perm: "0400"
upstreams:
path: /etc/nginx/conf.d/upstreams.conf
content: upstreams.conf.j2
perm: "0400"
ca_cert:
path: /opt/ccp/etc/tls/ca.pem
content: ca-cert.pem.j2
server-cert:
path: /opt/ccp/etc/tls/server-cert.pem
content: server-cert.pem.j2
perm: "0400"
server-key:
path: /opt/ccp/etc/tls/server-key.pem
content: server-key.pem.j2
perm: "0400"
# {% endif %}