-
Notifications
You must be signed in to change notification settings - Fork 55
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
Fail DevWorkspaces when DevWorkspaceRouting controller sees error #1199
Conversation
Mark DevWorkspaceRoutings as failed if any of the sync operations returns an UnrecoverableSyncError rather than ignoring it and treating it as a transient error (i.e. retrying). This allows workspaces to fail with a meaningful message more quickly, rather than waiting for timeout and failing then. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me and works as expected for the provided test-case on service creation.
I also tested this for routes (on OpenShift) and ingresses on minikube, and the workspaces failed as expected.
For all tests, I used created 2 workspaces based on the following devworkspace:
kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: endpoint-1
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"
endpoints:
- name: 'http'
protocol: http
targetPort: 8080
attributes:
discoverable: true
exposure: public
Routes
I used the following resource quota:
kind: ResourceQuota
apiVersion: v1
metadata:
name: routes-quota
namespace: default
spec:
hard:
count/routes.route.openshift.io: '1'
status:
hard:
count/routes.route.openshift.io: '1'
The second devworkspace failed as expected:
$ kubectl get dw -w
NAME DEVWORKSPACE ID PHASE INFO
endpoint-1 workspace7144cffb567f4a35 Running Workspace is running
endpoint-2 workspace5604dcd5bb8a403f Failed Failed to set up networking for workspace: routes.route.openshift.io "workspace5604dcd5bb8a403f-http" is forbidden: exce
eded quota: routes-quota, requested: count/routes.route.openshift.io=1, used: count/routes.route.openshift.io=1, limited: count/routes.route.openshift.io=1
Ingresses
I used the following resource quota:
kind: ResourceQuota
apiVersion: v1
metadata:
name: ingresses-quota
spec:
hard:
count/ingresses: '1'
The second devworkspace failed accordingly:
$ kubectl get dw
NAME DEVWORKSPACE ID PHASE INFO
endpoint-1 workspace590265b135274cb0 Running Workspace is running
endpoint-2 workspacef99194ee40f24e11 Failed Failed to set up networking for workspace: ingresses.networking.k8s.io "workspacef99194ee40f24e11-http" is forbidden: ex
ceeded quota: ingresses-quota, requested: count/ingresses.networking.k8s.io=1, used: count/ingresses.networking.k8s.io=1, limited: count/ingresses.networking.k8s.io=1
The Check sources GitHub action is failing due to a DWR test-case I wrote that was abusing the bug that this PR addresses. IMO we should just remove the @amisevsk let me know if you'd like me to add an extra commit to the PR for this. |
Drop devworkspacerouting reconciler test for "gets preparing status", as this test relied on a bug (403 forbidden responses to API calls were ignored) in the controller. Since there's no good way to create a 'preparing' DevWorkspaceRouting, we can't test this specific function. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
[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:
Approvers can indicate their approval by writing |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1199 +/- ##
==========================================
- Coverage 53.01% 52.89% -0.13%
==========================================
Files 84 84
Lines 7583 7595 +12
==========================================
- Hits 4020 4017 -3
- Misses 3275 3290 +15
Partials 288 288
☔ View full report in Codecov by Sentry. |
What does this PR do?
Mark DevWorkspaceRoutings as failed if any of the sync operations returns an UnrecoverableSyncError rather than ignoring it and treating it as a transient error (i.e. retrying).
This allows workspaces to fail with a meaningful message more quickly, rather than waiting for timeout and failing then.
What issues does this PR fix or reference?
Closes #1198
Is it tested? How?
To test, create a resource quota, then create workspaces that would violate that quota and ensure they fail.
For example, for services,
We should verify that such quotas are respected for routes and ingresses as well, as applicable.
PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che