Initial commit
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ kubernetes_deployment_name }}-config
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
data:
|
||||
{{ kubernetes_deployment_name }}_nginx_conf: |
|
||||
#user awx;
|
||||
|
||||
worker_processes 1;
|
||||
|
||||
pid /tmp/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
server_tokens off;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /dev/stdout main;
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
#gzip on;
|
||||
|
||||
upstream uwsgi {
|
||||
server 127.0.0.1:8050;
|
||||
}
|
||||
|
||||
upstream daphne {
|
||||
server 127.0.0.1:8051;
|
||||
}
|
||||
|
||||
{% if ssl_certificate is defined %}
|
||||
server {
|
||||
listen 8052 default_server;
|
||||
server_name _;
|
||||
|
||||
# Redirect all HTTP links to the matching HTTPS page
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
{%endif %}
|
||||
|
||||
server {
|
||||
{% if ssl_certificate is defined %}
|
||||
listen 8053 ssl;
|
||||
|
||||
ssl_certificate /etc/nginx/awxweb.pem;
|
||||
ssl_certificate_key /etc/nginx/awxweb.pem;
|
||||
{% else %}
|
||||
listen 8052 default_server;
|
||||
{% endif %}
|
||||
|
||||
# If you have a domain name, this is where to add it
|
||||
server_name _;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
|
||||
add_header Strict-Transport-Security max-age=15768000;
|
||||
|
||||
# Protect against click-jacking https://www.owasp.org/index.php/Testing_for_Clickjacking_(OTG-CLIENT-009)
|
||||
add_header X-Frame-Options "DENY";
|
||||
|
||||
location /nginx_status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /var/lib/awx/public/static/;
|
||||
}
|
||||
|
||||
location /favicon.ico { alias /var/lib/awx/public/static/favicon.ico; }
|
||||
|
||||
location /websocket {
|
||||
# Pass request to the upstream alias
|
||||
proxy_pass http://daphne;
|
||||
# Require http version 1.1 to allow for upgrade requests
|
||||
proxy_http_version 1.1;
|
||||
# We want proxy_buffering off for proxying to websockets.
|
||||
proxy_buffering off;
|
||||
# http://en.wikipedia.org/wiki/X-Forwarded-For
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# enable this if you use HTTPS:
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
# pass the Host: header from the client for the sake of redirects
|
||||
proxy_set_header Host $http_host;
|
||||
# We've set the Host header, so we don't need Nginx to muddle
|
||||
# about with redirects
|
||||
proxy_redirect off;
|
||||
# Depending on the request value, set the Upgrade and
|
||||
# connection headers
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
|
||||
location / {
|
||||
# Add trailing / if missing
|
||||
rewrite ^(.*)$http_host(.*[^/])$ $1$http_host$2/ permanent;
|
||||
uwsgi_read_timeout 120s;
|
||||
uwsgi_pass uwsgi;
|
||||
include /etc/nginx/uwsgi_params;
|
||||
{%- if extra_nginx_include is defined %}
|
||||
include {{ extra_nginx_include }};
|
||||
{%- endif %}
|
||||
proxy_set_header X-Forwarded-Port 443;
|
||||
uwsgi_param HTTP_X_FORWARDED_PORT 443;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{{ kubernetes_deployment_name }}_settings: |
|
||||
import os
|
||||
import socket
|
||||
ADMINS = ()
|
||||
|
||||
AWX_PROOT_ENABLED = True
|
||||
|
||||
# Automatically deprovision pods that go offline
|
||||
AWX_AUTO_DEPROVISION_INSTANCES = True
|
||||
|
||||
SYSTEM_TASK_ABS_CPU = {{ ((task_cpu_request|int / 1000) * 4)|int }}
|
||||
SYSTEM_TASK_ABS_MEM = {{ ((task_mem_request|int * 1024) / 100)|int }}
|
||||
|
||||
INSIGHTS_URL_BASE = "{{ insights_url_base }}"
|
||||
INSIGHTS_AGENT_MIME = "{{ insights_agent_mime }}"
|
||||
AUTOMATION_ANALYTICS_URL = "{{ automation_analytics_url }}"
|
||||
|
||||
#Autoprovisioning should replace this
|
||||
CLUSTER_HOST_ID = socket.gethostname()
|
||||
SYSTEM_UUID = os.environ.get('MY_POD_UID', '00000000-0000-0000-0000-000000000000')
|
||||
|
||||
SESSION_COOKIE_SECURE = False
|
||||
CSRF_COOKIE_SECURE = False
|
||||
|
||||
REMOTE_HOST_HEADERS = ['HTTP_X_FORWARDED_FOR']
|
||||
|
||||
STATIC_ROOT = '/var/lib/awx/public/static'
|
||||
PROJECTS_ROOT = '/var/lib/awx/projects'
|
||||
AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/awx_ansible_collections'
|
||||
JOBOUTPUT_ROOT = '/var/lib/awx/job_status'
|
||||
SECRET_KEY = open('/etc/tower/SECRET_KEY', 'rb').read().strip()
|
||||
ALLOWED_HOSTS = ['*']
|
||||
SERVER_EMAIL = 'root@localhost'
|
||||
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
|
||||
EMAIL_SUBJECT_PREFIX = '[AWX] '
|
||||
EMAIL_HOST = 'localhost'
|
||||
EMAIL_PORT = 25
|
||||
EMAIL_HOST_USER = ''
|
||||
EMAIL_HOST_PASSWORD = ''
|
||||
EMAIL_USE_TLS = False
|
||||
|
||||
LOGGING['handlers']['console'] = {
|
||||
'()': 'logging.StreamHandler',
|
||||
'level': 'DEBUG',
|
||||
'formatter': 'simple',
|
||||
'filters': ['guid'],
|
||||
}
|
||||
|
||||
LOGGING['loggers']['django.request']['handlers'] = ['console']
|
||||
LOGGING['loggers']['rest_framework.request']['handlers'] = ['console']
|
||||
LOGGING['loggers']['awx']['handlers'] = ['console', 'external_logger']
|
||||
LOGGING['loggers']['awx.main.commands.run_callback_receiver']['handlers'] = ['console']
|
||||
LOGGING['loggers']['awx.main.commands.inventory_import']['handlers'] = ['console']
|
||||
LOGGING['loggers']['awx.main.tasks']['handlers'] = ['console', 'external_logger']
|
||||
LOGGING['loggers']['awx.main.scheduler']['handlers'] = ['console', 'external_logger']
|
||||
LOGGING['loggers']['django_auth_ldap']['handlers'] = ['console']
|
||||
LOGGING['loggers']['social']['handlers'] = ['console']
|
||||
LOGGING['loggers']['system_tracking_migrations']['handlers'] = ['console']
|
||||
LOGGING['loggers']['rbac_migrations']['handlers'] = ['console']
|
||||
LOGGING['loggers']['awx.isolated.manager.playbooks']['handlers'] = ['console']
|
||||
LOGGING['handlers']['callback_receiver'] = {'class': 'logging.NullHandler'}
|
||||
LOGGING['handlers']['fact_receiver'] = {'class': 'logging.NullHandler'}
|
||||
LOGGING['handlers']['task_system'] = {'class': 'logging.NullHandler'}
|
||||
LOGGING['handlers']['tower_warnings'] = {'class': 'logging.NullHandler'}
|
||||
LOGGING['handlers']['rbac_migrations'] = {'class': 'logging.NullHandler'}
|
||||
LOGGING['handlers']['system_tracking_migrations'] = {'class': 'logging.NullHandler'}
|
||||
LOGGING['handlers']['management_playbooks'] = {'class': 'logging.NullHandler'}
|
||||
|
||||
USE_X_FORWARDED_PORT = True
|
||||
|
||||
AWX_CONTAINER_GROUP_DEFAULT_IMAGE = "{{ container_groups_image }}"
|
||||
REDHAT_CANDLEPIN_HOST = "{{ candlepin_host | default(omit) }}"
|
||||
REDHAT_CANDLEPIN_VERIFY = "{{ candlepin_verify | default(omit) }}"
|
||||
BROADCAST_WEBSOCKET_PORT = 8052
|
||||
BROADCAST_WEBSOCKET_PROTOCOL = 'http'
|
||||
|
||||
{{ kubernetes_deployment_name }}_redis_conf: |
|
||||
unixsocket /var/run/redis/redis.sock
|
||||
unixsocketperm 660
|
||||
port 0
|
||||
bind 127.0.0.1
|
||||
@@ -0,0 +1,16 @@
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ATOMIC_REQUESTS': True,
|
||||
'ENGINE': 'awx.main.db.profiled_pg',
|
||||
'NAME': "{{ pg_database }}",
|
||||
'USER': "{{ pg_username }}",
|
||||
'PASSWORD': "{{ pg_password }}",
|
||||
'HOST': "{{ pg_hostname|default('postgresql') }}",
|
||||
'PORT': "{{ pg_port }}",
|
||||
'OPTIONS': { 'sslmode': '{{ pg_sslmode|default("prefer") }}',
|
||||
'sslrootcert': '{{ ca_trust_bundle }}',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
BROADCAST_WEBSOCKET_SECRET = "{{ broadcast_websocket_secret | b64encode }}"
|
||||
@@ -0,0 +1,556 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ kubernetes_serviceaccount_name }}
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
{% if kubernetes_service_account_annotations is defined %}
|
||||
annotations:
|
||||
{% for key, value in kubernetes_service_account_annotations.items() %}
|
||||
{{ key }}: "{{ value }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if kubernetes_image_pull_secrets is defined %}
|
||||
imagePullSecrets:
|
||||
- name: "{{ kubernetes_image_pull_secrets }}"
|
||||
{% endif %}
|
||||
|
||||
{% if awx_psp_create is defined and awx_psp_create | bool %}
|
||||
---
|
||||
apiVersion: policy/v1beta1
|
||||
kind: PodSecurityPolicy
|
||||
metadata:
|
||||
name: {{ awx_psp_name }}-psp
|
||||
spec:
|
||||
{% if awx_psp_privileged is defined %}
|
||||
privileged: {{ awx_psp_privileged }}
|
||||
allowPrivilegeEscalation: {{ awx_psp_privileged }}
|
||||
{% endif %}
|
||||
requiredDropCapabilities:
|
||||
- ALL
|
||||
volumes:
|
||||
- 'configMap'
|
||||
- 'emptyDir'
|
||||
- 'projected'
|
||||
- 'secret'
|
||||
- 'downwardAPI'
|
||||
- 'persistentVolumeClaim'
|
||||
hostNetwork: false
|
||||
hostIPC: false
|
||||
hostPID: false
|
||||
runAsUser:
|
||||
rule: 'MustRunAsNonRoot'
|
||||
seLinux:
|
||||
rule: 'RunAsAny'
|
||||
supplementalGroups:
|
||||
rule: 'RunAsAny'
|
||||
fsGroup:
|
||||
rule: 'RunAsAny'
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
name: {{ awx_psp_name }}-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- policy
|
||||
resources:
|
||||
- podsecuritypolicies
|
||||
resourceNames:
|
||||
- {{ awx_psp_name }}-psp
|
||||
verbs:
|
||||
- use
|
||||
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ awx_psp_name }}-role-binding
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ awx_psp_name }}-role
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ kubernetes_serviceaccount_name }}
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
{% endif %}
|
||||
|
||||
---
|
||||
apiVersion: {{ kubernetes_deployment_api_version }}
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ kubernetes_deployment_name }}
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
{% if kubernetes_deployment_annotations is defined %}
|
||||
annotations:
|
||||
{% for key, value in kubernetes_deployment_annotations.items() %}
|
||||
{{ key }}: "{{ value }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if openshift_host is defined %}
|
||||
labels:
|
||||
app: {{ kubernetes_deployment_name }}
|
||||
{% endif %}
|
||||
spec:
|
||||
replicas: 1
|
||||
{% if kubernetes_deployment_api_version == "apps/v1" %}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ kubernetes_deployment_name }}
|
||||
{% endif %}
|
||||
template:
|
||||
metadata:
|
||||
{% if kubernetes_pod_annotations is defined %}
|
||||
annotations:
|
||||
{% for key, value in kubernetes_pod_annotations.items() %}
|
||||
{{ key }}: "{{ value }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
labels:
|
||||
name: {{ kubernetes_deployment_name }}-web-deploy
|
||||
service: django
|
||||
app: {{ kubernetes_deployment_name }}
|
||||
spec:
|
||||
serviceAccountName: {{ kubernetes_serviceaccount_name }}
|
||||
terminationGracePeriodSeconds: 10
|
||||
{% if custom_venvs is defined %}
|
||||
{% set trusted_hosts = "" %}
|
||||
initContainers:
|
||||
- image: 'centos:7'
|
||||
name: init-custom-venvs
|
||||
{% if http_proxy is defined or https_proxy is defined %}
|
||||
{% set trusted_hosts = "--trusted-host pypi.org --trusted-host files.pythonhosted.org --trusted-host pypi.python.org" %}
|
||||
env:
|
||||
{% if http_proxy is defined %}
|
||||
- name: http_proxy
|
||||
value: {{ http_proxy }}
|
||||
{% endif %}
|
||||
{% if https_proxy is defined %}
|
||||
- name: https_proxy
|
||||
value: {{ https_proxy }}
|
||||
{% endif %}
|
||||
{% if no_proxy is defined %}
|
||||
- name: no_proxy
|
||||
value: {{ no_proxy }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
command:
|
||||
- sh
|
||||
- '-c'
|
||||
- >-
|
||||
yum install -y ansible curl python-setuptools epel-release \
|
||||
openssl openssl-devel gcc python-devel &&
|
||||
yum install -y python-virtualenv python36 python36-devel &&
|
||||
mkdir -p {{ custom_venvs_path }} &&
|
||||
{% for custom_venv in custom_venvs %}
|
||||
virtualenv -p {{ custom_venv.python | default(custom_venvs_python) }} \
|
||||
{{ custom_venvs_path }}/{{ custom_venv.name }} &&
|
||||
source {{ custom_venvs_path }}/{{ custom_venv.name }}/bin/activate &&
|
||||
{{ custom_venvs_path }}/{{ custom_venv.name }}/bin/pip install {{ trusted_hosts }} -U pip &&
|
||||
{{ custom_venvs_path }}/{{ custom_venv.name }}/bin/pip install {{ trusted_hosts }} -U psutil \
|
||||
"ansible=={{ custom_venv.python_ansible_version }}" &&
|
||||
{% if custom_venv.python_modules is defined %}
|
||||
{{ custom_venvs_path }}/{{ custom_venv.name }}/bin/pip install {{ trusted_hosts }} -U \
|
||||
{% for module in custom_venv.python_modules %}{{ module }} {% endfor %} &&
|
||||
{% endif %}
|
||||
deactivate &&
|
||||
{% endfor %}
|
||||
:
|
||||
volumeMounts:
|
||||
- name: custom-venvs
|
||||
mountPath: {{ custom_venvs_path }}
|
||||
{% endif %}
|
||||
containers:
|
||||
- name: {{ kubernetes_deployment_name }}-web
|
||||
{% if web_security_context_enabled is defined and web_security_context_enabled | bool %}
|
||||
securityContext:
|
||||
{% if web_security_context_privileged is defined %}
|
||||
privileged: {{ web_security_context_privileged }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
image: "{{ kubernetes_awx_image }}:{{ kubernetes_awx_version }}"
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8052
|
||||
{% if ca_trust_dir is defined %}
|
||||
env:
|
||||
- name: REQUESTS_CA_BUNDLE
|
||||
value: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
|
||||
{% endif %}
|
||||
volumeMounts:
|
||||
{% if postgres_root_ca_cert is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-postgres-root-ca-cert
|
||||
mountPath: {{ ca_trust_bundle }}
|
||||
subPath: {{ postgres_root_ca_filename }}
|
||||
readOnly: true
|
||||
{% endif %}
|
||||
- name: supervisor-socket
|
||||
mountPath: "/var/run/supervisor"
|
||||
- name: rsyslog-socket
|
||||
mountPath: "/var/run/awx-rsyslog"
|
||||
- name: rsyslog-dir
|
||||
mountPath: "/var/lib/awx/rsyslog"
|
||||
{% if ca_trust_dir is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-ca-trust-dir
|
||||
mountPath: "{{ ca_trust_dir }}"
|
||||
readOnly: true
|
||||
{% endif %}
|
||||
{% if project_data_dir is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-project-data-dir
|
||||
mountPath: "/var/lib/awx/projects"
|
||||
readOnly: false
|
||||
{% endif %}
|
||||
{% if custom_venvs is defined %}
|
||||
- name: custom-venvs
|
||||
mountPath: {{ custom_venvs_path }}
|
||||
{% endif %}
|
||||
- name: {{ kubernetes_deployment_name }}-application-config
|
||||
mountPath: "/etc/tower/settings.py"
|
||||
subPath: settings.py
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-nginx-config
|
||||
mountPath: /etc/nginx/nginx.conf
|
||||
subPath: nginx.conf
|
||||
readOnly: true
|
||||
|
||||
- name: "{{ kubernetes_deployment_name }}-application-credentials"
|
||||
mountPath: "/etc/tower/conf.d/"
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-supervisor-web-config
|
||||
mountPath: "/etc/supervisord.conf"
|
||||
subPath: supervisor.conf
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-supervisor-task-config
|
||||
mountPath: "/etc/supervisord_task.conf"
|
||||
subPath: supervisor_task.conf
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-secret-key
|
||||
mountPath: "/etc/tower/SECRET_KEY"
|
||||
subPath: SECRET_KEY
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-redis-socket
|
||||
mountPath: "/var/run/redis"
|
||||
|
||||
resources:
|
||||
requests:
|
||||
memory: "{{ web_mem_request }}Gi"
|
||||
cpu: "{{ web_cpu_request }}m"
|
||||
{% if web_mem_limit is defined or web_cpu_limit is defined %}
|
||||
limits:
|
||||
{% endif %}
|
||||
{% if web_mem_limit is defined %}
|
||||
memory: "{{ web_mem_limit }}Gi"
|
||||
{% endif %}
|
||||
{% if web_cpu_limit is defined %}
|
||||
cpu: "{{ web_cpu_limit }}m"
|
||||
{% endif %}
|
||||
- name: {{ kubernetes_deployment_name }}-task
|
||||
{% if task_security_context_enabled is defined and task_security_context_enabled | bool %}
|
||||
securityContext:
|
||||
{% if task_security_context_privileged is defined %}
|
||||
privileged: {{ task_security_context_privileged }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
image: "{{ kubernetes_awx_image }}:{{ kubernetes_awx_version }}"
|
||||
command:
|
||||
- /usr/bin/launch_awx_task.sh
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
{% if postgres_root_ca_cert is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-postgres-root-ca-cert
|
||||
mountPath: {{ ca_trust_bundle }}
|
||||
subPath: {{ postgres_root_ca_filename }}
|
||||
readOnly: true
|
||||
{% endif %}
|
||||
- name: supervisor-socket
|
||||
mountPath: "/var/run/supervisor"
|
||||
- name: rsyslog-socket
|
||||
mountPath: "/var/run/awx-rsyslog"
|
||||
- name: rsyslog-dir
|
||||
mountPath: "/var/lib/awx/rsyslog"
|
||||
{% if ca_trust_dir is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-ca-trust-dir
|
||||
mountPath: "{{ ca_trust_dir }}"
|
||||
readOnly: true
|
||||
{% endif %}
|
||||
{% if custom_venvs is defined %}
|
||||
- name: custom-venvs
|
||||
mountPath: {{ custom_venvs_path }}
|
||||
{% endif %}
|
||||
- name: {{ kubernetes_deployment_name }}-application-config
|
||||
mountPath: "/etc/tower/settings.py"
|
||||
subPath: settings.py
|
||||
readOnly: true
|
||||
|
||||
- name: "{{ kubernetes_deployment_name }}-application-credentials"
|
||||
mountPath: "/etc/tower/conf.d/"
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-supervisor-web-config
|
||||
mountPath: "/etc/supervisord.conf"
|
||||
subPath: supervisor.conf
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-supervisor-task-config
|
||||
mountPath: "/etc/supervisord_task.conf"
|
||||
subPath: supervisor_task.conf
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-secret-key
|
||||
mountPath: "/etc/tower/SECRET_KEY"
|
||||
subPath: SECRET_KEY
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-redis-socket
|
||||
mountPath: "/var/run/redis"
|
||||
env:
|
||||
- name: SUPERVISOR_WEB_CONFIG_PATH
|
||||
value: "/etc/supervisord.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 ca_trust_dir is defined %}
|
||||
- name: REQUESTS_CA_BUNDLE
|
||||
value: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
|
||||
{% endif %}
|
||||
resources:
|
||||
requests:
|
||||
memory: "{{ task_mem_request }}Gi"
|
||||
cpu: "{{ task_cpu_request }}m"
|
||||
{% if task_mem_limit is defined or task_cpu_limit is defined %}
|
||||
limits:
|
||||
{% endif %}
|
||||
{% if task_mem_limit is defined %}
|
||||
memory: "{{ task_mem_limit }}Gi"
|
||||
{% endif %}
|
||||
{% if task_cpu_limit is defined %}
|
||||
cpu: "{{ task_cpu_limit }}m"
|
||||
{% endif %}
|
||||
- name: {{ kubernetes_deployment_name }}-redis
|
||||
{% if redis_security_context_enabled is defined and redis_security_context_enabled | bool %}
|
||||
securityContext:
|
||||
{% if redis_security_context_privileged is defined %}
|
||||
privileged: {{ redis_security_context_privileged }}
|
||||
{% endif %}
|
||||
{% if redis_security_context_user is defined %}
|
||||
runAsUser: {{ redis_security_context_user }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
image: {{ kubernetes_redis_image }}:{{ kubernetes_redis_image_tag }}
|
||||
imagePullPolicy: Always
|
||||
args: ["redis-server", "{{ kubernetes_redis_config_mount_path }}"]
|
||||
volumeMounts:
|
||||
- name: {{ kubernetes_deployment_name }}-redis-config
|
||||
mountPath: "{{ kubernetes_redis_config_mount_path }}"
|
||||
subPath: redis.conf
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-redis-socket
|
||||
mountPath: "/var/run/redis"
|
||||
resources:
|
||||
requests:
|
||||
memory: "{{ redis_mem_request }}Gi"
|
||||
cpu: "{{ redis_cpu_request }}m"
|
||||
{% if redis_mem_limit is defined or redis_cpu_limit is defined %}
|
||||
limits:
|
||||
{% endif %}
|
||||
{% if redis_mem_limit is defined %}
|
||||
memory: "{{ redis_mem_limit }}Gi"
|
||||
{% endif %}
|
||||
{% if redis_cpu_limit is defined %}
|
||||
cpu: "{{ redis_cpu_limit }}m"
|
||||
{% endif %}
|
||||
{% if tolerations is defined %}
|
||||
tolerations:
|
||||
{{ tolerations | to_nice_yaml(indent=2) | indent(width=8, indentfirst=True) }}
|
||||
{% endif %}
|
||||
{% if node_selector is defined %}
|
||||
nodeSelector:
|
||||
{{ node_selector | to_nice_yaml(indent=2) | indent(width=8, indentfirst=True) }}
|
||||
{% endif %}
|
||||
{% if affinity is defined %}
|
||||
affinity:
|
||||
{{ affinity | to_nice_yaml(indent=2) | indent(width=8, indentfirst=True) }}
|
||||
{% endif %}
|
||||
volumes:
|
||||
{% if postgres_root_ca_cert is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-postgres-root-ca-cert
|
||||
configMap:
|
||||
name: {{ kubernetes_deployment_name }}-postgres-root-ca-cert
|
||||
items:
|
||||
- key: postgres_root_ca.crt
|
||||
path: postgres_root_ca.crt
|
||||
{% endif %}
|
||||
- name: supervisor-socket
|
||||
emptyDir: {}
|
||||
- name: rsyslog-socket
|
||||
emptyDir: {}
|
||||
- name: rsyslog-dir
|
||||
emptyDir: {}
|
||||
{% if ca_trust_dir is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-ca-trust-dir
|
||||
hostPath:
|
||||
path: "{{ ca_trust_dir }}"
|
||||
type: Directory
|
||||
{% endif %}
|
||||
{% if project_data_dir is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-project-data-dir
|
||||
hostPath:
|
||||
path: "{{ project_data_dir }}"
|
||||
type: Directory
|
||||
{% endif %}
|
||||
{% if custom_venvs is defined %}
|
||||
- name: custom-venvs
|
||||
emptyDir: {}
|
||||
{% endif %}
|
||||
- name: {{ kubernetes_deployment_name }}-application-config
|
||||
configMap:
|
||||
name: {{ kubernetes_deployment_name }}-config
|
||||
items:
|
||||
- key: {{ kubernetes_deployment_name }}_settings
|
||||
path: settings.py
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-nginx-config
|
||||
configMap:
|
||||
name: {{ kubernetes_deployment_name }}-config
|
||||
items:
|
||||
- key: {{ kubernetes_deployment_name }}_nginx_conf
|
||||
path: nginx.conf
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-redis-config
|
||||
configMap:
|
||||
name: {{ kubernetes_deployment_name }}-config
|
||||
items:
|
||||
- key: {{ kubernetes_deployment_name }}_redis_conf
|
||||
path: redis.conf
|
||||
|
||||
- name: "{{ kubernetes_deployment_name }}-application-credentials"
|
||||
secret:
|
||||
secretName: "{{ kubernetes_deployment_name }}-secrets"
|
||||
items:
|
||||
- key: credentials_py
|
||||
path: 'credentials.py'
|
||||
- key: environment_sh
|
||||
path: 'environment.sh'
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-supervisor-web-config
|
||||
configMap:
|
||||
name: {{ kubernetes_deployment_name }}-supervisor-config
|
||||
items:
|
||||
- key: supervisor-web-config
|
||||
path: 'supervisor.conf'
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-supervisor-task-config
|
||||
configMap:
|
||||
name: {{ kubernetes_deployment_name }}-supervisor-config
|
||||
items:
|
||||
- key: supervisor-task-config
|
||||
path: 'supervisor_task.conf'
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-secret-key
|
||||
secret:
|
||||
secretName: "{{ kubernetes_deployment_name }}-secrets"
|
||||
items:
|
||||
- key: secret_key
|
||||
path: SECRET_KEY
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-redis-socket
|
||||
emptyDir: {}
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ kubernetes_deployment_name }}-web-svc
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
labels:
|
||||
name: {{ kubernetes_deployment_name }}-web-svc
|
||||
{% if kubernetes_service_annotations is defined %}
|
||||
annotations:
|
||||
{% for key, value in kubernetes_service_annotations.items() %}
|
||||
{{ key }}: "{{ value }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
spec:
|
||||
type: {{ kubernetes_web_svc_type }}
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
{% if kubernetes_web_svc_type == "ClusterIP" %}
|
||||
nodePort: null
|
||||
{% endif %}
|
||||
targetPort: 8052
|
||||
selector:
|
||||
name: {{ kubernetes_deployment_name }}-web-deploy
|
||||
|
||||
{% if kubernetes_context is defined %}
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ kubernetes_deployment_name }}-web-svc
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
{% if kubernetes_ingress_annotations is defined %}
|
||||
annotations:
|
||||
{% for key, value in kubernetes_ingress_annotations.items() %}
|
||||
{{ key }}: "{{ value }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
spec:
|
||||
{% if kubernetes_ingress_hostname is defined %}
|
||||
rules:
|
||||
- host: {{ kubernetes_ingress_hostname }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: {{ kubernetes_deployment_name }}-web-svc
|
||||
servicePort: 80
|
||||
{% else %}
|
||||
backend:
|
||||
serviceName: {{ kubernetes_deployment_name }}-web-svc
|
||||
servicePort: 80
|
||||
{% endif %}
|
||||
{% if kubernetes_ingress_tls_secret is defined %}
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ kubernetes_ingress_hostname }}
|
||||
secretName: {{ kubernetes_ingress_tls_secret }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if openshift_host is defined %}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Route
|
||||
metadata:
|
||||
name: {{ kubernetes_deployment_name }}-web-svc
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
spec:
|
||||
port:
|
||||
targetPort: http
|
||||
tls:
|
||||
insecureEdgeTerminationPolicy: Redirect
|
||||
termination: edge
|
||||
to:
|
||||
kind: Service
|
||||
name: {{ kubernetes_deployment_name }}-web-svc
|
||||
weight: 100
|
||||
wildcardPolicy: None
|
||||
{% endif %}
|
||||
@@ -0,0 +1,5 @@
|
||||
DATABASE_USER={{ pg_username }}
|
||||
DATABASE_NAME={{ pg_database }}
|
||||
DATABASE_HOST={{ pg_hostname|default('postgresql') }}
|
||||
DATABASE_PORT={{ pg_port|default('5432') }}
|
||||
DATABASE_PASSWORD={{ pg_password | quote }}
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: ansible-tower-management
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
{% if kubernetes_pod_annotations is defined %}
|
||||
annotations:
|
||||
{% for key, value in kubernetes_pod_annotations.items() %}
|
||||
{{ key }}: {{ value | quote }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
spec:
|
||||
{% if kubernetes_image_pull_secrets is defined %}
|
||||
imagePullSecrets:
|
||||
- name: "{{ kubernetes_image_pull_secrets }}"
|
||||
{% endif %}
|
||||
containers:
|
||||
- name: ansible-tower-management
|
||||
image: "{{ kubernetes_awx_image }}:{{ kubernetes_awx_version }}"
|
||||
imagePullPolicy: Always
|
||||
command: ["sleep", "infinity"]
|
||||
volumeMounts:
|
||||
{% if ca_trust_dir is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-ca-trust-dir
|
||||
mountPath: "/etc/pki/ca-trust/source/anchors/"
|
||||
readOnly: true
|
||||
|
||||
{% endif %}
|
||||
- name: {{ kubernetes_deployment_name }}-application-config
|
||||
mountPath: "/etc/tower/settings.py"
|
||||
subPath: settings.py
|
||||
readOnly: true
|
||||
{% if postgres_root_ca_cert is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-postgres-root-ca-cert
|
||||
mountPath: {{ ca_trust_bundle }}
|
||||
subPath: {{ postgres_root_ca_filename }}
|
||||
readOnly: true
|
||||
{% endif %}
|
||||
- name: "{{ kubernetes_deployment_name }}-application-credentials"
|
||||
mountPath: "/etc/tower/conf.d/"
|
||||
readOnly: true
|
||||
|
||||
- name: {{ kubernetes_deployment_name }}-secret-key
|
||||
mountPath: "/etc/tower/SECRET_KEY"
|
||||
subPath: SECRET_KEY
|
||||
readOnly: true
|
||||
resources:
|
||||
{% if management_mem_limit is defined or management_cpu_limit is defined %}
|
||||
limits:
|
||||
{% endif %}
|
||||
{% if management_mem_limit is defined %}
|
||||
memory: "{{ management_mem_limit }}Gi"
|
||||
{% endif %}
|
||||
{% if management_cpu_limit is defined %}
|
||||
cpu: "{{ management_cpu_limit }}m"
|
||||
{% endif %}
|
||||
{% if tolerations is defined %}
|
||||
tolerations:
|
||||
{{ tolerations | to_nice_yaml(indent=2) | indent(width=4, indentfirst=True) }}
|
||||
{% endif %}
|
||||
{% if node_selector is defined %}
|
||||
nodeSelector:
|
||||
{{ node_selector | to_nice_yaml(indent=2) | indent(width=4, indentfirst=True) }}
|
||||
{% endif %}
|
||||
{% if affinity is defined %}
|
||||
affinity:
|
||||
{{ affinity | to_nice_yaml(indent=2) | indent(width=4, indentfirst=True) }}
|
||||
{% endif %}
|
||||
volumes:
|
||||
{% if ca_trust_dir is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-ca-trust-dir
|
||||
hostPath:
|
||||
path: "{{ ca_trust_dir }}"
|
||||
type: Directory
|
||||
|
||||
{% endif %}
|
||||
- name: {{ kubernetes_deployment_name }}-application-config
|
||||
configMap:
|
||||
name: {{ kubernetes_deployment_name }}-config
|
||||
items:
|
||||
- key: {{ kubernetes_deployment_name }}_settings
|
||||
path: settings.py
|
||||
{% if postgres_root_ca_cert is defined %}
|
||||
- name: {{ kubernetes_deployment_name }}-postgres-root-ca-cert
|
||||
configMap:
|
||||
name: {{ kubernetes_deployment_name }}-postgres-root-ca-cert
|
||||
items:
|
||||
- key: postgres_root_ca.crt
|
||||
path: postgres_root_ca.crt
|
||||
{% endif %}
|
||||
- name: {{ kubernetes_deployment_name }}-secret-key
|
||||
secret:
|
||||
secretName: "{{ kubernetes_deployment_name }}-secrets"
|
||||
items:
|
||||
- key: secret_key
|
||||
path: SECRET_KEY
|
||||
|
||||
- name: "{{ kubernetes_deployment_name }}-application-credentials"
|
||||
secret:
|
||||
secretName: "{{ kubernetes_deployment_name }}-secrets"
|
||||
items:
|
||||
- key: credentials_py
|
||||
path: 'credentials.py'
|
||||
|
||||
restartPolicy: Never
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ kubernetes_deployment_name }}-postgres-root-ca-cert
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
data:
|
||||
postgres_root_ca.crt: |
|
||||
{{ postgres_root_ca_cert | indent(width=4) }}
|
||||
@@ -0,0 +1,176 @@
|
||||
apiVersion: v1
|
||||
kind: Template
|
||||
labels:
|
||||
template: postgresql-persistent-template
|
||||
message: |-
|
||||
The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.
|
||||
|
||||
Username: ${POSTGRESQL_USER}
|
||||
Password: ${POSTGRESQL_PASSWORD}
|
||||
Database Name: ${POSTGRESQL_DATABASE}
|
||||
Connection URL: postgresql://${DATABASE_SERVICE_NAME}:5432/
|
||||
|
||||
For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.
|
||||
metadata:
|
||||
annotations:
|
||||
description: |-
|
||||
PostgreSQL database service, with persistent storage. For more information about using this template, including OpenShift considerations, see https://github.com/sclorg/postgresql-container/.
|
||||
|
||||
NOTE: Scaling to more than one replica is not supported. You must have persistent volumes available in your cluster to use this template.
|
||||
iconClass: icon-postgresql
|
||||
openshift.io/display-name: PostgreSQL (Persistent)
|
||||
tags: database,postgresql
|
||||
template.openshift.io/documentation-url: https://docs.openshift.org/latest/using_images/db_images/postgresql.html
|
||||
template.openshift.io/long-description: This template provides a standalone
|
||||
PostgreSQL server with a database created. The database is stored on persistent
|
||||
storage. The database name, username, and password are chosen via parameters
|
||||
when provisioning this service.
|
||||
template.openshift.io/provider-display-name: Red Hat, Inc.
|
||||
template.openshift.io/support-url: https://access.redhat.com
|
||||
name: postgresql-persistent
|
||||
objects:
|
||||
- apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
template.openshift.io/expose-database_name: '{.data[''database-name'']}'
|
||||
template.openshift.io/expose-password: '{.data[''database-password'']}'
|
||||
template.openshift.io/expose-admin_password: '{.data[''database-admin-password'']}'
|
||||
template.openshift.io/expose-username: '{.data[''database-user'']}'
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
stringData:
|
||||
database-name: ${POSTGRESQL_DATABASE}
|
||||
database-password: ${POSTGRESQL_PASSWORD}
|
||||
database-admin-password: ${POSTGRESQL_PASSWORD}
|
||||
database-user: ${POSTGRESQL_USER}
|
||||
- apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
template.openshift.io/expose-uri: postgres://{.spec.clusterIP}:{.spec.ports[?(.name=="postgresql")].port}
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
spec:
|
||||
ports:
|
||||
- name: postgresql
|
||||
nodePort: 0
|
||||
port: 5432
|
||||
protocol: TCP
|
||||
targetPort: 5432
|
||||
selector:
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
sessionAffinity: None
|
||||
type: ClusterIP
|
||||
status:
|
||||
loadBalancer: {}
|
||||
- apiVersion: v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
annotations:
|
||||
template.alpha.openshift.io/wait-for-ready: "true"
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
spec:
|
||||
containers:
|
||||
- capabilities: {}
|
||||
env:
|
||||
- name: POSTGRESQL_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: database-user
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
- name: POSTGRESQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: database-password
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
- name: POSTGRESQL_DATABASE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: database-name
|
||||
name: ${DATABASE_SERVICE_NAME}
|
||||
- name: POSTGRESQL_MAX_CONNECTIONS
|
||||
value: ${POSTGRESQL_MAX_CONNECTIONS}
|
||||
image: registry.redhat.io/rhel8/postgresql-12
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /usr/libexec/check-container
|
||||
- --live
|
||||
initialDelaySeconds: 120
|
||||
timeoutSeconds: 10
|
||||
name: postgresql
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- /usr/libexec/check-container
|
||||
initialDelaySeconds: 5
|
||||
timeoutSeconds: 1
|
||||
resources:
|
||||
limits:
|
||||
memory: ${MEMORY_LIMIT}
|
||||
securityContext:
|
||||
capabilities: {}
|
||||
privileged: false
|
||||
terminationMessagePath: /dev/termination-log
|
||||
volumeMounts:
|
||||
- mountPath: /var/lib/pgsql/data
|
||||
name: ${DATABASE_SERVICE_NAME}-data
|
||||
dnsPolicy: ClusterFirst
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: ${DATABASE_SERVICE_NAME}-data
|
||||
{% if openshift_pg_emptydir | bool %}
|
||||
emptyDir: {}
|
||||
{% else %}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ openshift_pg_pvc_name }}
|
||||
{% endif %}
|
||||
triggers:
|
||||
- type: ConfigChange
|
||||
status: {}
|
||||
parameters:
|
||||
- description: Maximum amount of memory the container can use.
|
||||
displayName: Memory Limit
|
||||
name: MEMORY_LIMIT
|
||||
required: true
|
||||
value: 512Mi
|
||||
- description: The OpenShift Namespace where the ImageStream resides.
|
||||
displayName: Namespace
|
||||
name: NAMESPACE
|
||||
value: openshift
|
||||
- description: The name of the OpenShift Service exposed for the database.
|
||||
displayName: Database Service Name
|
||||
name: DATABASE_SERVICE_NAME
|
||||
required: true
|
||||
value: postgresql
|
||||
- description: Username for PostgreSQL user that will be used for accessing the
|
||||
database.
|
||||
displayName: PostgreSQL Connection Username
|
||||
from: user[A-Z0-9]{3}
|
||||
generate: expression
|
||||
name: POSTGRESQL_USER
|
||||
required: true
|
||||
- description: Password for the PostgreSQL connection user.
|
||||
displayName: PostgreSQL Connection Password
|
||||
from: '[a-zA-Z0-9]{16}'
|
||||
generate: expression
|
||||
name: POSTGRESQL_PASSWORD
|
||||
required: true
|
||||
- description: Name of the PostgreSQL database accessed.
|
||||
displayName: PostgreSQL Database Name
|
||||
name: POSTGRESQL_DATABASE
|
||||
required: true
|
||||
value: sampledb
|
||||
@@ -0,0 +1,64 @@
|
||||
postgresqlUsername: {{ pg_username }}
|
||||
postgresqlPassword: {{ pg_password }}
|
||||
postgresqlDatabase: {{ pg_database }}
|
||||
persistence:
|
||||
size: {{ pg_volume_capacity|default('5') }}Gi
|
||||
{% if pg_persistence_storageClass is defined %}
|
||||
storageClass: {{ pg_persistence_storageClass }}
|
||||
{% endif %}
|
||||
{% if pg_persistence_existingclaim is defined %}
|
||||
existingClaim: {{ pg_persistence_existingclaim }}
|
||||
{% endif %}
|
||||
{% if pg_cpu_limit is defined or pg_mem_limit is defined %}
|
||||
resources:
|
||||
limits:
|
||||
{% if pg_cpu_limit is defined %}
|
||||
cpu: {{ pg_cpu_limit | string }}m
|
||||
{% endif %}
|
||||
{% if pg_mem_limit is defined %}
|
||||
memory: {{ pg_mem_limit | string }}Gi
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if tolerations is defined or node_selector is defined or affinity is defined %}
|
||||
master:
|
||||
{% if tolerations is defined %}
|
||||
tolerations:
|
||||
{{ tolerations | to_nice_yaml(indent=2) | indent(width=4, indentfirst=True) }}
|
||||
{% endif %}
|
||||
{% if node_selector is defined %}
|
||||
nodeSelector:
|
||||
{{ node_selector | to_nice_yaml(indent=2) | indent(width=4, indentfirst=True) }}
|
||||
{% endif %}
|
||||
{% if affinity is defined %}
|
||||
affinity:
|
||||
{{ affinity | to_nice_yaml(indent=2) | indent(width=4, indentfirst=True) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
image:
|
||||
{% if pg_image_registry is defined %}
|
||||
# The default bitnami image from the chart doesn't work on ARM
|
||||
registry: {{ pg_image_registry }}
|
||||
{% endif %}
|
||||
{% if pg_image_registry is not defined %}
|
||||
registry: docker.io/bitnami
|
||||
{% endif %}
|
||||
repository: postgresql
|
||||
tag: '12.5.0'
|
||||
volumePermissions:
|
||||
image:
|
||||
{% if pg_image_registry is defined %}
|
||||
registry: {{ pg_image_registry }}
|
||||
{% endif %}
|
||||
# The default bitnami image from the chart doesn't work on ARM
|
||||
repository: alpine
|
||||
tag: '3'
|
||||
{% if pg_image_registry is defined %}
|
||||
metrics:
|
||||
image:
|
||||
registry: {{ pg_image_registry }}
|
||||
{% endif %}
|
||||
{% if pg_serviceaccount is defined %}
|
||||
serviceAccount:
|
||||
enabled: true
|
||||
name: {{ pg_serviceaccount }}
|
||||
{% endif %}
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
name: "{{ kubernetes_deployment_name }}-secrets"
|
||||
type: Opaque
|
||||
data:
|
||||
secret_key: "{{ secret_key | b64encode }}"
|
||||
credentials_py: "{{ lookup('template', 'credentials.py.j2') | b64encode }}"
|
||||
environment_sh: "{{ lookup('template', 'environment.sh.j2') | b64encode }}"
|
||||
@@ -0,0 +1,149 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ kubernetes_deployment_name }}-supervisor-config
|
||||
namespace: {{ kubernetes_namespace }}
|
||||
data:
|
||||
supervisor-web-config: |
|
||||
[supervisord]
|
||||
nodaemon = True
|
||||
umask = 022
|
||||
logfile = /dev/stdout
|
||||
logfile_maxbytes = 0
|
||||
pidfile = /var/run/supervisor/supervisor.web.pid
|
||||
|
||||
[program:nginx]
|
||||
command = nginx -g "daemon off;"
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stopwaitsecs = 5
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:uwsgi]
|
||||
command = {{ uwsgi_bash }} '/var/lib/awx/venv/awx/bin/uwsgi --socket 127.0.0.1:8050 --module=awx.wsgi:application --vacuum --processes=5 --harakiri=120 --no-orphans --master --max-requests=1000 --master-fifo=/var/lib/awx/awxfifo --lazy-apps -b 32768'
|
||||
directory = /var/lib/awx
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stopwaitsecs = 15
|
||||
stopsignal = INT
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:daphne]
|
||||
command = {{ uwsgi_bash }} '/var/lib/awx/venv/awx/bin/daphne -b 127.0.0.1 -p 8051 awx.asgi:channel_layer'
|
||||
directory = /var/lib/awx
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stopwaitsecs = 5
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:wsbroadcast]
|
||||
command = awx-manage run_wsbroadcast
|
||||
directory = /var/lib/awx
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stopwaitsecs = 5
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:awx-rsyslogd]
|
||||
command = rsyslogd -n -i /var/run/awx-rsyslog/rsyslog.pid -f /var/lib/awx/rsyslog/rsyslog.conf
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stopwaitsecs = 5
|
||||
startretries = 10
|
||||
stopsignal=TERM
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/dev/stderr
|
||||
stdout_logfile_maxbytes=0
|
||||
|
||||
[group:tower-processes]
|
||||
programs=nginx,uwsgi,daphne,wsbroadcast,awx-rsyslogd
|
||||
priority=5
|
||||
|
||||
# TODO: Exit Handler
|
||||
|
||||
[eventlistener:awx-config-watcher]
|
||||
command=/usr/bin/config-watcher
|
||||
stderr_logfile=/dev/stdout
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
events=TICK_60
|
||||
priority=0
|
||||
|
||||
[unix_http_server]
|
||||
file=/var/run/supervisor/supervisor.web.sock
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///var/run/supervisor/supervisor.web.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
supervisor-task-config: |
|
||||
[supervisord]
|
||||
nodaemon = True
|
||||
umask = 022
|
||||
logfile = /dev/stdout
|
||||
logfile_maxbytes = 0
|
||||
pidfile = /var/run/supervisor/supervisor.pid
|
||||
|
||||
[program:dispatcher]
|
||||
command = awx-manage run_dispatcher
|
||||
directory = /var/lib/awx
|
||||
environment = LANGUAGE="en_US.UTF-8",LANG="en_US.UTF-8",LC_ALL="en_US.UTF-8",LC_CTYPE="en_US.UTF-8"
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stopwaitsecs = 5
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[program:callback-receiver]
|
||||
command = awx-manage run_callback_receiver
|
||||
directory = /var/lib/awx
|
||||
autostart = true
|
||||
autorestart = true
|
||||
stopwaitsecs = 5
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
|
||||
[group:tower-processes]
|
||||
programs=dispatcher,callback-receiver
|
||||
priority=5
|
||||
|
||||
# TODO: Exit Handler
|
||||
|
||||
[eventlistener:awx-config-watcher]
|
||||
command=/usr/bin/config-watcher
|
||||
stderr_logfile=/dev/stdout
|
||||
stderr_logfile_maxbytes=0
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
events=TICK_60
|
||||
priority=0
|
||||
|
||||
[unix_http_server]
|
||||
file=/var/run/supervisor/supervisor.sock
|
||||
|
||||
[supervisorctl]
|
||||
serverurl=unix:///var/run/supervisor/supervisor.sock ; use a unix:// URL for a unix socket
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
Reference in New Issue
Block a user