Skip to content
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

Use legacy routes if subdomain is too long #1702

Merged
merged 1 commit into from Jun 9, 2023

Conversation

dkwon17
Copy link
Contributor

@dkwon17 dkwon17 commented Jun 9, 2023

What does this PR do?

Valid subdomains for ingresses/routes must have a length of 63 or less. This PR verifies that the subdomain for public endpoints are a valid.

If the subdomain is not valid, legacy subdomain is being used

For example, the following ingress/route hostname is invalid:

http://a-very-long-username-test-stg-quarkus-api-example-4dek-code-redirect-1.apps.che-example.gb17.p1.openshiftapps.com

in this case, the legacy version will be used:

http://workspace2ed73a1ed86746b0-1.apps.che-example.gb17.p1.openshiftapps.com

Screenshot/screencast of this PR

What issues does this PR fix or reference?

How to test this PR?

Image: quay.io/dkwon17/che-operator:legacyHostname

To test this PR,

  1. Create a workspace with https://github.com/che-incubator/quarkus-api-example
  2. After workspace starts verify that the user-friendly route is being used by checking that a route named <workspaceId>-tools-8080-list-all-food exists with a spec.host of <username>.<wkspname>.list-all-food.<INGRESS-DOMAIN>
  3. In the workspace's defile rename the list-all-food endpoint in the tools container to an endpoint name of 63 characters
          endpoints:
            - exposure: none
              name: debug
              protocol: tcp
              targetPort: 5005
            - exposure: public
              name:  a-loooooooooooooooooooooooooooooooooooooooooooooooooooooog-name
              path: /food
              protocol: http
              targetPort: 8080
  1. Start the workspace. The workspace should start successfully
  2. Verify that there is a route named <workspaceId>-tools-8080-<endpointname> with a spec.host that follows the legacy format:
workspace2ed73a1ed86746b0-4.apps.sandbox-m2.ll9k.p1.openshiftapps.com

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.

Signed-off-by: David Kwon <dakwon@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Jun 9, 2023

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

@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Merging #1702 (baed1e8) into main (9e25018) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1702      +/-   ##
==========================================
+ Coverage   60.18%   60.21%   +0.02%     
==========================================
  Files          71       71              
  Lines        8430     8436       +6     
==========================================
+ Hits         5074     5080       +6     
  Misses       3008     3008              
  Partials      348      348              
Impacted Files Coverage Δ
controllers/devworkspace/solver/che_routing.go 78.44% <100.00%> (+0.03%) ⬆️
...ntrollers/devworkspace/solver/endpoint_strategy.go 95.74% <100.00%> (+0.50%) ⬆️

@openshift-ci
Copy link

openshift-ci bot commented Jun 9, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dkwon17, tolusha

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

@dkwon17
Copy link
Contributor Author

dkwon17 commented Jun 9, 2023

Thank you @tolusha, I will merge once the checks pass

@dkwon17
Copy link
Contributor Author

dkwon17 commented Jun 9, 2023

/retest

@dkwon17 dkwon17 merged commit 977d6bd into eclipse-che:main Jun 9, 2023
23 checks passed
@devstudio-release
Copy link

Build 3.8 :: operator_3.x/250: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.8 :: operator_3.x/250: SUCCESS

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

@devstudio-release
Copy link

Build 3.8 :: copyIIBsToQuay/1489: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.8 :: sync-to-downstream_3.x/3648: SUCCESS

Build container: devspaces-operator-bundle synced; /DS_CI/get-sources-rhpkg-container-build_3.x/3490 triggered; /job/DS_CI/job/dsc_3.x triggered;

@devstudio-release
Copy link

Build 3.8 :: operator-bundle_3.x/1515: SUCCESS

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

@devstudio-release
Copy link

Build 3.8 :: dsc_3.x/1026: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.8 :: update-digests_3.x/3441: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.8 :: update-digests_3.x/3441: UNSTABLE

No new images detected: nothing to do!

@devstudio-release
Copy link

Build 3.8 :: dsc_3.x/1026: SUCCESS

3.8.0 CI

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.8 :: copyIIBsToQuay/1490: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.8 :: sync-to-downstream_3.x/3650: SUCCESS

Build container: devspaces-operator-bundle synced; /DS_CI/get-sources-rhpkg-container-build_3.x/3492 triggered; /job/DS_CI/job/dsc_3.x triggered;

@devstudio-release
Copy link

Build 3.8 :: operator-bundle_3.x/1516: SUCCESS

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

@devstudio-release
Copy link

Build 3.8 :: dsc_3.x/1027: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.8 :: dsc_3.x/1027: SUCCESS

3.8.0 CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants