mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-26 21:33:14 +00:00
* Add ability to pass images in from the CSV for disconnected installs Signed-off-by: Christian M. Adams <chadams@redhat.com>
136 lines
4.8 KiB
Django/Jinja
136 lines
4.8 KiB
Django/Jinja
# Postgres StatefulSet.
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: '{{ ansible_operator_meta.name }}-postgres'
|
|
namespace: '{{ ansible_operator_meta.namespace }}'
|
|
labels:
|
|
app.kubernetes.io/name: 'postgres'
|
|
app.kubernetes.io/instance: 'postgres-{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/component: 'database'
|
|
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
|
|
app.kubernetes.io/operator-version: '{{ lookup("env", "OPERATOR_VERSION") }}'
|
|
app.kubernetes.io/component: database
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: 'postgres'
|
|
app.kubernetes.io/instance: 'postgres-{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/component: 'database'
|
|
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
|
|
serviceName: '{{ ansible_operator_meta.name }}'
|
|
replicas: 1
|
|
updateStrategy:
|
|
type: RollingUpdate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: 'postgres'
|
|
app.kubernetes.io/instance: 'postgres-{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/component: 'database'
|
|
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
|
|
spec:
|
|
{% if image_pull_secret %}
|
|
imagePullSecrets:
|
|
- name: {{ image_pull_secret }}
|
|
{% endif %}
|
|
containers:
|
|
- image: '{{ _postgres_image }}'
|
|
imagePullPolicy: '{{ image_pull_policy }}'
|
|
name: postgres
|
|
env:
|
|
# For postgres_image based on rhel8/postgresql-12
|
|
- name: POSTGRESQL_DATABASE
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: '{{ __postgres_configuration_secret }}'
|
|
key: database
|
|
- name: POSTGRESQL_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: '{{ __postgres_configuration_secret }}'
|
|
key: username
|
|
- name: POSTGRESQL_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: '{{ __postgres_configuration_secret }}'
|
|
key: password
|
|
|
|
# For postgres_image based on postgres
|
|
- name: POSTGRES_DB
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: '{{ __postgres_configuration_secret }}'
|
|
key: database
|
|
- name: POSTGRES_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: '{{ __postgres_configuration_secret }}'
|
|
key: username
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: '{{ __postgres_configuration_secret }}'
|
|
key: password
|
|
- name: PGDATA
|
|
value: '{{ postgres_data_path }}'
|
|
- name: POSTGRES_INITDB_ARGS
|
|
value: '{{ postgres_initdb_args }}'
|
|
- name: POSTGRES_HOST_AUTH_METHOD
|
|
value: '{{ postgres_host_auth_method }}'
|
|
ports:
|
|
- containerPort: {{ awx_postgres_port | default('5432')}}
|
|
name: postgres
|
|
volumeMounts:
|
|
- name: postgres
|
|
mountPath: '{{ postgres_data_path | dirname }}'
|
|
subPath: '{{ postgres_data_path | dirname | basename }}'
|
|
resources: {{ postgres_resource_requirements }}
|
|
{% if postgres_selector %}
|
|
nodeSelector:
|
|
{{ postgres_selector | indent(width=8) }}
|
|
{% endif %}
|
|
{% if postgres_tolerations %}
|
|
tolerations:
|
|
{{ postgres_tolerations | indent(width=8) }}
|
|
{% endif %}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: postgres
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
{% if postgres_storage_class is defined %}
|
|
storageClassName: '{{ postgres_storage_class }}'
|
|
{% endif %}
|
|
resources: {{ postgres_storage_requirements }}
|
|
|
|
# Postgres Service.
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: '{{ ansible_operator_meta.name }}-postgres'
|
|
namespace: '{{ ansible_operator_meta.namespace }}'
|
|
labels:
|
|
app.kubernetes.io/name: 'postgres'
|
|
app.kubernetes.io/instance: 'postgres-{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/component: 'database'
|
|
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
|
|
app.kubernetes.io/operator-version: '{{ lookup("env", "OPERATOR_VERSION") }}'
|
|
app.kubernetes.io/component: database
|
|
spec:
|
|
ports:
|
|
- port: 5432
|
|
clusterIP: None
|
|
selector:
|
|
app.kubernetes.io/name: 'postgres'
|
|
app.kubernetes.io/instance: 'postgres-{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/component: 'database'
|
|
app.kubernetes.io/part-of: '{{ ansible_operator_meta.name }}'
|
|
app.kubernetes.io/managed-by: '{{ deployment_type }}-operator'
|