Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-10385

Openshift 4 + FMP: DefaultKubernetesClient cannot be cast to OpenShiftClient

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • fuse-7.4-GA
    • fuse-7.3
    • Examples
    • None
    • Fuse 7.4 Sprint 47 - Bug Fix

      By default, fmp can't detect Openshift 4 but instead use Kubernetes mode. With forcing it to openshift with -Dfabric8.mode=openshift it fails.

      [22/03/19 14:42:12] ~/R/x/f/spring-boot-camel ❯❯❯ mvn clean fabric8:deploy -Dfabric8.generator.from=registry.access.redhat.com/fuse7/fuse-java-openshift:1.2-6 -Dfabric8.mode=openshift              tags/spring-boot-camel-1.0.0.fuse-730033
      [INFO] Scanning for projects...
      [INFO]
      [INFO] --------------< io.fabric8.quickstarts:spring-boot-camel >--------------
      [INFO] Building Fabric8 :: Quickstarts :: Spring-Boot :: Camel 1.0.0.fuse-730033
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ spring-boot-camel ---
      [INFO] Deleting /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target
      [INFO]
      [INFO] >>> fabric8-maven-plugin:7.3.0.fuse-730044:deploy (default-cli) > install @ spring-boot-camel >>>
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ spring-boot-camel ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 3 resources
      [INFO]
      [INFO] --- fabric8-maven-plugin:7.3.0.fuse-730044:resource (default) @ spring-boot-camel ---
      [INFO] F8: Running in OpenShift mode
      [INFO] F8: Using docker image name of namespace: llowinge
      [INFO] F8: Running generator spring-boot
      [INFO] F8: spring-boot: Using ImageStreamTag 'fuse-java-openshift:1.2-6' from namespace 'fuse7' as builder image
      [INFO] F8: using resource templates from /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/src/main/fabric8
      [INFO] F8: fmp-service: Adding a default service 'spring-boot-camel' with ports [8080]
      [INFO] F8: spring-boot-health-check: Adding readiness probe on port 8081, path='/health', scheme='HTTP', with initial delay 10 seconds
      [INFO] F8: spring-boot-health-check: Adding liveness probe on port 8081, path='/health', scheme='HTTP', with initial delay 180 seconds
      [INFO] F8: f8-service-discovery: Using first mentioned service port '8080'
      [INFO] F8: fmp-revision-history: Adding revision history limit to 2
      [INFO] F8: f8-icon: Adding icon for deployment
      [INFO] F8: f8-icon: Adding icon for service
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/classes/META-INF/fabric8/openshift/spring-boot-camel-svc.yml resource
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/classes/META-INF/fabric8/openshift/spring-boot-camel-deploymentconfig.yml resource
      [WARNING] F8: Invalid Resource : /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/classes/META-INF/fabric8/openshift/spring-boot-camel-deploymentconfig.yml
      [message=.spec.template.spec.containers[0].resources.requests.cpu: string found, object expected, violation type=type]
      [message=.spec.template.spec.containers[0].resources.limits.cpu: string found, object expected, violation type=type]
      [message=.spec.template.spec.containers[0].resources.limits.memory: string found, object expected, violation type=type]
      [message=.spec.template.spec.containers[0].resources.requests.memory: string found, object expected, violation type=type]
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/classes/META-INF/fabric8/kubernetes/spring-boot-camel-svc.yml resource
      [INFO] F8: validating /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/classes/META-INF/fabric8/kubernetes/spring-boot-camel-deployment.yml resource
      [WARNING] F8: Invalid Resource : /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/classes/META-INF/fabric8/kubernetes/spring-boot-camel-deployment.yml
      [message=.spec.template.spec.containers[0].resources.limits.memory: string found, object expected, violation type=type]
      [message=.spec.template.spec.containers[0].resources.requests.memory: string found, object expected, violation type=type]
      [message=.spec.template.spec.containers[0].resources.limits.cpu: string found, object expected, violation type=type]
      [message=.spec.template.spec.containers[0].resources.requests.cpu: string found, object expected, violation type=type]
      [INFO]
      [INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) @ spring-boot-camel ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/classes
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ spring-boot-camel ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/src/test/resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.6.0:testCompile (default-testCompile) @ spring-boot-camel ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/test-classes
      [INFO]
      [INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ spring-boot-camel ---
      [INFO]
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ spring-boot-camel ---
      [INFO] Building jar: /Users/llowinge/Redhat/xpaas/fabric8-quickstarts/spring-boot-camel/target/spring-boot-camel-1.0.0.fuse-730033.jar
      [INFO]
      [INFO] --- spring-boot-maven-plugin:7.3.0.fuse-730044:repackage (default) @ spring-boot-camel ---
      [INFO]
      [INFO] --- fabric8-maven-plugin:7.3.0.fuse-730044:build (default) @ spring-boot-camel ---
      [INFO] F8: Using OpenShift build with strategy S2I
      [INFO] F8: Running generator spring-boot
      [INFO] F8: spring-boot: Using ImageStreamTag 'fuse-java-openshift:1.2-6' from namespace 'fuse7' as builder image
      [ERROR] F8: Failed to execute the build [io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to io.fabric8.openshift.client.OpenShiftClient]
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 7.624 s
      [INFO] Finished at: 2019-03-22T14:42:20+01:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.jboss.redhat-fuse:fabric8-maven-plugin:7.3.0.fuse-730044:build (default) on project spring-boot-camel: Failed to execute the build: io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to io.fabric8.openshift.client.OpenShiftClient -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      

              rnetuka@redhat.com Radovan Netuka
              llowinge@redhat.com Lukas Lowinger
              Lukas Lowinger Lukas Lowinger
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: