Skip to content

Run Copr infrastructure with podman kube play#4100

Open
nikromen wants to merge 1 commit into
fedora-copr:mainfrom
nikromen:kubernetes
Open

Run Copr infrastructure with podman kube play#4100
nikromen wants to merge 1 commit into
fedora-copr:mainfrom
nikromen:kubernetes

Conversation

@nikromen
Copy link
Copy Markdown
Member

@nikromen nikromen commented Jan 5, 2026

I know this is a really long PR :/, this is summary what is capable of:

Run the full Copr infrastructure locally with a single command. All services (frontend, backend, distgit, keygen, database, redis, resalloc, pulp) deploy as pods via podman kube play with Kustomize overlays.

Four deployment modes: just up - latest development packages from @copr/copr-dev; just up-release - stable Fedora RPMs just up-pr 3127 - test a specific pull request just up-local - live editing with host source code mounted

See other operational helpful commands by running just help

Per-service ConfigMaps for easy configuration without image rebuilds. Multiple Kustomize overlays (base, dev, dev-local) for different use cases.

Beaker integration test environment included - run the full test suite against the local stack via setup-local-copr.sh.

Designed as the foundation for the possibility of future OpenShift deployment.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an impressive and comprehensive setup for running the COPR infrastructure locally using podman kube play. The use of an orchestration script, detailed Containerfiles, and Kubernetes manifests is a great step towards modernizing the development environment. My review focuses on enhancing security, maintainability, and robustness. Key areas for improvement include removing hardcoded secrets, reducing container privileges, and simplifying complex commands within manifests and container definitions. While this is a work-in-progress, addressing these points will establish a more secure and maintainable foundation for local COPR development.

Comment thread podman-kube/containers/frontend/files/etc/copr/copr.conf Outdated
Comment thread podman-kube/manifests/copr-all.yaml Outdated
Comment thread podman-kube/manifests/copr-all.yaml Outdated
Comment thread kube-deploy/containers/database/rootfs/init-db.sh
Comment thread podman-kube/containers/builder/Containerfile Outdated
Comment thread podman-kube/containers/keygen/Containerfile Outdated
Comment thread podman-kube/containers/keygen/Containerfile Outdated
Comment thread podman-kube/containers/resalloc/Containerfile Outdated
Comment thread podman-kube/manifests/copr-all.yaml Outdated
Comment thread podman-kube/containers/backend-httpd/files/nginx.conf Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 5, 2026

Pull Request validation

Failed

🔴 Review - Missing review from a member (2 required)

Success

🟢 CI - All checks have passed

@nikromen nikromen force-pushed the kubernetes branch 3 times, most recently from c728efc to 3dd5d35 Compare January 6, 2026 01:35
@nikromen nikromen closed this Apr 27, 2026
@nikromen
Copy link
Copy Markdown
Member Author

whoops, missclick

@nikromen nikromen reopened this Apr 27, 2026
@nikromen nikromen marked this pull request as ready for review May 12, 2026 09:11
@nikromen
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive local deployment environment for the COPR infrastructure using podman kube play and Kubernetes manifests, supported by a justfile for automation and updated beaker test configurations. Feedback identifies a fragile DNS resolver detection in the backend HTTP server, a destructive database re-initialization policy on version mismatches, overly broad database user permissions, and a syntax error in the DistGit Apache configuration.


