Skip to content

feat: support OpenShift/CRC for local deploy - #967

Draft
maboras-rh wants to merge 4 commits into
jumpstarter-dev:mainfrom
maboras-rh:support-local-crc
Draft

feat: support OpenShift/CRC for local deploy#967
maboras-rh wants to merge 4 commits into
jumpstarter-dev:mainfrom
maboras-rh:support-local-crc

Conversation

@maboras-rh

Copy link
Copy Markdown
Contributor

Add OpenShift deploy support for controller and hack scripts

Summary

Add first-class OpenShift deployment support to the controller Makefile and hack deployment scripts so the operator and exporter-set controller can be deployed from a development workstation to OpenShift/CRC clusters.

Why

Local development on OpenShift/CRC requires a smooth deploy flow. Existing scripts assumed kind/k3s nodeport workflows and did not push images into the OpenShift internal registry or support OpenShift Routes.

Behavioral notes

  • OpenShift: local images are pushed to the cluster internal registry and manifests are adjusted to reference the pushed image.
  • Route networking (OpenShift): addresses are created without custom ports (OpenShift Routes listen on 443).
  • Kind/k3s flows remain unchanged.

Compatibility & risks

  • Backwards-compatible with kind/k3s clusters.
  • Requires an accessible OpenShift/CRC cluster.
  • Prerequisites: oc CLI and a container tool (podman/docker) with the locally-built image present and permissions to push to the cluster internal registry.

Signed-off-by: Mohamad Abo Ras <maboras@redhat.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8f578438-75c8-4158-afdc-91766c52ccf5

📥 Commits

Reviewing files that changed from the base of the PR and between 676140a and 4e8ff79.

📒 Files selected for processing (2)
  • controller/hack/deploy_vars
  • controller/hack/utils
🚧 Files skipped from review as they are similar to previous changes (2)
  • controller/hack/deploy_vars
  • controller/hack/utils

📝 Walkthrough

Walkthrough

Changes

The deployment tooling now supports OpenShift clusters. It detects OpenShift domains, configures HTTPS Routes, manages internal registry images, validates existing contexts, and skips local cluster lifecycle operations.

OpenShift deployment support

Layer / File(s) Summary
OpenShift cluster lifecycle support
controller/Makefile, controller/hack/utils
Cluster validation, context setup, creation, cleanup, and default networking now support openshift.
OpenShift domain and route deployment
controller/hack/deploy_vars, controller/hack/deploy_with_operator.sh
OpenShift deployments detect the cluster domain and configure controller, router, and login endpoints through HTTPS Routes.
OpenShift internal image registry
controller/hack/utils, controller/hack/deploy_with_operator.sh
Images are pushed to the OpenShift internal registry. The operator deployment receives the rewritten image reference.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant deploy_with_operator.sh
  participant OpenShift cluster
  participant OpenShift internal registry
  participant operator deployment
  deploy_with_operator.sh->>OpenShift cluster: set kubectl context
  deploy_with_operator.sh->>OpenShift cluster: detect domain and configure Routes
  deploy_with_operator.sh->>OpenShift internal registry: tag and push images
  OpenShift internal registry-->>deploy_with_operator.sh: return internal image references
  deploy_with_operator.sh->>operator deployment: patch operator image
Loading

Possibly related PRs

Poem

