{"record":{"id":"936067e07d8d925f","repo":"quarkusio/quarkus","slug":"openshift-was-requested-as-a-deployment-but-the-t","errorCode":null,"errorMessage":"Openshift was requested as a deployment, but the target cluster is not an Openshift cluster!","messagePattern":"Openshift was requested as a deployment, but the target cluster is not an Openshift cluster!","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftDeployer.java","lineNumber":32,"sourceCode":"import io.quarkus.kubernetes.spi.KubernetesDeploymentClusterBuildItem;\n\npublic class OpenshiftDeployer {\n\n    @BuildStep\n    public void checkEnvironment(Optional<SelectedKubernetesDeploymentTargetBuildItem> selectedDeploymentTarget,\n            List<GeneratedKubernetesResourceBuildItem> resources,\n            KubernetesClientBuildItem kubernetesClientBuilder,\n            BuildProducer<KubernetesDeploymentClusterBuildItem> deploymentCluster) {\n        selectedDeploymentTarget.ifPresent(target -> {\n            if (!KubernetesDeploy.INSTANCE.checkSilently(kubernetesClientBuilder)) {\n                return;\n            }\n            if (target.getEntry().getName().equals(OPENSHIFT)) {\n                try (var openShiftClient = kubernetesClientBuilder.buildClient().adapt(OpenShiftClient.class)) {\n                    if (openShiftClient.hasApiGroup(\"openshift.io\", false)) {\n                        deploymentCluster.produce(new KubernetesDeploymentClusterBuildItem(OPENSHIFT));\n                    } else {\n                        throw new IllegalStateException(\n                                \"Openshift was requested as a deployment, but the target cluster is not an Openshift cluster!\");\n                    }\n                } catch (Exception e) {\n                    throw new RuntimeException(\n                            \"Failed to configure OpenShift. Make sure you have the Quarkus OpenShift extension.\", e);\n                }\n            }\n        });\n    }\n}\n","sourceCodeStart":14,"sourceCodeEnd":43,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftDeployer.java#L14-L43","documentation":"When OpenShift is listed as a deployment target, the deployer connects to the configured cluster and probes for the openshift.io API group to verify it is actually an OpenShift cluster. If the API group is absent, the target cluster is plain Kubernetes, and OpenShift-specific DeploymentConfigs cannot be applied, so the build fails with this IllegalStateException.","triggerScenarios":"quarkus.openshift.deploy=true (or openshift in quarkus.kubernetes.deployment-target) against a cluster that does not expose the openshift.io API group.","commonSituations":"Pointing quarkus.openshift.* config at a vanilla Kubernetes cluster (minikube, kind, EKS/GKE/AKS); KUBECONFIG/context pointing to the wrong cluster in CI.","solutions":["Point kubectl/client config at a real OpenShift cluster (oc login / correct KUBECONFIG context).","Switch the deployment target to kubernetes: quarkus.kubernetes.deployment-target=kubernetes if the cluster is vanilla Kubernetes.","Verify the cluster with 'kubectl get --raw /.well-known/openid-configuration' or check API groups; ensure the right context with 'kubectl config current-context'."],"exampleFix":"// before (target is plain Kubernetes)\nquarkus.kubernetes.deployment-target=openshift\n// after\nquarkus.kubernetes.deployment-target=kubernetes","handlingStrategy":"validation","validationCode":"// Probe the cluster's API groups before choosing the openshift deployment target\nboolean isOpenShift = client.getApiGroups().getGroups().stream()\n    .anyMatch(g -> g.getName().equals(\"openshift.io\"));\nif (!isOpenShift) {\n    System.setProperty(\"quarkus.kubernetes.deployment-target\", \"kubernetes\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    deploy();\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"target cluster is not an Openshift cluster\")) {\n        // fall back to vanilla kubernetes target\n        System.setProperty(\"quarkus.kubernetes.deployment-target\", \"kubernetes\");\n        deploy();\n    } else { throw e; }\n}","preventionTips":["Verify the cluster type (oc whoami / API group check) in CI before deploying.","Use separate config profiles per cluster type: %prod-k8s vs %prod-openshift.","Never point quarkus.openshift.* config at non-OpenShift clusters."],"tags":["kubernetes","openshift","cluster-mismatch","deployment"],"backgroundTag":"wrong-cluster-target","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}