-
Notifications
You must be signed in to change notification settings - Fork 639
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
Add postgres init container #1799
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for working on this.
If we don't implement any default value for init_postgres_extra_commands
, I think there should be a complete example that can use as it is instead of foo
nor bar
, in the docs, something like;
init_postgres_extra_commands: |
chown 26:0 /var/lib/pgsql/data
chmod 700 /var/lib/pgsql/data
5e44b6a
to
da69551
Compare
@kurokobo thanks, added a snippet to the docs |
da69551
to
de48ddc
Compare
{% endif %} | ||
{% if init_container_extra_volume_mounts -%} | ||
{{ init_container_extra_volume_mounts | indent(width=12, first=True) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not in volumes. I think this needs to be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hhk7734
I think this is intended, since any other *_extra_volume_mounts
are designed to use with single extra_volumes
: https://ansible.readthedocs.io/projects/awx-operator/en/latest/user-guide/advanced-configuration/custom-volume-and-volume-mount-options.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If init_container_extra_volume_mounts
is designed to use with extra_volumes
, it need to add extra_volumes
to volumes in this template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, it looks like postgres_extra_volumes
is used for the additional PSQL volumes instead of extra_volumes
.
I don't see it mentioned in the documentation. This is a different issue: https://github.com/ansible/awx-operator/pull/1799/files#diff-57afb141659730e9bae27cd3ea91bfe5b1709a2569d98759221305423d544c03L128-L131
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that init_container_extra_volume_mounts
block belongs here. The postgres_extra_volume_mounts
parameter is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I'm testing this PR and found some issues. Could you please check my comments?
Also there are some updates on devel
branch so if you can please rebase your branch.
mountPath: '{{ postgres_data_path | dirname }}' | ||
subPath: '{{ postgres_data_path | dirname | basename }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
postgres_data_path
is removed by #1798. Using this causing error:
TASK [Create Database if no database is specified] ********************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: Unable to look up a name or access an attribute in template string (# Postgres StatefulSet.\n...
We should use _postgres_data_path
instead.
mountPath: '{{ postgres_data_path | dirname }}' | |
subPath: '{{ postgres_data_path | dirname | basename }}' | |
mountPath: '{{ _postgres_data_path | dirname }}' | |
subPath: '{{ _postgres_data_path | dirname | basename }}' |
Add postgres init container if postgres_init_container_extra_commands is defined This allows users to run arbitrary commands This is aimed to solve the issue where users may need to chmod or chown the postgres data volume for user 26, which is the user that is running postgres in the sclorg image. For example, one can now set the follow on the AWX spec: spec: postgres_init_container_extra_commands: | chown 26:0 /var/lib/pgsql/data chmod 700 /var/lib/pgsql/data Signed-off-by: Seth Foster <[email protected]>
de48ddc
to
79497c7
Compare
I tested this out with @kurokobo 's awx-on-k3s README.md and yaml snippets using this changes and it works now without having to run First I stood up a k3s cluster:
Instead of running
I observed the the migrations k8s job completed without any permissions issues. Similarly, there are no longer any permissions issues in the postgres pod. Everything deployed successfully and I can reach the UI at |
@kurokobo @craph We thought it might be easier for users to configure this as a flag instead of a set of commands. Let me know if you have feedback on the approach on #1805 versus the approach on this PR. |
@rooftopcellist |
Hi @rooftopcellist, May be the PR #1805 is a best solution to provide a better user experience with a good updated documentation to explain the spec. Best regards, |
SUMMARY
Potentially resolves:
Create a postgres init container that will run user-provided
init_postgres_extra_commands
for example, in the awx spec file:
ISSUE TYPE