Skip to content

Commit

Permalink
Merge branch 'devel' into update-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rooftopcellist authored Jun 21, 2023
2 parents 3f79ea5 + 56d1966 commit 3c9574d
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 33 deletions.
3 changes: 3 additions & 0 deletions config/crd/bases/awx.ansible.com_awxbackups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ spec:
postgres_image_version:
description: PostgreSQL container image version to use
type: string
db_management_pod_node_selector:
description: nodeSelector for the Postgres pods to backup
type: string
no_log:
description: Configure no_log for no_log tasks
type: boolean
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/awx.ansible.com_awxrestores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ spec:
postgres_image_version:
description: PostgreSQL container image version to use
type: string
db_management_pod_node_selector:
description: nodeSelector for the Postgres pods to backup
type: string
no_log:
description: Configure no_log for no_log tasks
type: boolean
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
capabilities:
drop:
- "ALL"
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
Expand Down
8 changes: 8 additions & 0 deletions roles/backup/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ no_log: true
# Variable to set when you want backups to be cleaned up when the CRD object is deleted
clean_backup_on_delete: false


# Add a nodeSelector for the Postgres pods to backup.
# Specify as literal block. E.g.:
# db_management_pod_node_selector: |
# kubernetes.io/arch: amd64
# kubernetes.io/os: linux
db_management_pod_node_selector: ''

# Variable to signal that this role is being run as a finalizer
finalizer_run: false

Expand Down
4 changes: 4 additions & 0 deletions roles/backup/templates/management-pod.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ spec:
resources:
{{ backup_resource_requirements | to_nice_yaml(indent=2) | indent(width=6, first=False) }}
{%- endif %}
{% if db_management_pod_node_selector %}
nodeSelector:
{{ db_management_pod_node_selector | indent(width=8) }}
{% endif %}
volumes:
- name: {{ ansible_operator_meta.name }}-backup
persistentVolumeClaim:
Expand Down
46 changes: 23 additions & 23 deletions roles/installer/templates/configmaps/config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ data:
import socket
# Import all so that extra_settings works properly
from django_auth_ldap.config import *

def get_secret():
if os.path.exists("/etc/tower/SECRET_KEY"):
return open('/etc/tower/SECRET_KEY', 'rb').read().strip()

ADMINS = ()
STATIC_ROOT = '/var/lib/awx/public/static'
STATIC_URL = '{{ (ingress_path + '/static/').replace('//', '/') }}'
Expand Down Expand Up @@ -59,20 +59,20 @@ data:

# Container environments don't like chroots
AWX_PROOT_ENABLED = False

# Automatically deprovision pods that go offline
AWX_AUTO_DEPROVISION_INSTANCES = True

CLUSTER_HOST_ID = socket.gethostname()
SYSTEM_UUID = os.environ.get('MY_POD_UID', '00000000-0000-0000-0000-000000000000')

CSRF_COOKIE_SECURE = {{ csrf_cookie_secure | bool }}
SESSION_COOKIE_SECURE = {{ session_cookie_secure | bool }}

SERVER_EMAIL = 'root@localhost'
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
EMAIL_SUBJECT_PREFIX = '[AWX] '

EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
Expand Down Expand Up @@ -101,30 +101,30 @@ data:
default_type application/octet-stream;
server_tokens off;
client_max_body_size 5M;

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 route_tls_termination_mechanism | lower == 'passthrough' %}
server {
Expand Down Expand Up @@ -163,30 +163,30 @@ data:
# 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";
# Protect against MIME content sniffing https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
add_header X-Content-Type-Options nosniff;

location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}

location {{ (ingress_path + '/static').replace('//', '/') }} {
alias /var/lib/awx/public/static/;
}

location {{ (ingress_path + '/favicon.ico').replace('//', '/') }} {
alias /var/lib/awx/public/static/media/favicon.ico;
}

location {{ (ingress_path + '/websocket').replace('//', '/') }} {
# Pass request to the upstream alias
proxy_pass http://daphne;
Expand All @@ -208,7 +208,7 @@ data:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}

