-
Notifications
You must be signed in to change notification settings - Fork 9
Add infra container images for memcached, redis, rabbitmq and mariadb #13
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
Open
lmiccini
wants to merge
1
commit into
openstack-k8s-operators:main
Choose a base branch
from
lmiccini:add-infra-containers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+227
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ARG BASE_IMAGE=localhost/openstack/openstack-base:latest | ||
| FROM ${BASE_IMAGE} | ||
|
|
||
| LABEL summary="OpenStack MariaDB" \ | ||
| io.k8s.description="MariaDB database service with Galera clustering for OpenStack" | ||
|
|
||
| RUN uid_gid_manage mysql | ||
|
|
||
| # UBI AppStream disabled to avoid mariadb version conflicts with CentOS packages | ||
| COPY bindeps.txt /tmp/bindeps.txt | ||
| RUN pkgs=$(cat /tmp/bindeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \ | ||
| if [ -n "${pkgs}" ]; then microdnf -y --disablerepo=ubi-10-appstream-rpms install ${pkgs} && microdnf clean all && rm -rf /var/cache/dnf; fi && \ | ||
| rm /tmp/bindeps.txt | ||
|
|
||
| COPY scripts/extend_start.sh /usr/local/bin/kolla_extend_start | ||
| COPY scripts/security_reset.expect /usr/local/bin/kolla_security_reset | ||
| RUN chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_security_reset | ||
|
|
||
| RUN rm -rf /var/lib/mysql/* /etc/my.cnf.d/mariadb-server.cnf /etc/my.cnf.d/auth_gssapi.cnf | ||
|
|
||
| USER mysql | ||
|
|
||
| ENTRYPOINT ["dumb-init", "--"] | ||
| CMD ["kolla_start"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| expect | ||
| galera | ||
| hostname | ||
| jq | ||
| mariadb | ||
| mariadb-backup | ||
| mariadb-server-galera | ||
| mariadb-server-utils | ||
| rsync | ||
| socat | ||
| stunnel | ||
| tar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/bash | ||
|
|
||
| function bootstrap_db { | ||
| mysqld_safe --wsrep-new-cluster --skip-networking --wsrep-on=OFF --pid-file=/var/lib/mysql/mariadb.pid & | ||
| # Wait for the mariadb server to be "Ready" before starting the security reset with a max timeout | ||
| # NOTE(huikang): the location of mysql's socket file varies depending on the OS distributions. | ||
| # Querying the cluster status has to be executed after the existence of mysql.sock and mariadb.pid. | ||
| TIMEOUT=${DB_MAX_TIMEOUT:-60} | ||
| while [[ ! -S /var/lib/mysql/mysql.sock ]] && \ | ||
| [[ ! -S /var/run/mysqld/mysqld.sock ]] || \ | ||
| [[ ! -f /var/lib/mysql/mariadb.pid ]]; do | ||
| if [[ ${TIMEOUT} -gt 0 ]]; then | ||
| let TIMEOUT-=1 | ||
| sleep 1 | ||
| else | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| sudo -E kolla_security_reset | ||
| mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" | ||
| mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" | ||
| mysqladmin -uroot -p"${DB_ROOT_PASSWORD}" shutdown | ||
| } | ||
|
|
||
| # This catches all cases of the BOOTSTRAP variable being set, including empty | ||
| if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then | ||
| mysql_install_db | ||
| bootstrap_db | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [[ "${!BOOTSTRAP_ARGS[@]}" ]]; then | ||
| ARGS="${BOOTSTRAP_ARGS}" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #!/usr/bin/expect -f | ||
|
|
||
| if [catch {set timeout $env(DB_MAX_TIMEOUT)}] {set timeout 10} | ||
| spawn mysql_secure_installation | ||
| expect { | ||
| timeout { send_user "\nFailed to get 'Enter current password for root (enter for none):' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'Enter current password for root (enter for none):' prompt\n"; exit 1 } | ||
| "Enter current password for root (enter for none):" | ||
| } | ||
| send "\r" | ||
|
|
||
| expect { | ||
| timeout { send_user "\nFailed to get 'Switch to unix_socket authentication [Y/n] ' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'Switch to unix_socket authentication' prompt\n"; exit 1 } | ||
| "Switch to unix_socket authentication \\\[Y/n\\\] " | ||
| } | ||
| send "n\r" | ||
|
|
||
| expect { | ||
| timeout { send_user "\nFailed to get 'Change the root password? [Y/n]' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'Change the root password?' prompt\n"; exit 1 } | ||
| "Change the root password? \\\[Y/n\\\] " | ||
| } | ||
| send "y\r" | ||
|
|
||
| expect { | ||
| timeout { send_user "\nFailed to get 'New password:' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'New password:' prompt\n"; exit 1 } | ||
| "New password:" | ||
| } | ||
| send "$env(DB_ROOT_PASSWORD)\r" | ||
|
|
||
| expect { | ||
| timeout { send_user "\nFailed to get 'Re-enter new password:' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'Re-enter new password:' prompt\n"; exit 1 } | ||
| "Re-enter new password:" | ||
| } | ||
| send "$env(DB_ROOT_PASSWORD)\r" | ||
|
|
||
| expect { | ||
| timeout { send_user "\nFailed to get 'Remove anonymous users?' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'Remove anonymous users?' prompt\n"; exit 1 } | ||
| "Remove anonymous users?" | ||
| } | ||
| send "y\r" | ||
|
|
||
| expect { | ||
| timeout { send_user "\nFailed to get 'Disallow root login remotely?' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'Disallow root login remotely?' prompt\n"; exit 1 } | ||
| "Disallow root login remotely?" | ||
| } | ||
| send "n\r" | ||
|
|
||
| expect { | ||
| timeout { send_user "\nFailed to get 'Remove test database and access to it?' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'Remove test database and access to it?' prompt\n"; exit 1 } | ||
| "Remove test database and access to it?" | ||
| } | ||
| send "y\r" | ||
|
|
||
| expect { | ||
| timeout { send_user "\nFailed to get 'Reload privilege tables now?' prompt\n"; exit 1 } | ||
| eof { send_user "\nFailed to get 'Reload privilege tables now?' prompt\n"; exit 1 } | ||
| "Reload privilege tables now?" | ||
| } | ||
| send "y\r" | ||
| expect eof |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ARG BASE_IMAGE=localhost/openstack/openstack-base:latest | ||
| FROM ${BASE_IMAGE} | ||
|
|
||
| LABEL summary="OpenStack Memcached" \ | ||
| io.k8s.description="Memcached caching service for OpenStack" | ||
|
|
||
| RUN uid_gid_manage memcached | ||
|
|
||
| COPY bindeps.txt /tmp/bindeps.txt | ||
| RUN pkgs=$(cat /tmp/bindeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \ | ||
| if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all && rm -rf /var/cache/dnf; fi && \ | ||
| rm /tmp/bindeps.txt | ||
|
|
||
| USER memcached |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| memcached |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| ARG BASE_IMAGE=localhost/openstack/openstack-base:latest | ||
| FROM ${BASE_IMAGE} | ||
|
|
||
| LABEL summary="OpenStack RabbitMQ" \ | ||
| io.k8s.description="RabbitMQ messaging service for OpenStack" | ||
|
|
||
| RUN uid_gid_manage rabbitmq | ||
|
|
||
| COPY bindeps.txt /tmp/bindeps.txt | ||
| RUN pkgs=$(cat /tmp/bindeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \ | ||
| if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all && rm -rf /var/cache/dnf; fi && \ | ||
| rm /tmp/bindeps.txt && \ | ||
| rm -f /etc/rabbitmq/rabbitmq.conf | ||
|
|
||
| COPY scripts/extend_start.sh /usr/local/bin/kolla_extend_start | ||
| RUN chmod 755 /usr/local/bin/kolla_extend_start | ||
|
|
||
| USER rabbitmq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| hostname | ||
| rabbitmq-server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases | ||
| # of the KOLLA_BOOTSTRAP variable being set, including empty. | ||
| if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then | ||
|
|
||
| # NOTE(sbezverk): In kubernetes environment, if this file exists from previous | ||
| # bootstrap, the system does not allow to overwrite it (it bootstrap files with | ||
| # permission denied error) but it allows to delete it and then recreate it. | ||
| if [[ -e "/var/lib/rabbitmq/.erlang.cookie" ]]; then | ||
| rm -f /var/lib/rabbitmq/.erlang.cookie | ||
| fi | ||
| echo "${RABBITMQ_CLUSTER_COOKIE}" > /var/lib/rabbitmq/.erlang.cookie | ||
| chmod 400 /var/lib/rabbitmq/.erlang.cookie | ||
| exit 0 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ARG BASE_IMAGE=localhost/openstack/openstack-base:latest | ||
| FROM ${BASE_IMAGE} | ||
|
|
||
| LABEL summary="OpenStack Redis (Valkey)" \ | ||
| io.k8s.description="Valkey (Redis-compatible) caching and messaging service for OpenStack" | ||
|
|
||
| RUN uid_gid_manage valkey | ||
|
|
||
| COPY bindeps.txt /tmp/bindeps.txt | ||
| RUN pkgs=$(cat /tmp/bindeps.txt | grep -v '^#' | grep -v '^$' | tr '\n' ' ') && \ | ||
| if [ -n "${pkgs}" ]; then microdnf -y install ${pkgs} && microdnf clean all && rm -rf /var/cache/dnf; fi && \ | ||
| rm /tmp/bindeps.txt | ||
|
|
||
| USER valkey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| procps-ng | ||
| valkey |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We will need some additional changes in build.sh to manage rpm-only images. We need to make sure that update-sources commands works fine i.e. when there are projects without sources.txt, etc...