devfile / devworkspace-operator

Apache License 2.0
59 stars 50 forks source link

chore: Update devfile/api dependency to v2.2.1 #1186

Closed AObuchow closed 8 months ago

AObuchow commented 8 months ago

What does this PR do?

Updates the devfile/api dependency to the v2.2.1 (commit https://github.com/devfile/api/commit/1ae41b52c5f2bea1031b16277666e1b6baa0358c). This is required for https://github.com/devfile/devworkspace-operator/issues/1179, as the devfile validation library was previously preventing a deworkspace from having a container component and openshift/kubernetes component from using the same target port on an endpoint.

I also added a controller env test to test the case from https://github.com/devfile/devworkspace-operator/issues/1179, but this might be redundant as this functionality should already be tested in the devfile API repo.

What issues does this PR fix or reference?

https://github.com/devfile/devworkspace-operator/issues/1179

Is it tested? How?

Install DWO with the changes from this PR, and create a devworkspace with a container component and kubernetes (or openshift) component that uses the same endpoint target port, such as the following:

kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: plain-devworkspace
spec:
  started: true
  routingClass: 'basic'
  template:
    components:
      - name: kubernetes-deploy
        kubernetes:
          deployByDefault: true
          endpoints:
            - name: http-8080
              path: /
              targetPort: 8080
          inlined: |
            apiVersion: v1
            kind: Pod
            metadata:
              name: webserver-dwo-deployed
              namespace: devworkspace-controller
            spec:
              containers:
                - name: webserver
                  image: nginx:latest
                  ports:
                    - containerPort: 8080
      - name: web-terminal
        container:
          image: quay.io/wto/web-terminal-tooling:next
          memoryRequest: 256Mi
          memoryLimit: 512Mi
          mountSources: true
          command:
           - "tail"
           - "-f"
           - "/dev/null"
          endpoints:
            - name: 'http'
              protocol: http
              targetPort: 8080
              exposure: public

Ensure the workspace starts up as expected. You should see a pod get deployed to the devworkspace-controller namespace called webserver-dwo-deployed. The main thing to ensure is the workspace does not fail to startup with the following reason: * devfile contains multiple containers with same endpoint targetPort: 8080

PR Checklist

openshift-ci[bot] commented 8 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, AObuchow

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/devfile/devworkspace-operator/blob/main/OWNERS)~~ [amisevsk] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
openshift-ci[bot] commented 8 months ago

New changes are detected. LGTM label has been removed.

AObuchow commented 8 months ago

/retest

codecov[bot] commented 8 months ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (b12f682) 52.90% compared to head (bdac5e8) 53.10%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1186 +/- ## ========================================== + Coverage 52.90% 53.10% +0.19% ========================================== Files 84 84 Lines 7551 7551 ========================================== + Hits 3995 4010 +15 + Misses 3273 3259 -14 + Partials 283 282 -1 ``` [see 2 files with indirect coverage changes](https://app.codecov.io/gh/devfile/devworkspace-operator/pull/1186/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=devfile)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.