147 lines
4.8 KiB
Django/Jinja
147 lines
4.8 KiB
Django/Jinja
{%- set resourceName = kolla_kubernetes.cli.args.service_name %}
|
|
apiVersion: extensions/v1beta1
|
|
kind: Deployment
|
|
metadata:
|
|
name: glance-api
|
|
spec:
|
|
replicas: {{ glance_api_replicas }}
|
|
strategy:
|
|
{% if glance_backend_ceph == "yes" %}
|
|
rollingUpdate:
|
|
maxSurge: 1
|
|
maxUnavailable: 1
|
|
type: RollingUpdate
|
|
{% else %}
|
|
rollingUpdate:
|
|
maxSurge: 0
|
|
maxUnavailable: 100%
|
|
type: RollingUpdate
|
|
{% endif %}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
service: glance
|
|
type: api
|
|
annotations:
|
|
{% if glance_backend_ceph == "yes" %}
|
|
kolla_upgrade: minor_rolling_safe
|
|
{% endif %}
|
|
#FIXME Once out of alpha, this should be converted to yaml.
|
|
#FIXME once all services are converted, bind_host can be dropped here and changed to default to 127.0.0.1 instead of 0.0.0.0.
|
|
# The init container overrides the listen address and port to ensure it does not conflict with haproxy and prevent
|
|
# other containers from directly accessing the service
|
|
pod.alpha.kubernetes.io/init-containers: '[
|
|
{
|
|
"name": "update-config",
|
|
"image": "{{ kolla_toolbox_image_full }}",
|
|
"command": [
|
|
"/bin/sh",
|
|
"-c",
|
|
"cp -a /srv/configmap/..data/* /srv/pod-main-config/;
|
|
crudini --set /srv/pod-main-config/glance-api.conf DEFAULT bind_host 127.0.0.1;
|
|
crudini --set /srv/pod-main-config/glance-api.conf DEFAULT bind_port 8080;"
|
|
],
|
|
"volumeMounts": [
|
|
{
|
|
"name": "glance-api-configmap",
|
|
"mountPath": "/srv/configmap"
|
|
},
|
|
{
|
|
"name": "pod-main-config",
|
|
"mountPath": "/srv/pod-main-config"
|
|
}
|
|
]
|
|
}
|
|
]'
|
|
spec:
|
|
#You've got 2 days to drain or figure out why it won't.
|
|
terminationGracePeriodSeconds: {{ 2 * 24 * 60 * 60 }}
|
|
containers:
|
|
- name: haproxy
|
|
image: "{{ haproxy_image_full }}"
|
|
command:
|
|
- /bin/bash
|
|
- -c
|
|
- |
|
|
kolla_start;
|
|
touch /var/lib/kolla-kubernetes/event/shutdown;
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /healthcheck
|
|
port: {{ glance_api_port }}
|
|
initialDelaySeconds: 5
|
|
timeoutSeconds: 5
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
#FIXME move script into haproxy container
|
|
#NOTE this only works if you arn't doing a haproxy reconfigure too.
|
|
#But shouldn't ever have to do that in a setup like this.
|
|
command:
|
|
- /bin/bash
|
|
- -c
|
|
- |
|
|
kill -USR1 $(</var/run/haproxy.pid);
|
|
while true; do sleep 1000; done
|
|
volumeMounts:
|
|
- mountPath: /var/lib/kolla-kubernetes/event
|
|
name: kolla-kubernetes-events
|
|
- mountPath: {{ container_config_directory }}
|
|
name: glance-haproxy-config
|
|
- mountPath: /var/log/kolla/
|
|
name: kolla-logs
|
|
- mountPath: /etc/localtime
|
|
name: etc-localtime
|
|
env:
|
|
- name: KOLLA_CONFIG_STRATEGY
|
|
value: {{ config_strategy }}
|
|
ports:
|
|
- containerPort: {{ glance_api_port }}
|
|
name: glance-api
|
|
- name: glance-api
|
|
image: "{{ glance_api_image_full }}"
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
command:
|
|
- /bin/bash
|
|
- -c
|
|
- while true; do sleep 1; [ -f /var/lib/kolla-kubernetes/event/shutdown ] && break; done
|
|
volumeMounts:
|
|
- mountPath: /var/lib/kolla-kubernetes/event
|
|
name: kolla-kubernetes-events
|
|
- mountPath: {{ container_config_directory }}
|
|
name: pod-main-config
|
|
{% if glance_backend_ceph != "yes" %}
|
|
- mountPath: /var/lib/glance/
|
|
name: glance-persistent-storage
|
|
{% endif %}
|
|
- mountPath: /var/log/kolla/
|
|
name: kolla-logs
|
|
- mountPath: /etc/localtime
|
|
name: etc-localtime
|
|
env:
|
|
- name: KOLLA_CONFIG_STRATEGY
|
|
value: {{ config_strategy }}
|
|
volumes:
|
|
- name: kolla-kubernetes-events
|
|
emptyDir: {}
|
|
- name: pod-main-config
|
|
emptyDir: {}
|
|
- name: glance-api-configmap
|
|
configMap:
|
|
name: glance-api-configmap
|
|
- name: glance-haproxy-config
|
|
configMap:
|
|
name: glance-api-haproxy
|
|
{% if glance_backend_ceph != "yes" %}
|
|
- name: glance-persistent-storage
|
|
persistentVolumeClaim:
|
|
claimName: {{ resourceName }}
|
|
{% endif %}
|
|
- name: etc-localtime
|
|
hostPath:
|
|
path: /etc/localtime
|
|
- name: kolla-logs
|
|
emptyDir: {}
|