Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to define custom config for Redis Container #1427

Open
wants to merge 19 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,8 @@ In a scenario where custom volumes and volume mounts are required to either over
| extra_volumes | Specify extra volumes to add to the application pod | '' |
| web_extra_volume_mounts | Specify volume mounts to be added to Web container | '' |
| task_extra_volume_mounts | Specify volume mounts to be added to Task container | '' |
| ee_extra_volume_mounts | Specify volume mounts to be added to Execution container | '' |
| ee_extra_volume_mounts | Specify volume mounts to be added to Execution container | '' |
rakesh561 marked this conversation as resolved.
Show resolved Hide resolved
| redis_extra_volume_mounts | Specify volume mounts to be added to redis container. | '' |
| init_container_extra_volume_mounts | Specify volume mounts to be added to Init container | '' |
| init_container_extra_commands | Specify additional commands for Init container | '' |

Expand Down Expand Up @@ -1159,11 +1160,13 @@ type: kubernetes.io/dockerconfigjson

If you need to export custom environment variables to your containers.

| Name | Description | Default |
| -------------- | --------------------------------------------------- | ------- |
| task_extra_env | Environment variables to be added to Task container | '' |
| web_extra_env | Environment variables to be added to Web container | '' |
| ee_extra_env | Environment variables to be added to EE container | '' |
| Name | Description | Default |
| -------------- | --------------------------------------------------- | ------- |
| task_extra_env | Environment variables to be added to Task container | '' |
| web_extra_env | Environment variables to be added to Web container | '' |
| ee_extra_env | Environment variables to be added to EE container | '' |
| redis_extra_env | Environment variables to be added to redis container | '' |


> :warning: The `ee_extra_env` will only take effect to the globally available Execution Environments. For custom `ee`, please [customize the Pod spec](https://docs.ansible.com/ansible-tower/latest/html/administration/external_execution_envs.html#customize-the-pod-spec).

Expand All @@ -1180,6 +1183,9 @@ Example configuration of environment variables
ee_extra_env: |
- name: MYCUSTOMVAR
value: foo
redis_extra_env: |
- name: MYCUSTOMVAR
value: foo
```

#### CSRF Cookie Secure Setting
Expand Down
11 changes: 11 additions & 0 deletions config/crd/bases/awx.ansible.com_awxs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,14 @@ spec:
type: array
items:
type: string
redis_args:
type: array
items:
type: string
redis_command:
type: array
items:
type: string
task_extra_env:
type: string
web_extra_env:
Expand All @@ -1544,6 +1552,9 @@ spec:
web_extra_volume_mounts:
description: Specify volume mounts to be added to the Web container
type: string
redis_extra_volume_mounts:
description: Specify volume mounts to be added to the Redis container
type: string
redis_image:
description: Registry path to the redis container to use
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like redis_extra_env is missing here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rakesh561 This is still needed.

type: string
Expand Down
22 changes: 22 additions & 0 deletions config/manifests/bases/awx-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,28 @@ spec:
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Redis Args
path: redis_args
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Redis Command
path: redis_command
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- description: Environment variables to be added to Redis container
displayName: Redis Extra Env
path: redis_extra_env
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- description: Specify volume mounts to be added to Redis container
displayName: Redis Extra Volume Mounts
path: redis_extra_volume_mounts
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- description: Specify extra volumes to add to the application pod
displayName: Extra Volumes
path: extra_volumes
Expand Down
5 changes: 5 additions & 0 deletions roles/installer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ web_command: []
rsyslog_args:
- /usr/bin/launch_awx_rsyslog.sh
rsyslog_command: []
redis_args:
- /usr/bin/launch_awx_redis.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file doesn't exist, so I think redis_args can be empty by default

redis_command: []
rooftopcellist marked this conversation as resolved.
Show resolved Hide resolved

task_resource_requirements:
requests:
Expand Down Expand Up @@ -331,6 +334,7 @@ rsyslog_resource_requirements:
task_extra_env: ''
web_extra_env: ''
ee_extra_env: ''
redis_extra_env: ''

# Mount extra volumes on the AWX task/web containers. Specify as literal block.
# E.g.:
Expand All @@ -340,6 +344,7 @@ ee_extra_env: ''
task_extra_volume_mounts: ''
web_extra_volume_mounts: ''
ee_extra_volume_mounts: ''
redis_extra_volume_mounts: ''

# Add a nodeSelector for the Postgres pods.
# It must match a node's labels for the pod to be scheduled on that node.
Expand Down
8 changes: 8 additions & 0 deletions roles/installer/templates/deployments/task.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ spec:
- image: '{{ _redis_image }}'
imagePullPolicy: '{{ image_pull_policy }}'
name: redis
{% if redis_command %}
command: {{ redis_command }}
{% endif %}
{% if redis_args %}
args: {{ redis_args }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line already exists:

You'll probably want to set the default to

["redis-server", "/etc/redis.conf"]

I think that should be the value for redis_command, not redis_args, but the only way to know for sure will be to deploy it and try it out once those changes are made.

{% if redis_capabilities is defined and redis_capabilities %}
securityContext:
capabilities:
Expand Down Expand Up @@ -381,6 +386,9 @@ spec:
{% if development_mode | bool %}
- name: awx-devel
mountPath: "/awx_devel"
{% endif %}
{% if redis_extra_volume_mounts -%}
{{ rsyslog_redis_volume_mounts | indent(width=12, first=True) }}
{% endif %}
env:
- name: SUPERVISOR_CONFIG_PATH
Expand Down
12 changes: 12 additions & 0 deletions roles/installer/templates/deployments/web.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ spec:
- image: '{{ _redis_image }}'
imagePullPolicy: '{{ image_pull_policy }}'
name: redis
{% if redis_command %}
command: {{ redis_command }}
{% endif %}
{% if redis_args %}
args: {{ redis_args }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this already exists, currently, your templaated redis_args wouldn't be used at all, the entry further down on line 140 would be used instead (here).

{% endif %}
{% if redis_capabilities is defined and redis_capabilities %}
securityContext:
capabilities:
Expand All @@ -146,6 +152,12 @@ spec:
- image: '{{ _image }}'
name: '{{ ansible_operator_meta.name }}-web'
imagePullPolicy: '{{ image_pull_policy }}'
{% if redis_extra_volume_mounts -%}
{{ redis_extra_volume_mounts | indent(width=12, first=True) }}
{% endif %}
{% if redis_extra_env -%}
{{ redis_extra_env | indent(width=12, first=True) }}
{% endif %}
{% if web_command %}
command: {{ web_command }}
{% endif %}
Expand Down