A rabbit found a route in the sun,
And pushed bright images, one by one.
The cluster domain now points the way,
While OpenShift guides deployment day.
“Hop safely!” the new scripts say.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding local OpenShift and CRC deployment support.
Description check ✅ Passed The description directly explains the OpenShift deployment changes, image handling, Route support, compatibility, and prerequisites.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch support-local-crc
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@controller/hack/deploy_vars`:
- Around line 5-18: Update the BASEDOMAIN calculation around the else branch so
get_external_ip is only invoked when BASEDOMAIN is unset. Preserve a
user-supplied BASEDOMAIN unchanged, including for OpenShift, and retain the
existing nip.io derivation for cases where it is not provided.

In `@controller/hack/utils`:
- Around line 256-258: The podman login command on line 256 always uses
hardcoded podman, but the tag and push commands on lines 257-258 use the
CONTAINER_TOOL variable which may resolve to a different container tool.
Different tools have different credential stores and may not support the same
flags like --tls-verify. Update the login command to use the same
${CONTAINER_TOOL:-podman} variable as the tag and push operations, or require
podman explicitly for all three operations if that is the intended design.
- Around line 256-258: Update the registry authentication and push commands
around podman login and podman push to use the OpenShift registry CA certificate
and keep TLS verification enabled. Remove the unconditional --tls-verify=false
usage, or gate it behind an explicit local-development option for CRC-only
scenarios while preserving secure behavior by default.
- Line 256: Update the podman login command in the sourced utility flow to avoid
exposing the OpenShift token: temporarily disable shell xtrace while obtaining
and piping the token from oc whoami -t, restore the prior tracing state
afterward, and replace the -p argument with podman’s --password-stdin option.
- Around line 247-249: Update the image parsing logic near the name/tag
assignments to derive the repository name from the final path component before
splitting on its tag separator. Preserve registry ports and nested repository
paths, so images such as localhost:5000/team/controller:latest produce the
correct unique name and latest tag without collisions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f24b248b-fa2e-47fa-837c-9c5a3d207c3d

📥 Commits

Reviewing files that changed from the base of the PR and between ec6a62c and 676140a.

📒 Files selected for processing (4)
  • controller/Makefile
  • controller/hack/deploy_vars
  • controller/hack/deploy_with_operator.sh
  • controller/hack/utils

Comment thread controller/hack/deploy_vars
Comment thread controller/hack/utils Outdated
Comment thread controller/hack/utils Outdated
Comment thread controller/hack/utils Outdated
@maboras-rh
maboras-rh marked this pull request as draft August 4, 2026 09:22
@maboras-rh

maboras-rh commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

I've created this PR for draft change.
@mangelajo please have a look, and let me know if this could be needed

FYI - @bennyz @bkhizgiy @evakhoni @raballew

Comment thread controller/hack/deploy_vars Outdated
# domain (e.g. apps-crc.testing), so we detect it instead of using a nip.io
# domain derived from the local outbound IP.
if [ -z "${BASEDOMAIN:-}" ] && [ "${CLUSTER_TYPE}" == "openshift" ]; then
OPENSHIFT_CLUSTER_DOMAIN=$(kubectl get ingresses.config.openshift.io cluster -o jsonpath='{.spec.domain}' 2>/dev/null || true)

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.

nice, this can also be useful for real openshift clusters as well.

Comment thread controller/hack/utils
export NETWORKING_MODE=${NETWORKING_MODE:-nodeport}
# OpenShift has no NodePort-friendly local port mapping, so Routes are the natural default there.
if [ "${CLUSTER_TYPE}" = "openshift" ]; then
export NETWORKING_MODE=${NETWORKING_MODE:-route}

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 was about to ask for this on the changes above, but it's handled here :-)

Comment thread controller/hack/utils Outdated
Comment thread controller/hack/utils Outdated
Comment thread controller/hack/utils
openshift_registry_host() {
if [ -z "${_OPENSHIFT_REGISTRY_HOST:-}" ]; then
kubectl patch configs.imageregistry.operator.openshift.io/cluster \
--type=merge -p '{"spec":{"defaultRoute":true}}' > /dev/null

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.

We would enable the registry route even on a a real openshift, probably we should print a warning to let the user know. This would mostly be used in throw-away clusters... but I'd try to warn at least.

@maboras-rh maboras-rh Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ack, added a warning print before patching the registry route 4e8ff79

@maboras-rh

Copy link
Copy Markdown
Contributor Author

#967 (comment)
Per the CRC networking docs (https://crc.dev/docs/networking/#setting-up-on-a-remote-server), CRC uses standard ports 80/443 for the OpenShift Router (Routes), so this won't be an issue for CRC.

That said, the image parsing fix is valid, it's about source image references with registry ports (e.g. localhost:5000/team/controller:latest), not about the route port. fixed by parsing the leaf path component instead of splitting on the first colon

@maboras-rh

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants