Skip to content

Commit

Permalink
[feature] Make the NFS volumes accessible to the AWX worker pods
Browse files Browse the repository at this point in the history
Move the `wp-nfs` volumeMount and volume from the `awx-task` container (where it is no longer used), to the `default` `InstanceGroup`'s pod template.
  • Loading branch information
Dominique Quatravaux committed Jun 17, 2023
1 parent 4f64b97 commit 89e81dd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
28 changes: 28 additions & 0 deletions ansible/roles/awx-instance/tasks/awx-objects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,34 @@
update_json_status(changed=get_or_create_job_template(**kwarg))
- name: "`default` InstanceGroup: provide /srv NFS volume to worker pods"
awx_script:
supports_check_mode: yes
script: |
{{ lookup("template", "awx_script_lib.py") }}
from awx.main.models.ha import InstanceGroup
# We *should not* create the InstanceGroup here - Rather, we
# want `-t awx.seed` to take care of that, so that it may put in
# all the required bells and whistles:
InstanceGroup.objects.get(name="default")
# Still, we want to use `AnsibleGetOrCreate` for its
# `supports_check_mode` goodness:
with AnsibleGetOrCreate(InstanceGroup, name="default") as grp:
grp.pod_spec_override = """
spec:
containers:
- name: worker
volumeMounts:
- name: wp-nfs
mountPath: "/srv"
volumes:
- name: wp-nfs
persistentVolumeClaim:
claimName: wordpress-0
"""
- name: "job template for backups"
awx_script:
supports_check_mode: yes
Expand Down
6 changes: 0 additions & 6 deletions ansible/roles/awx-instance/tasks/k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@
readOnly: true
- name: awx-redis-socket
mountPath: "/var/run/redis"
- name: wp-nfs
mountPath: "/srv"
readOnly: true
# For some reason, awx-task insists on being able to
# constantly update /etc/receptor/receptor.conf, even
# though we don't need that in Kubernetes. Oh well, at
Expand Down Expand Up @@ -258,9 +255,6 @@
serviceAccountName: "{{ awx_service_account }}"
terminationGracePeriodSeconds: 10
volumes:
- name: wp-nfs
persistentVolumeClaim:
claimName: wordpress-0
- name: awx-application-config
configMap:
name: awx-config
Expand Down

0 comments on commit 89e81dd

Please sign in to comment.