Skip to content

feat: add make crc-* targets for OpenShift Local deployment#1174

Closed
Gkrumbach07 wants to merge 2 commits into
mainfrom
feature/add-crc-makefile-targets
Closed

feat: add make crc-* targets for OpenShift Local deployment#1174
Gkrumbach07 wants to merge 2 commits into
mainfrom
feature/add-crc-makefile-targets

Conversation

@Gkrumbach07

@Gkrumbach07 Gkrumbach07 commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds new make crc-* targets to provide a clear way to deploy and manage local OpenShift (CRC) environments. This addresses the retirement of make local-* targets by providing explicit CRC deployment commands.

Changes

New Makefile Targets

  • make crc-up: Start CRC cluster and deploy the platform

    • Configurable via CRC_CPUS, CRC_MEMORY, CRC_DISK, CRC_PROJECT_NAME
    • Calls components/scripts/local-dev/crc-start.sh
  • make crc-down: Stop CRC deployments (keep cluster running)

    • Preserves cluster for faster restarts
  • make crc-clean: Full cleanup including CRC cluster

    • Deletes project and stops cluster
  • make crc-status: Show CRC cluster and deployment status

    • Reports cluster state and deployment health
  • make crc-test: Run CRC environment tests

    • Calls components/scripts/local-dev/crc-test.sh
  • make crc-rebuild: Rebuild and redeploy all components

    • Rebuilds backend, frontend, and operator via OpenShift BuildConfigs
    • Restarts deployments with new images
  • make crc-logs: Show logs from all CRC components (follow mode)

  • make crc-logs-backend: Backend logs only

  • make crc-logs-frontend: Frontend logs only

  • make crc-logs-operator: Operator logs only

Configuration Variables

CRC_CPUS ?= 4              # Number of CPUs for CRC VM
CRC_MEMORY ?= 11264        # Memory in MB (default: 11GB)
CRC_DISK ?= 50             # Disk size in GB
CRC_PROJECT_NAME ?= vteam-dev  # OpenShift project name

Design Decisions

  1. Mirror kind-* pattern: The new targets follow the same naming and structure as existing kind-* targets for consistency
  2. Leverage existing scripts: Reuses battle-tested scripts in components/scripts/local-dev/
  3. No breaking changes: Doesn't modify existing targets or behavior
  4. Clear separation: Provides explicit CRC targets distinct from deprecated local-* targets

Testing

Verified with:

make help | grep crc     # Targets show in help
make -n crc-status       # Dry-run executes correctly

Related Issues

Checklist

  • Added new CRC targets to Makefile
  • Added .PHONY declarations
  • Added configuration variables
  • Targets follow existing patterns (kind-*)
  • Help text is clear and informative
  • No breaking changes to existing targets

Note: This PR introduces the Makefile targets only. The underlying CRC scripts (crc-start.sh, crc-stop.sh, crc-test.sh) already exist in components/scripts/local-dev/.

Summary by CodeRabbit

  • New Features
    • Added Make commands for managing a local development cluster: start, stop, clean, status, test, rebuild, and component-specific logging
    • Introduced configurable local-cluster resource parameters (CPU, memory, disk) with sensible defaults
    • Improved observability with per-component and aggregated log viewing options

Add new `make crc-*` targets to provide a clear way to deploy
and manage local OpenShift (CRC) environments.

New targets:
- crc-up: Start CRC cluster and deploy the platform
- crc-down: Stop CRC deployments (keep cluster running)
- crc-clean: Full cleanup including CRC cluster
- crc-status: Show CRC cluster and deployment status
- crc-test: Run CRC environment tests
- crc-rebuild: Rebuild and redeploy all components
- crc-logs: Show logs from all components
- crc-logs-backend: Backend logs only
- crc-logs-frontend: Frontend logs only
- crc-logs-operator: Operator logs only

These targets use existing CRC scripts in
components/scripts/local-dev/ and mirror the functionality
of the kind-* targets for consistency.

Configuration variables:
- CRC_CPUS (default: 4)
- CRC_MEMORY (default: 11264 MB)
- CRC_DISK (default: 50 GB)
- CRC_PROJECT_NAME (default: vteam-dev)

Resolves #1116

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds new Makefile targets for OpenShift Local (CRC) lifecycle, testing, rebuilding, and logs, and introduces CRC configuration variables (CRC_CPUS, CRC_MEMORY, CRC_DISK, CRC_PROJECT_NAME) with defaults; targets call local scripts and oc to manage builds, deployments, and cluster state.

Changes

Cohort / File(s) Summary
CRC Make targets & config
Makefile
Added .PHONY CRC targets: crc-up, crc-down, crc-clean, crc-status, crc-test, crc-rebuild, crc-logs, crc-logs-backend, crc-logs-frontend, crc-logs-operator. Introduced CRC vars with defaults (CRC_CPUS ?= 4, CRC_MEMORY ?= 11264, CRC_DISK ?= 50, CRC_PROJECT_NAME ?= vteam-dev). Targets invoke components/scripts/local-dev/crc-*.sh, use CRC_*/PROJECT_NAME env vars, perform oc start-build/oc rollout restart for backend/frontend/operator, and use oc logs -f/label selectors for streaming logs.
🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title follows Conventional Commits format (feat scope: description) and accurately summarizes the main change: adding CRC-related Makefile targets.
Linked Issues check ✅ Passed All coding requirements from #1116 are met: explicit make crc-* targets (crc-up, crc-down, crc-clean, crc-status, crc-test, crc-rebuild, crc-logs variants) for OpenShift Local deployment.
Out of Scope Changes check ✅ Passed All changes are scoped to Makefile targets and configuration variables for CRC management; no unrelated modifications present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Performance And Algorithmic Complexity ✅ Passed Makefile changes contain only operational orchestration targets with hardcoded sequential calls and single-scope queries; no performance regressions detected.
Security And Secret Handling ✅ Passed Makefile CRC targets contain no hardcoded secrets, tokens, or passwords. Variable expansion is safe from injection, authentication checked via oc whoami, and no sensitive data leakage patterns detected.
Kubernetes Resource Safety ✅ Passed The Kubernetes Resource Safety check is not applicable to this pull request. The PR exclusively modifies the Makefile to add shell command targets for CRC orchestration; it does not introduce, modify, or deploy any Kubernetes resources.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/add-crc-makefile-targets
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature/add-crc-makefile-targets

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

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Makefile`:
- Around line 1050-1053: The crc-clean Makefile target calls
components/scripts/local-dev/crc-stop.sh with CLI flags but the script reads
STOP_CLUSTER and DELETE_PROJECT environment variables; update the crc-clean
recipe (target "crc-clean") to export or prefix the call with STOP_CLUSTER=true
and DELETE_PROJECT=true (and keep PROJECT_NAME=$(CRC_PROJECT_NAME)) so the
script sees these env vars (e.g., PROJECT_NAME=$(CRC_PROJECT_NAME)
STOP_CLUSTER=true DELETE_PROJECT=true bash
components/scripts/local-dev/crc-stop.sh --stop-cluster --delete-project should
be replaced with PROJECT_NAME=$(CRC_PROJECT_NAME) STOP_CLUSTER=true
DELETE_PROJECT=true bash components/scripts/local-dev/crc-stop.sh).
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6fabee80-a97a-41b7-99f0-b1d8dc266be0

📥 Commits

Reviewing files that changed from the base of the PR and between 703a6f5 and a7ffbec.

📒 Files selected for processing (1)
  • Makefile

Comment thread Makefile
…rc-clean

The crc-stop.sh script reads STOP_CLUSTER and DELETE_PROJECT as
environment variables. Use env var prefixes instead of CLI flags
for consistency and clarity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Makefile`:
- Around line 1077-1096: The crc-rebuild target currently only checks oc
authentication and swallows failures, so it may run against the wrong OpenShift
cluster and still print success; update the crc-rebuild recipe to (1) verify the
active server is the local CRC cluster (e.g. use oc whoami --show-server or
inspect oc config current-context/server and compare against the expected CRC
host) before proceeding and fail early if it doesn't match, and (2) stop
suppressing errors from oc start-build and oc rollout restart (remove the "||
echo …" and "|| true" fallbacks) so the Make target exits non-zero on build or
restart failures and does not print the final success message unless all steps
succeed (adjust the final echo to only run on success).
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0eed4065-5df4-48a3-9399-c3450678dcdf

📥 Commits

Reviewing files that changed from the base of the PR and between a7ffbec and 0ec6c63.

📒 Files selected for processing (1)
  • Makefile

Comment thread Makefile
Comment on lines +1077 to +1096
crc-rebuild: ## Rebuild and redeploy all components in CRC
@echo "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding all components..."
@if ! oc whoami >/dev/null 2>&1; then \
echo "$(COLOR_RED)✗$(COLOR_RESET) Not logged into OpenShift. Run 'make crc-up' first."; \
exit 1; \
fi
@echo "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding backend..."
@oc start-build vteam-backend --from-dir=components/backend --wait -n $(CRC_PROJECT_NAME) || \
echo "$(COLOR_YELLOW)Backend build failed (may need to create BuildConfig first)$(COLOR_RESET)"
@echo "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding frontend..."
@oc start-build vteam-frontend --from-dir=components/frontend --wait -n $(CRC_PROJECT_NAME) || \
echo "$(COLOR_YELLOW)Frontend build failed (may need to create BuildConfig first)$(COLOR_RESET)"
@echo "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding operator..."
@oc start-build vteam-operator --from-dir=components/operator --wait -n $(CRC_PROJECT_NAME) || \
echo "$(COLOR_YELLOW)Operator build failed (may need to create BuildConfig first)$(COLOR_RESET)"
@echo "$(COLOR_BLUE)▶$(COLOR_RESET) Restarting deployments..."
@oc rollout restart deployment/vteam-backend -n $(CRC_PROJECT_NAME) 2>/dev/null || true
@oc rollout restart deployment/vteam-frontend -n $(CRC_PROJECT_NAME) 2>/dev/null || true
@oc rollout restart deployment/vteam-operator -n $(CRC_PROJECT_NAME) 2>/dev/null || true
@echo "$(COLOR_GREEN)✓$(COLOR_RESET) All components rebuilt and restarted"

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.

⚠️ Potential issue | 🔴 Critical

crc-rebuild can hit the wrong cluster and still report success.

This target only checks that oc is authenticated, not that the active server is the local CRC cluster, so the build/restart calls can run against any logged-in OpenShift environment. On top of that, Lines 1084-1095 swallow failures with || echo / || true, so the recipe can print a green success message even when rebuilds or rollouts failed.

Suggested fix
 crc-rebuild: ## Rebuild and redeploy all components in CRC
 	`@echo` "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding all components..."
 	`@if` ! oc whoami >/dev/null 2>&1; then \
 		echo "$(COLOR_RED)✗$(COLOR_RESET) Not logged into OpenShift. Run 'make crc-up' first."; \
 		exit 1; \
 	fi
-	`@echo` "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding backend..."
-	`@oc` start-build vteam-backend --from-dir=components/backend --wait -n $(CRC_PROJECT_NAME) || \
-		echo "$(COLOR_YELLOW)Backend build failed (may need to create BuildConfig first)$(COLOR_RESET)"
-	`@echo` "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding frontend..."
-	`@oc` start-build vteam-frontend --from-dir=components/frontend --wait -n $(CRC_PROJECT_NAME) || \
-		echo "$(COLOR_YELLOW)Frontend build failed (may need to create BuildConfig first)$(COLOR_RESET)"
-	`@echo` "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding operator..."
-	`@oc` start-build vteam-operator --from-dir=components/operator --wait -n $(CRC_PROJECT_NAME) || \
-		echo "$(COLOR_YELLOW)Operator build failed (may need to create BuildConfig first)$(COLOR_RESET)"
-	`@echo` "$(COLOR_BLUE)▶$(COLOR_RESET) Restarting deployments..."
-	`@oc` rollout restart deployment/vteam-backend -n $(CRC_PROJECT_NAME) 2>/dev/null || true
-	`@oc` rollout restart deployment/vteam-frontend -n $(CRC_PROJECT_NAME) 2>/dev/null || true
-	`@oc` rollout restart deployment/vteam-operator -n $(CRC_PROJECT_NAME) 2>/dev/null || true
+	`@SERVER`=$$(oc whoami --show-server 2>/dev/null || true); \
+	case "$$SERVER" in \
+		*crc*) ;; \
+		*) echo "$(COLOR_RED)✗$(COLOR_RESET) Current oc target is not the local CRC cluster: $$SERVER"; exit 1 ;; \
+	esac
+	`@set` -e; \
+	echo "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding backend..."; \
+	oc start-build vteam-backend --from-dir=components/backend --wait -n $(CRC_PROJECT_NAME); \
+	echo "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding frontend..."; \
+	oc start-build vteam-frontend --from-dir=components/frontend --wait -n $(CRC_PROJECT_NAME); \
+	echo "$(COLOR_BLUE)▶$(COLOR_RESET) Rebuilding operator..."; \
+	oc start-build vteam-operator --from-dir=components/operator --wait -n $(CRC_PROJECT_NAME); \
+	echo "$(COLOR_BLUE)▶$(COLOR_RESET) Restarting deployments..."; \
+	oc rollout restart deployment/vteam-backend -n $(CRC_PROJECT_NAME); \
+	oc rollout restart deployment/vteam-frontend -n $(CRC_PROJECT_NAME); \
+	oc rollout restart deployment/vteam-operator -n $(CRC_PROJECT_NAME)
 	`@echo` "$(COLOR_GREEN)✓$(COLOR_RESET) All components rebuilt and restarted"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 1077 - 1096, The crc-rebuild target currently only
checks oc authentication and swallows failures, so it may run against the wrong
OpenShift cluster and still print success; update the crc-rebuild recipe to (1)
verify the active server is the local CRC cluster (e.g. use oc whoami
--show-server or inspect oc config current-context/server and compare against
the expected CRC host) before proceeding and fail early if it doesn't match, and
(2) stop suppressing errors from oc start-build and oc rollout restart (remove
the "|| echo …" and "|| true" fallbacks) so the Make target exits non-zero on
build or restart failures and does not print the final success message unless
all steps succeed (adjust the final echo to only run on success).

@Gkrumbach07 Gkrumbach07 closed this Apr 2, 2026
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.

add new "make crc-*" targets

1 participant