location {{ ingress_path }} {
# Add trailing / if missing
rewrite ^(.*)$http_host(.*[^/])$ $1$http_host$2/ permanent;
Expand Down Expand Up @@ -268,8 +268,8 @@ data:
cert: /etc/receptor/tls/receptor.crt
key: /etc/receptor/tls/receptor.key
name: tlsclient
rootcas: /etc/receptor/tls/ca/receptor-ca.crt
rootcas: /etc/receptor/tls/ca/mesh-CA.crt
mintls13: false
- work-signing:
privatekey: /etc/receptor/signing/work-private-key.pem
privatekey: /etc/receptor/work_private_key.pem
tokenexpiration: 1m
24 changes: 18 additions & 6 deletions roles/installer/templates/deployments/task.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
- |
hostname=$MY_POD_NAME
receptor --cert-makereq bits=2048 commonname=$hostname dnsname=$hostname nodeid=$hostname outreq=/etc/receptor/tls/receptor.req outkey=/etc/receptor/tls/receptor.key
receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/receptor-ca.crt cakey=/etc/receptor/tls/ca/receptor-ca.key outcert=/etc/receptor/tls/receptor.crt verify=yes
receptor --cert-signreq req=/etc/receptor/tls/receptor.req cacert=/etc/receptor/tls/ca/mesh-CA.crt cakey=/etc/receptor/tls/ca/mesh-CA.key outcert=/etc/receptor/tls/receptor.crt verify=yes
{% if bundle_ca_crt %}
mkdir -p /etc/pki/ca-trust/extracted/{java,pem,openssl,edk2}
update-ca-trust
Expand All @@ -98,11 +98,11 @@ spec:
fieldPath: metadata.name
volumeMounts:
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
mountPath: "/etc/receptor/tls/ca/receptor-ca.crt"
mountPath: "/etc/receptor/tls/ca/mesh-CA.crt"
subPath: "tls.crt"
readOnly: true
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
mountPath: "/etc/receptor/tls/ca/receptor-ca.key"
mountPath: "/etc/receptor/tls/ca/mesh-CA.key"
subPath: "tls.key"
readOnly: true
- name: "{{ ansible_operator_meta.name }}-receptor-tls"
Expand Down Expand Up @@ -224,7 +224,7 @@ spec:
- name: "{{ ansible_operator_meta.name }}-receptor-config"
mountPath: "/etc/receptor/"
- name: "{{ ansible_operator_meta.name }}-receptor-work-signing"
mountPath: "/etc/receptor/signing/work-private-key.pem"
mountPath: "/etc/receptor/work_private_key.pem"
subPath: "work-private-key.pem"
readOnly: true
- name: receptor-socket
Expand Down Expand Up @@ -305,11 +305,11 @@ spec:
- name: "{{ ansible_operator_meta.name }}-receptor-config"
mountPath: "/etc/receptor/"
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
mountPath: "/etc/receptor/tls/ca/receptor-ca.crt"
mountPath: "/etc/receptor/tls/ca/mesh-CA.crt"
subPath: "tls.crt"
readOnly: true
- name: "{{ ansible_operator_meta.name }}-receptor-work-signing"
mountPath: "/etc/receptor/signing/work-private-key.pem"
mountPath: "/etc/receptor/work_private_key.pem"
subPath: "work-private-key.pem"
readOnly: true
- name: "{{ ansible_operator_meta.name }}-receptor-tls"
Expand Down Expand Up @@ -381,6 +381,18 @@ spec:
{% if development_mode | bool %}
- name: awx-devel
mountPath: "/awx_devel"
{% endif %}
{% if termination_grace_period_seconds is defined %}
- name: pre-stop-data
mountPath: /var/lib/pre-stop
- name: pre-stop-scripts
mountPath: /var/lib/pre-stop/scripts
lifecycle:
preStop:
exec:
command:
- bash
- /var/lib/pre-stop/scripts/termination-waiter
{% endif %}
env:
- name: SUPERVISOR_CONFIG_PATH
Expand Down
6 changes: 3 additions & 3 deletions roles/installer/templates/deployments/web.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ spec:
mountPath: "/var/lib/awx/projects"
{% endif %}
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
mountPath: "/etc/receptor/tls/ca/receptor-ca.crt"
mountPath: "/etc/receptor/tls/ca/mesh-CA.crt"
subPath: "tls.crt"
readOnly: true
- name: "{{ ansible_operator_meta.name }}-receptor-ca"
mountPath: "/etc/receptor/tls/ca/receptor-ca.key"
mountPath: "/etc/receptor/tls/ca/mesh-CA.key"
subPath: "tls.key"
readOnly: true
- name: "{{ ansible_operator_meta.name }}-receptor-work-signing"
mountPath: "/etc/receptor/signing/work-public-key.pem"
mountPath: "/etc/receptor/work_public_key.pem"
subPath: "work-public-key.pem"
readOnly: true
{% if development_mode | bool %}
Expand Down
8 changes: 8 additions & 0 deletions roles/restore/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ cluster_name: 'cluster.local'
# Set no_log settings on certain tasks
no_log: true

# Add a nodeSelector for the Postgres pods to backup.
# Specify as literal block. E.g.:
# db_management_pod_node_selector: |
# kubernetes.io/arch: amd64
# kubernetes.io/os: linux
db_management_pod_node_selector: ''


# Default resource requirements
restore_resource_requirements:
limits:
Expand Down
4 changes: 4 additions & 0 deletions roles/restore/templates/management-pod.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ spec:
resources:
{{ restore_resource_requirements | to_nice_yaml(indent=2) | indent(width=6, first=False) }}
{%- endif %}
{% if db_management_pod_node_selector %}
nodeSelector:
{{ db_management_pod_node_selector | indent(width=8) }}
{% endif %}
volumes:
- name: {{ ansible_operator_meta.name }}-backup
persistentVolumeClaim:
Expand Down

0 comments on commit 3c9574d

Please sign in to comment.