Skip to content

feat : Add support to add Service annotations from DevWorkspaceRouting configuration (#1293) #1439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rohanKanojia
Copy link
Contributor

@rohanKanojia rohanKanojia commented May 29, 2025

What does this PR do?

Add support for adding Service annotations from DevWorkspace component configuration to actual Service created by DevWorkspace operator

  • Add new field service that contains annotation field for storing annotations in DevWorkspaceRouting CustomResourceDefinition
  • Update code to read DevWorkspace component service annotation to DevWorkspaceRouting service configuration and apply these annotations while creating routing objects in DevWorkspaceRouting controller
  • Removes references to service annotations from the unsupported Devfile API documentation
  • Remove the webhook warning when applying service annotations

Signed-off-by: Rohan Kumar [email protected]

What issues does this PR fix or reference?

Fix #1293

Is it tested? How?

  • Make sure CRC cluster is running
  • Install DWO on cluster based on changes added in this PR. You'd need to create new container image and install operator
export DWO_IMG=quay.io/rokumar/devworkspace-controller:dev
make docker
make install
  • Apply the following DevWorkspace object, that adds one endpoint exposes by a Service. There is also configuration for adding annotations in Service:
kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: plain-dw-endpoint-annotations
spec:
  started: true
  routingClass: 'basic'
  template:
    components:
      - name: web-terminal
        container:
          image: quay.io/wto/web-terminal-tooling:next
          memoryRequest: 256Mi
          memoryLimit: 512Mi
          mountSources: true
          command:
           - "tail"
           - "-f"
           - "/dev/null"
          annotation:
            service:
              first-service-annotation: test
              second-service-annotation: test2
          endpoints:
          - name: endpoint-1
            targetPort: 8080
            protocol: http
            annotation:
              first-endpoint-annotation: test1
              second-endpoint-annotation: test2  
  • Once the workspace has started, check the created Service, annotations specified in should be applied there
oc get svc workspaceaf104799e6fb4633-service -ojsonpath='{.metadata.annotations}'
{"first-service-annotation":"test","second-service-annotation":"test2"}

PR Checklist

  • E2E tests pass (when PR is ready, comment /test v8-devworkspace-operator-e2e, v8-che-happy-path to trigger)
    • v8-devworkspace-operator-e2e: DevWorkspace e2e test
    • v8-che-happy-path: Happy path for verification integration with Che

Copy link

openshift-ci bot commented May 29, 2025

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

Copy link

openshift-ci bot commented May 29, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rohanKanojia
Once this PR has been reviewed and has the lgtm label, please assign dkwon17 for approval. For more information see the Code Review Process.

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

@rohanKanojia rohanKanojia force-pushed the pr/issue1293 branch 5 times, most recently from abfb699 to 708d590 Compare May 29, 2025 10:21
@rohanKanojia
Copy link
Contributor Author

/ok-to-test

@rohanKanojia rohanKanojia force-pushed the pr/issue1293 branch 2 times, most recently from 53ca871 to 2c63671 Compare May 29, 2025 13:58
@rohanKanojia
Copy link
Contributor Author

/ok-to-test

@rohanKanojia rohanKanojia marked this pull request as ready for review May 29, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Service Annotations to the DevWorkspaceRouting CRD
1 participant