fix: prefer KUBECONFIG over in-cluster config for k8s client#1012
fix: prefer KUBECONFIG over in-cluster config for k8s client#1012sradco wants to merge 1 commit into
Conversation
The server previously used rest.InClusterConfig() exclusively, which fails in CI where the test step pod runs on the build cluster while KUBECONFIG points to the provisioned test cluster. This caused the e2e-management-api tests to get 404 errors because the management routes could not be registered without a working k8s connection. Introduce loadKubeConfig() that prefers KUBECONFIG when set (for CI and local development) and falls back to in-cluster config (for production deployments). Signed-off-by: Shirly Radco <sradco@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
|
/retest |
|
/test images |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: PeterYurkovich, sradco The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
@sradco: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
loadKubeConfig()that prefers KUBECONFIG when set (CI/local dev) and falls back to in-cluster config (production)rest.InClusterConfig()exclusively, which connects to the build cluster in CI rather than the provisioned test cluster where PrometheusRule CRDs existRoot Cause
The CI step
monitoring-plugin-tests-management-apiruns on the build cluster (build01) with KUBECONFIG pointing to the provisioned test cluster. The server usedrest.InClusterConfig()which connected to the wrong cluster.Additionally, the CI step script in openshift/release was missing the
-features='alert-management-api'flag (fix submitted separately).Test plan
go build ./...passesgo test ./pkg/... ./internal/...passesgo vet ./...passesMade with Cursor