Minikube integration test#781
Conversation
Reviewer's GuideAdds an end-to-end Minikube integration workflow that builds and deploys the operator into a local Minikube cluster, provisions required infra (PostgreSQL, Keycloak), applies a dedicated test CR, and verifies the operator’s reconciliation behavior both locally via a Makefile target and in CI via a GitHub Actions workflow. Sequence diagram for GitHub Actions Minikube E2E workflowsequenceDiagram
participant GHA as GitHub_Actions_workflow
participant MK as Minikube_cluster
participant K8S as Kubernetes_API
participant HELM as Helm
participant OP as Operator_controller_manager
GHA->>GHA: actions/checkout
GHA->>GHA: setup-go
GHA->>MK: setup-minikube (driver docker)
MK-->>GHA: cluster_running
GHA->>MK: eval minikube docker-env
GHA->>MK: make docker-build IMG=localhost/rhtpa-operator:e2e
GHA->>K8S: create namespace e2e-test
GHA->>HELM: helm repo add bitnami/postgresql
GHA->>HELM: helm install postgresql (no persistence)
HELM->>K8S: create PostgreSQL resources
GHA->>K8S: apply Keycloak manifest
GHA->>K8S: wait deployment/keycloak available
GHA->>K8S: make install (apply CRDs)
GHA->>K8S: make deploy IMG=localhost/rhtpa-operator:e2e
GHA->>K8S: patch operator imagePullPolicy=Never
GHA->>K8S: wait operator deployment available
K8S->>OP: start operator pod
GHA->>K8S: apply TrustedProfileAnalyzer CR
K8S->>OP: watch CR events
OP->>K8S: create migrate-db job
OP->>K8S: create server deployment
OP->>K8S: create server service
OP->>K8S: create server ConfigMap
OP->>K8S: create PVC storage
GHA->>K8S: poll for deployment/server existence
K8S-->>GHA: server deployment found
GHA->>K8S: wait job/migrate-db complete
GHA->>K8S: wait deployment/server available
GHA->>K8S: verify CR status and child resources
GHA->>K8S: check operator pod restartCount
alt failure
GHA->>K8S: collect logs and diagnostics
end
Flow diagram for local Makefile target e2e-minikubeflowchart TD
A["make e2e-minikube"] --> B{"minikube status OK?"}
B -->|no| C["Print 'Minikube is not running' and exit 1"]
B -->|yes| D["eval $(minikube docker-env)"]
D --> E["make docker-build IMG=localhost/rhtpa-operator:e2e BUILDER=docker"]
E --> F["make install (apply CRDs)"]
F --> G["make deploy IMG=localhost/rhtpa-operator:e2e"]
G --> H["kubectl patch rhtpa-operator-controller-manager imagePullPolicy=Never"]
H --> I["kubectl rollout status rhtpa-operator-controller-manager"]
I --> J["Echo 'Operator deployed. Deploy infrastructure and apply test CR to complete e2e setup.'"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The imagePullPolicy patch for the controller manager is duplicated in both the Makefile target and the GitHub Action; consider centralizing this (e.g., via a kustomize overlay or a shared script) to avoid drift.
- Several values are hard-coded in the workflow and fixtures (e.g., namespaces
e2e-test, passwords, Keycloak and PostgreSQL configuration); consider parameterizing these via env vars or workflow inputs so they’re easier to adjust across environments.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The imagePullPolicy patch for the controller manager is duplicated in both the Makefile target and the GitHub Action; consider centralizing this (e.g., via a kustomize overlay or a shared script) to avoid drift.
- Several values are hard-coded in the workflow and fixtures (e.g., namespaces `e2e-test`, passwords, Keycloak and PostgreSQL configuration); consider parameterizing these via env vars or workflow inputs so they’re easier to adjust across environments.
## Individual Comments
### Comment 1
<location path=".github/workflows/e2e-minikube.yml" line_range="69-78" />
<code_context>
+ - name: Install CRDs
+ run: make install
+
+ - name: Deploy operator
+ run: |
+ make deploy IMG=localhost/rhtpa-operator:e2e
+ kubectl -n rhtpa-operator-system patch deployment rhtpa-operator-controller-manager \
+ --type='json' \
+ -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "Never"}]'
+ kubectl -n rhtpa-operator-system rollout status deployment/rhtpa-operator-controller-manager --timeout=120s
+
+ - name: Create TrustedProfileAnalyzer CR
</code_context>
<issue_to_address>
**suggestion:** Avoid duplicating operator build/deploy and imagePullPolicy logic between Makefile and workflow.
This workflow duplicates the `e2e-minikube` Makefile target (image build, deploy, and `imagePullPolicy` patch). To avoid drift, call that Makefile target from the workflow so deployment changes are centralized.
```suggestion
- name: Build and deploy operator (Makefile e2e-minikube target)
run: make e2e-minikube
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| - name: Install CRDs | ||
| run: make install | ||
|
|
||
| - name: Deploy operator | ||
| run: | | ||
| make deploy IMG=localhost/rhtpa-operator:e2e | ||
| kubectl -n rhtpa-operator-system patch deployment rhtpa-operator-controller-manager \ | ||
| --type='json' \ | ||
| -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "Never"}]' | ||
| kubectl -n rhtpa-operator-system rollout status deployment/rhtpa-operator-controller-manager --timeout=120s |
There was a problem hiding this comment.
suggestion: Avoid duplicating operator build/deploy and imagePullPolicy logic between Makefile and workflow.
This workflow duplicates the e2e-minikube Makefile target (image build, deploy, and imagePullPolicy patch). To avoid drift, call that Makefile target from the workflow so deployment changes are centralized.
| - name: Install CRDs | |
| run: make install | |
| - name: Deploy operator | |
| run: | | |
| make deploy IMG=localhost/rhtpa-operator:e2e | |
| kubectl -n rhtpa-operator-system patch deployment rhtpa-operator-controller-manager \ | |
| --type='json' \ | |
| -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/imagePullPolicy", "value": "Never"}]' | |
| kubectl -n rhtpa-operator-system rollout status deployment/rhtpa-operator-controller-manager --timeout=120s | |
| - name: Build and deploy operator (Makefile e2e-minikube target) | |
| run: make e2e-minikube |
Signed-off-by: desmax74 <mdessi@redhat.com>
Signed-off-by: desmax74 <mdessi@redhat.com>
Signed-off-by: desmax74 <mdessi@redhat.com>
Signed-off-by: desmax74 <mdessi@redhat.com>
Signed-off-by: desmax74 <mdessi@redhat.com>
Signed-off-by: desmax74 <mdessi@redhat.com>
Signed-off-by: desmax74 <mdessi@redhat.com>
Assisted-by: Claude: Opus 4.6
Summary by Sourcery
Add Minikube-based end-to-end integration testing for the operator and supporting fixtures.
New Features:
Tests: