mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-26 21:33:14 +00:00
281 lines
8.2 KiB
Django/Jinja
281 lines
8.2 KiB
Django/Jinja
# AWX Secret Configurations
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: '{{ meta.name }}-secrets'
|
|
namespace: '{{ meta.namespace }}'
|
|
data:
|
|
credentials_py: "{{ lookup('template', 'credentials.py.j2') | b64encode }}"
|
|
environment_sh: "{{ lookup('template', 'environment.sh.j2') | b64encode }}"
|
|
|
|
# AWX Deployment.
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: '{{ meta.name }}'
|
|
namespace: '{{ meta.namespace }}'
|
|
labels:
|
|
app: '{{ deployment_type }}'
|
|
spec:
|
|
replicas: {{ tower_replicas }}
|
|
selector:
|
|
matchLabels:
|
|
app: '{{ deployment_type }}'
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: '{{ deployment_type }}'
|
|
spec:
|
|
containers:
|
|
- image: '{{ tower_redis_image }}'
|
|
name: redis
|
|
args: ["redis-server", "/etc/redis.conf"]
|
|
volumeMounts:
|
|
- name: {{ meta.name }}-redis-config
|
|
mountPath: "/etc/redis.conf"
|
|
subPath: redis.conf
|
|
readOnly: true
|
|
- name: {{ meta.name }}-redis-socket
|
|
mountPath: "/var/run/redis"
|
|
- image: '{{ tower_image }}'
|
|
name: '{{ meta.name }}-web'
|
|
{% if tower_web_command %}
|
|
command: {{ tower_web_command }}
|
|
{% endif %}
|
|
{% if tower_web_args %}
|
|
args: {{ tower_web_args }}
|
|
{% endif %}
|
|
imagePullPolicy: '{{ tower_image_pull_policy }}'
|
|
ports:
|
|
- containerPort: 8052
|
|
volumeMounts:
|
|
- name: "{{ meta.name }}-application-credentials"
|
|
mountPath: "/etc/tower/conf.d/"
|
|
readOnly: true
|
|
- name: {{ meta.name }}-secret-key
|
|
mountPath: /etc/tower/SECRET_KEY
|
|
subPath: SECRET_KEY
|
|
readOnly: true
|
|
- name: {{ meta.name }}-settings
|
|
mountPath: /etc/tower/settings.py
|
|
subPath: settings.py
|
|
readOnly: true
|
|
- name: {{ meta.name }}-nginx-conf
|
|
mountPath: /etc/nginx/nginx.conf
|
|
subPath: nginx.conf
|
|
readOnly: true
|
|
- name: {{ meta.name }}-redis-socket
|
|
mountPath: "/var/run/redis"
|
|
- name: supervisor-socket
|
|
mountPath: "/var/run/supervisor"
|
|
- name: rsyslog-socket
|
|
mountPath: "/var/run/awx-rsyslog"
|
|
- name: rsyslog-dir
|
|
mountPath: "/var/lib/awx/rsyslog"
|
|
{% if development_mode | bool %}
|
|
- name: awx-devel
|
|
mountPath: "/awx_devel"
|
|
{% endif %}
|
|
{% if tower_web_extra_volume_mounts -%}
|
|
{{ tower_web_extra_volume_mounts | indent(width=12, indentfirst=True) }}
|
|
{% endif %}
|
|
{% if (development_mode | bool) or (tower_task_extra_env | bool) %}
|
|
env:
|
|
{% endif %}
|
|
{% if development_mode | bool %}
|
|
- name: AWX_KUBE_DEVEL
|
|
value: "1"
|
|
{% endif %}
|
|
{% if tower_task_extra_env %}
|
|
{{ tower_web_extra_env | indent(width=12, indentfirst=True) }}
|
|
{% endif %}
|
|
resources:
|
|
requests:
|
|
memory: '{{ tower_web_mem_request }}'
|
|
cpu: '{{ tower_web_cpu_request }}'
|
|
- image: '{{ tower_image }}'
|
|
name: '{{ meta.name }}-task'
|
|
imagePullPolicy: '{{ tower_image_pull_policy }}'
|
|
{% if tower_task_privileged == true %}
|
|
securityContext:
|
|
privileged: true
|
|
{% endif %}
|
|
{% if tower_task_command %}
|
|
command: {{ tower_task_command }}
|
|
{% endif %}
|
|
{% if tower_task_args %}
|
|
args: {{ tower_task_args }}
|
|
{% endif %}
|
|
volumeMounts:
|
|
- name: "{{ meta.name }}-application-credentials"
|
|
mountPath: "/etc/tower/conf.d/"
|
|
readOnly: true
|
|
- name: {{ meta.name }}-secret-key
|
|
mountPath: /etc/tower/SECRET_KEY
|
|
subPath: SECRET_KEY
|
|
readOnly: true
|
|
- name: {{ meta.name }}-settings
|
|
mountPath: /etc/tower/settings.py
|
|
subPath: settings.py
|
|
readOnly: true
|
|
- name: {{ meta.name }}-redis-socket
|
|
mountPath: "/var/run/redis"
|
|
- name: supervisor-socket
|
|
mountPath: "/var/run/supervisor"
|
|
- name: rsyslog-socket
|
|
mountPath: "/var/run/awx-rsyslog"
|
|
- name: rsyslog-dir
|
|
mountPath: "/var/lib/awx/rsyslog"
|
|
{% if development_mode | bool %}
|
|
- name: awx-devel
|
|
mountPath: "/awx_devel"
|
|
{% endif %}
|
|
{% if tower_task_extra_volume_mounts -%}
|
|
{{ tower_task_extra_volume_mounts | indent(width=12, indentfirst=True) }}
|
|
{% endif %}
|
|
env:
|
|
- name: SUPERVISOR_WEB_CONFIG_PATH
|
|
value: "/supervisor.conf"
|
|
- name: AWX_SKIP_MIGRATIONS
|
|
value: "1"
|
|
- name: MY_POD_UID
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.uid
|
|
- name: MY_POD_IP
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: status.podIP
|
|
{% if development_mode | bool %}
|
|
- name: AWX_KUBE_DEVEL
|
|
value: "1"
|
|
{% endif %}
|
|
{% if tower_task_extra_env -%}
|
|
{{ tower_task_extra_env | indent(width=12, indentfirst=True) }}
|
|
{% endif %}
|
|
resources:
|
|
requests:
|
|
memory: '{{ tower_task_mem_request }}'
|
|
cpu: '{{ tower_task_cpu_request }}'
|
|
volumes:
|
|
- name: "{{ meta.name }}-application-credentials"
|
|
secret:
|
|
secretName: "{{ meta.name }}-secrets"
|
|
items:
|
|
- key: credentials_py
|
|
path: 'credentials.py'
|
|
- key: environment_sh
|
|
path: 'environment.sh'
|
|
- name: {{ meta.name }}-secret-key
|
|
secret:
|
|
secretName: '{{ meta.name }}-secret-key'
|
|
items:
|
|
- key: secret_key
|
|
path: SECRET_KEY
|
|
- name: {{ meta.name }}-settings
|
|
configMap:
|
|
name: '{{ meta.name }}-{{ deployment_type }}-configmap'
|
|
items:
|
|
- key: settings
|
|
path: settings.py
|
|
- name: {{ meta.name }}-nginx-conf
|
|
configMap:
|
|
name: '{{ meta.name }}-{{ deployment_type }}-configmap'
|
|
items:
|
|
- key: nginx_conf
|
|
path: nginx.conf
|
|
- name: {{ meta.name }}-redis-config
|
|
configMap:
|
|
name: {{ meta.name }}-{{ deployment_type }}-configmap
|
|
items:
|
|
- key: redis_conf
|
|
path: redis.conf
|
|
- name: {{ meta.name }}-redis-socket
|
|
emptyDir: {}
|
|
- name: supervisor-socket
|
|
emptyDir: {}
|
|
- name: rsyslog-socket
|
|
emptyDir: {}
|
|
- name: rsyslog-dir
|
|
emptyDir: {}
|
|
{% if development_mode | bool %}
|
|
- name: awx-devel
|
|
hostPath:
|
|
path: /awx_devel
|
|
{% endif %}
|
|
{% if tower_extra_volumes -%}
|
|
{{ tower_extra_volumes | indent(width=8, indentfirst=True) }}
|
|
{% endif %}
|
|
|
|
# AWX Service.
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: '{{ meta.name }}-service'
|
|
namespace: '{{ meta.namespace }}'
|
|
labels:
|
|
app: '{{ deployment_type }}'
|
|
spec:
|
|
ports:
|
|
- port: 80
|
|
protocol: TCP
|
|
targetPort: 8052
|
|
name: http
|
|
selector:
|
|
app: '{{ deployment_type }}'
|
|
{% if tower_ingress_type != "none" %}
|
|
type: NodePort
|
|
{% endif %}
|
|
|
|
# AWX Ingress.
|
|
{% if 'ingress' == tower_ingress_type|lower %}
|
|
---
|
|
apiVersion: extensions/v1beta1
|
|
kind: Ingress
|
|
metadata:
|
|
name: '{{ meta.name }}-ingress'
|
|
namespace: '{{ meta.namespace }}'
|
|
{% if tower_ingress_annotations %}
|
|
annotations:
|
|
{{ tower_ingress_annotations | indent(width=4) }}
|
|
{% endif %}
|
|
spec:
|
|
rules:
|
|
- host: '{{ tower_hostname }}'
|
|
http:
|
|
paths:
|
|
- path: /
|
|
backend:
|
|
serviceName: '{{ meta.name }}-service'
|
|
servicePort: 80
|
|
{% if tower_ingress_tls_secret %}
|
|
tls:
|
|
- hosts:
|
|
- {{ tower_hostname }}
|
|
secretName: {{ tower_ingress_tls_secret }}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if 'route' == tower_ingress_type|lower %}
|
|
---
|
|
apiVersion: route.openshift.io/v1
|
|
kind: Route
|
|
metadata:
|
|
name: '{{ meta.name }}'
|
|
namespace: '{{ meta.namespace }}'
|
|
spec:
|
|
port:
|
|
targetPort: http
|
|
tls:
|
|
insecureEdgeTerminationPolicy: Redirect
|
|
termination: edge
|
|
to:
|
|
kind: Service
|
|
name: {{ meta.name }}-service
|
|
weight: 100
|
|
wildcardPolicy: None
|
|
{% endif %}
|