Uploaded image for project: 'Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces) '
  1. Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces)
  2. CRW-4856

Port conflict between kubernetes and container component

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • Fixed in DevSpaces 3.10

      When defining a kubernetes component in a devfile you can define an endpoint with a target port.
      If this port is already used by a container component (for inner loop) then it conflicts and the workspace is not created.
      Innerloop development and Outerloop development are two different phases in the lifecycle of a component/application and it would make sense if they were running on the same target port. They would also not be running on the same pod, so it would make sense they should be able to run on the same target port.

      The workaround is to change the targetPort to 8081 instead of 8080 and change the image built to listen to that new port....
      This has been fixed for odo and the devfile API:
      https://github.com/devfile/api/issues/1049

      While I understand that odo and devspaces are different beast I don't understand how different services (outerloop / innerloop) can't have the save port.

      For example in WildFly devfile I use the unversal-developer-image to build an run my application on port 8080 so I have defined that endpoint on the container:

      name: tools
          container:
            image:  quay.io/devfile/universal-developer-image:ubi8-latest
      ....
            endpoints:
              - name: debug
                exposure: internal
                protocol: tcp
                targetPort: 5005
              - name: 'http'
                protocol: http
                targetPort: 8080
                exposure: public
      ....
      

      but since I also plan on being able to deploy the resulting application image on the cloud I have :

      - name: kubernetes-deploy
          kubernetes:
            endpoints:
              - name: http-8080
                path: /
                targetPort: 8080
            uri: deploy.yaml
      

      the workaround is to define

      - name: kubernetes-deploy
          kubernetes:
            endpoints:
              - name: http-8081
                path: /
                targetPort: 8081
            uri: deploy.yaml
      

      which means also to change the deploy.yaml to use the port 8081 and the listening port for Wildfly in the resulting image.

              aobuchow Andrew Obuchowicz (Inactive)
              ehugonne1@redhat.com Emmanuel Hugonnet
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: