che-operator icon indicating copy to clipboard operation
che-operator copied to clipboard

Support Devfile endpoint annotations in Che Router

Open AObuchow opened this issue 1 year ago • 5 comments

What does this PR do?

  • Imports the latest DevWorkspaceRouting (DWR) API, which adds endpoint annotations coming from the devfile
  • Adds the DWR endpoint annotations as annotations for the route (on OpenShift) or ingresse (on Kubernetes) created by the Che Router for a given endpoint

There are a few additional changes made in this PR that are not meant to be merged (though the Che-Operator repo devfile changes may be desirable):

  • Importing a forked version of DWO into the go.mod until https://github.com/devfile/devworkspace-operator/pull/1297 is merged and DWO 0.31 upstream is released
  • Using per-workspace storage as well as the UDI in the Che-Operator devfile. This was helpful for developing this patch in Che.
  • Installing a forked version of DWO using an index image built from https://github.com/devfile/devworkspace-operator/pull/1297

Screenshot/screencast of this PR

n/a

What issues does this PR fix or reference?

Fix eclipse-che/che#23064

How to test this PR?

  1. Install DWO built from this PR, as well as Che-Operator built from the current PR onto your cluster.
  • On OpenShift, this can easily be done by running ./build/scripts/olm/test-catalog-from-sources.sh from the root of this repo.
  • On minikube/kubernetes, you'll have to:
    1. Build DWO: From the root of the DWO repo run export DWO_IMG=quay.io/<username>/devworkspace-controller:endpoint-annotations && make docker (or just use my image: export DWO_IMG=quay.io/<username>/devworkspace-controller:endpoint-annotations-implementation )
    2. Install DWO: make install_cert_manager && make install
    3. Build Che-Operator: make docker-build docker-push IMG=<YOUR_OPERATOR_IMAGE>
    4. Install Che: chectl server:deploy -p minikube --che-operator-image=<YOUR_OPERATOR_IMAGE>
  1. Once both DWO and Che are installed onto your cluster, verify there's a Che Cluster CR instance created so that you can access the Che User dashboard
  2. From the Che User Dashboard, create a workspace with a devfile that defines endpoints with annotations, such as this one.
      endpoints:
        - name: https-python
          targetPort: 8080
          protocol: https
          annotation:
            my-annotation: test
            another-annotation: test2
  1. Once the workspace has started up, verify the routes & ingresses for the endpoint(s) with annotations have the expected annotations from the devfile. In my example devfile, your <workspaceid>-py-8080-https-python route/ingress should have my-annotation: test & another-annotation: test2, as shown below:
kind: Route
apiVersion: route.openshift.io/v1
metadata:
  annotations:
+    another-annotation: test2
    che.routing.controller.devfile.io/component-name: py
    che.routing.controller.devfile.io/endpoint-name: https-python
+    my-annotation: test
  resourceVersion: '48291'
  name: workspace4b929cbc569a4473-py-8080-https-python
(...)
  namespace: che-kube-admin-che-rwxo67
  ownerReferences:
    - apiVersion: controller.devfile.io/v1alpha1
      kind: DevWorkspaceRouting
      name: routing-workspace4b929cbc569a4473
      uid: 497a6df3-9e14-47f8-9fc6-33acfda6df77
      controller: true
      blockOwnerDeletion: true
  labels:
    app.kubernetes.io/part-of: che.eclipse.org
    controller.devfile.io/devworkspace_id: workspace4b929cbc569a4473
spec:
(...)

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

AObuchow avatar Aug 13 '24 03:08 AObuchow

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

openshift-ci[bot] avatar Aug 13 '24 03:08 openshift-ci[bot]

@tolusha Though this PR is still a draft, it should be good for review if you want to take a look already. In order for this PR to no longer be a draft, we'll need to release DWO 0.31.0, and I'll update this PR to pull in the latest version of DWO

AObuchow avatar Aug 27 '24 17:08 AObuchow

Sounds good for me

tolusha avatar Aug 28 '24 14:08 tolusha

@tolusha the DWO 0.31.0 release is currently in progress. Once it's released, I will update this PR and it will be ready for review :)

AObuchow avatar Sep 12 '24 14:09 AObuchow

@tolusha this PR is finally ready for review now that DWO 0.31.0 is being used in Che-Operator :)

AObuchow avatar Sep 19 '24 14:09 AObuchow

@tolusha by the way, if you end up wanting the devfile changes, I'll rewrite the commit messages for them (since they're currently marked as "do not merge").

AObuchow avatar Sep 19 '24 15:09 AObuchow

/retest-required

AObuchow avatar Sep 19 '24 15:09 AObuchow

/retest-required

AObuchow avatar Sep 19 '24 16:09 AObuchow

/retest-required

AObuchow avatar Sep 19 '24 17:09 AObuchow

Not sure why the pro v14-che-behind-proxy test is failing, though it seems unrelated to this PR:

INFO[2024-09-19T17:04:27Z] Logs for container test in pod che-behind-proxy-ipi-conf-aws-blackholenetwork: 
INFO[2024-09-19T17:04:27Z] 
An error occurred (AlreadyExistsException) when calling the CreateStack operation: Stack [ci-op-mfqq3b2j-9dadd-shared-vpc-blackhole] already exists
{"component":"entrypoint","error":"wrapped process failed: exit status 254","file":"sigs.k8s.io/prow/pkg/entrypoint/run.go:84","func":"sigs.k8s.io/prow/pkg/entrypoint.Options.internalRun","level":"error","msg":"Error executing test process","severity":"error","time":"2024-09-19T17:04:27Z"}
error: failed to execute wrapped command: exit status 254 
INFO[2024-09-19T17:04:27Z] Step che-behind-proxy-ipi-conf-aws-blackholenetwork failed after 9s. 
(...)
INFO[2024-09-19T17:06:58Z] Ran for 4m36s                                
ERRO[2024-09-19T17:06:58Z] Some steps failed:                           
ERRO[2024-09-19T17:06:58Z] 
  * could not run steps: step che-behind-proxy failed: "che-behind-proxy" pre steps failed: "che-behind-proxy" pod "che-behind-proxy-ipi-conf-aws-blackholenetwork" failed: could not watch pod: the pod ci-op-mfqq3b2j/che-behind-proxy-ipi-conf-aws-blackholenetwork failed after 7s (failed containers: test): ContainerFailed one or more containers exited
Container test exited with code 254, reason Error
---
An error occurred (AlreadyExistsException) when calling the CreateStack operation: Stack [ci-op-mfqq3b2j-9dadd-shared-vpc-blackhole] already exists
{"component":"entrypoint","error":"wrapped process failed: exit status 254","file":"sigs.k8s.io/prow/pkg/entrypoint/run.go:84","func":"sigs.k8s.io/prow/pkg/entrypoint.Options.internalRun","level":"error","msg":"Error executing test process","severity":"error","time":"2024-09-19T17:04:27Z"}
error: failed to execute wrapped command: exit status 254
--- 

AObuchow avatar Sep 19 '24 18:09 AObuchow

/retest

ibuziuk avatar Sep 20 '24 13:09 ibuziuk

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: AObuchow, dkwon17, ibuziuk

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

Needs approval from an approver in each of these files:

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] avatar Sep 23 '24 17:09 openshift-ci[bot]

New changes are detected. LGTM label has been removed.

openshift-ci[bot] avatar Sep 23 '24 18:09 openshift-ci[bot]

/retest-required

AObuchow avatar Sep 23 '24 18:09 AObuchow

/retest-required

AObuchow avatar Sep 23 '24 19:09 AObuchow

/retest-required

AObuchow avatar Sep 23 '24 19:09 AObuchow

/retest-required

AObuchow avatar Sep 23 '24 20:09 AObuchow

@AObuchow: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/v14-che-behind-proxy c0afbf96b8d80c2e9e58f0f353359eea68a46e78 link true /test v14-che-behind-proxy

Full PR test history. Your PR dashboard.

Instructions 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.

openshift-ci[bot] avatar Sep 23 '24 21:09 openshift-ci[bot]

Build 3.17 :: operator_3.x/404: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/7729 triggered

devstudio-release avatar Sep 23 '24 23:09 devstudio-release