ENTRYPOINT []
# TODO: fix this resolver substitution, this is ugly hack
CMD ["sh", "-c", "RESOLVER=$(awk '/^nameserver/{print $2; exit}' /etc/resolv.conf) && sed -i \"s/__RESOLVER__/${RESOLVER}/g\" /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The resolver detection is fragile. If /etc/resolv.conf does not contain a nameserver entry (which can happen in some container environments), the RESOLVER variable will be empty. This results in an invalid Nginx configuration (resolver valid=30s ...), causing the container to fail at startup. Consider adding a check or a fallback DNS server.

CMD ["sh", "-c", "RESOLVER=$(awk '/^nameserver/{print $2; exit}' /etc/resolv.conf); if [ -z \"$RESOLVER\" ]; then echo 'ERROR: No nameserver found in /etc/resolv.conf' >&2; exit 1; fi; sed -i \"s|__RESOLVER__|${RESOLVER}|g\" /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'"]

if [ "$EXISTING_VERSION" != "$CURRENT_VERSION" ]; then
echo "WARNING: Data version ($EXISTING_VERSION) doesn't match PostgreSQL version ($CURRENT_VERSION)"
echo "Cleaning old data and reinitializing..."
rm -rf "$PGDATA"/*
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Automatically wiping the database data directory on a version mismatch is very destructive. While this is a development environment, it might lead to unexpected data loss if a user accidentally upgrades their container image. It would be safer to exit with an error message instructing the user to manually clear the volume if they wish to reinitialize.

psql -c "CREATE USER \"$POSTGRESQL_USER\" WITH PASSWORD '$POSTGRESQL_PASSWORD';"
psql -c "CREATE DATABASE \"$POSTGRESQL_DATABASE\" OWNER \"$POSTGRESQL_USER\" ENCODING 'UTF-8';"
psql -c "GRANT ALL PRIVILEGES ON DATABASE \"$POSTGRESQL_DATABASE\" TO \"$POSTGRESQL_USER\";"
psql -c "ALTER USER \"$POSTGRESQL_USER\" WITH SUPERUSER;" # alembic migrations
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Granting SUPERUSER privileges to the application user ($POSTGRESQL_USER) is a security risk, even in a development environment. While Alembic migrations might require elevated permissions for certain operations (like creating extensions), it is better to grant only the necessary privileges or run migrations as a separate, more privileged user.


RUN set -ex && \
rm -f /etc/httpd/conf.d/ssl.conf && \
echo 'AliasMatch "/repo(/.*)/md5(/.*)\" "/var/lib/dist-git/cache/lookaside\$1\$2"' >> /etc/httpd/conf.d/dist-git/lookaside-copr.conf && \
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

There is a typo in the AliasMatch directive. The trailing \" inside the single quotes will result in a literal backslash and double quote in the Apache configuration, which will cause the regex to fail to match standard Copr URLs.

    echo 'AliasMatch "/repo(/.*)/md5(/.*)" "/var/lib/dist-git/cache/lookaside$1$2"' >> /etc/httpd/conf.d/dist-git/lookaside-copr.conf && \

@nikromen
Copy link
Copy Markdown
Member Author

/packit test

@praiskup
Copy link
Copy Markdown
Member

/packit test

@nikromen
Copy link
Copy Markdown
Member Author

/packit test

1 similar comment
@nikromen
Copy link
Copy Markdown
Member Author

/packit test

@nikromen
Copy link
Copy Markdown
Member Author

/packit test

@praiskup
Copy link
Copy Markdown
Member

praiskup commented May 26, 2026

Can we have a better name of the directory rather than deployment? I'm sure people would confuse it with some real deployment of Copr. edit: kube-deploy?

@nikromen
Copy link
Copy Markdown
Member Author

could be, eventually I would want to merge this with openshift deployment and see whether and when we could possibly migrate to it, but that is big if... it could be renamed later then

@nikromen
Copy link
Copy Markdown
Member Author

/packit test

@FrostyX
Copy link
Copy Markdown
Member

FrostyX commented May 26, 2026

I am not -1 on the PR because it is a self-contained change that doesn't affect anything else. But the fact that we cannot call it kubernetes because we have one already, is IMHO a clear sign that we are not doing things correctly.

I hope that one day we will be able to refactor all of our deployment methods and share as much between them as possible. Now that I think about it, I think I had the same rant about the single machine testing-farm deployment.

@nikromen
Copy link
Copy Markdown
Member Author

I want this one day to swallow kubernetes and openshift. But since it is not yet ready I can't.

But I think we probably can delete the kubernetes - it was once created by someone who maintained his own copr stack and used it for their purposes - not by us. I think it is deprecated though and it can be deleted? Perhaps I should ask them

Comment thread beaker-tests/DockerTestEnv/setup-local-copr.sh Outdated
username = $USERNAME
token = $API_TOKEN
copr_url = $COPR_URL
encrypted = $ENCRYPTED
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I scratched my head, and opened #4328 :-)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ack, let's handle this separately in #4328.

Comment thread beaker-tests/Sanity/copr-cli-basic-operations/helpers Outdated
Comment thread testing-farm/all-on-single-host.sh
Run the full Copr infrastructure locally with a single command. All services (frontend, backend,
distgit, keygen, database, redis, resalloc, pulp) deploy as pods via podman kube play with
Kustomize overlays.

Four deployment modes: just up - latest development packages from @copr/copr-dev;
just up-release - stable Fedora RPMs just up-pr 3127 - test a specific pull request
just up-local - live editing with host source code mounted

See other operational helpful commands by running just help

Per-service ConfigMaps for easy configuration without image rebuilds. Multiple Kustomize
overlays (base, dev, dev-local) for different use cases.

Beaker integration test environment included - run the full test suite against the local
stack via setup-local-copr.sh.

Designed as the foundation for the possibility of future OpenShift deployment.
@nikromen
Copy link
Copy Markdown
Member Author

nikromen commented Jun 1, 2026

I am going to run tests (also locally against kube) to investigate whether anything is broken by my latest change

/packit test

@nikromen
Copy link
Copy Markdown
Member Author

nikromen commented Jun 1, 2026

both tests seems to work, @praiskup PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants