openstack-operator/openstack_operator/templates/horizon/daemonset.yml.j2

129 lines
3.5 KiB
Django/Jinja

---
# Copyright 2020 VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: horizon
namespace: openstack
labels:
{{ labels("horizon", name) | indent(4) }}
spec:
updateStrategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
selector:
matchLabels:
{{ labels("horizon", name) | indent(6) }}
template:
metadata:
labels:
{{ labels("horizon", name) | indent(8) }}
annotations:
checksum/config: "{{ config_hash }}"
spec:
automountServiceAccountToken: false
containers:
- name: horizon
image: vexxhost/horizon:latest
imagePullPolicy: Always
env:
{% for v in env %}
- name: "{{ v.name }}"
value: "{{ v.value }}"
{% endfor %}
- name: SECRET_KEY
valueFrom:
secretKeyRef:
key: secret_key
name: horizon
ports:
- name: horizon
protocol: TCP
containerPort: 8000
livenessProbe:
tcpSocket:
port: horizon
readinessProbe:
tcpSocket:
port: horizon
lifecycle:
preStop:
exec:
command: ["/bin/sleep", "5"]
securityContext:
runAsUser: 1001
volumeMounts:
- name: config
mountPath: /etc/horizon
- name: uwsgi-config
mountPath: /etc/uwsgi
{% if 'logo' in spec %}
- name: logo
mountPath: /usr/local/lib/python3.7/site-packages/static/dashboard/img/logo.svg
subPath: logo.svg
- name: logo-fav
mountPath: /usr/local/lib/python3.7/site-packages/static/dashboard/img/favicon.ico
subPath: favicon.ico
- name: logo-splash
mountPath: /usr/local/lib/python3.7/site-packages/static/dashboard/img/logo-splash.svg
subPath: logo-splash.svg
{% endif %}
volumes:
- name: config
configMap:
defaultMode: 420
name: horizon
- name: uwsgi-config
configMap:
defaultMode: 420
name: uwsgi-default
{% if 'logo' in spec %}
- name: logo
configMap:
defaultMode: 420
name: {{ spec.logo }}
items:
- key: logo.svg
path: logo.svg
- name: logo-fav
configMap:
defaultMode: 420
name: {{ spec.logo }}
items:
- key: favicon.ico
path: favicon.ico
- name: logo-splash
configMap:
defaultMode: 420
name: {{ spec.logo }}
items:
- key: logo-splash.svg
path: logo-splash.svg
{% endif %}
{% if 'nodeSelector' in spec %}
nodeSelector:
{{ spec.nodeSelector | to_yaml | indent(8) }}
{% endif %}
{% if 'tolerations' in spec %}
tolerations:
{{ spec.tolerations | to_yaml | indent(8) }}
{% endif %}
{% if 'hostAliases' in spec %}
hostAliases:
{{ spec.hostAliases | to_yaml | indent(8) }}
{% endif %}