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

"Preparing ingresses" - Issue syncing the code-redirect-2 ingress preventing startup #22667

Closed
guydog28 opened this issue Nov 9, 2023 · 25 comments
Assignees
Labels
area/devworkspace-operator kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.

Comments

@guydog28
Copy link

guydog28 commented Nov 9, 2023

Describe the bug

Using vanilla kubernetes with ingress-nginx and a custom devfile that has a tools container using the quay.io/devfile/universal-developer-image image, there are consistent issues in the operator syncing the ingress that, at least in my logs, shows as {workspacepodname}-{containername}-13132-code-redirect-2. ingress-nginx install by default comes with a validation admission webhook that errors on this and because it keeps repeating makes the workspace keep retrying "Preparing ingresses" and not progress. Here is the error I see repeated in the logs for the che-operator:

2023-11-06T22:41:21Z	ERROR	controllers.DevWorkspaceRouting	Error syncing ingresses	{"Request.Namespace": "che-ws-username", "Request.Name": "routing-workspace06cfe21141354d6c", "devworkspace_id": "workspace06cfe21141354d6c", "error": "admission webhook \"validate.nginx.ingress.kubernetes.io\" denied the request: host \"workspace06cfe21141354d6c-8.mydomain.com\" and path \"/\" is already defined in ingress che-ws-username/workspace06cfe21141354d6c-tools-13132-code-redirect-2"}
github.com/devfile/devworkspace-operator/controllers/controller/devworkspacerouting.(*DevWorkspaceRoutingReconciler).Reconcile
	/che-operator/vendor/github.com/devfile/devworkspace-operator/controllers/controller/devworkspacerouting/devworkspacerouting_controller.go:209
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:122
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:323
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:274
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:235

The only way I could get past this was to delete admission webhook, to see if I could get my workspace to start, and it does start now, but I now see these errors in the che operator logs instead and it causes a slower workspace startup, with "Preparing ingresses" flashing over and over but eventually progresses to start:

2023-11-07T13:52:21Z	ERROR	Reconciler error	{"controller": "devworkspacerouting", "controllerGroup": "controller.devfile.io", "controllerKind": "DevWorkspaceRouting", "DevWorkspaceRouting": {"name":"routing-workspace06cfe21141354d6c","namespace":"che-ws-username"}, "namespace": "che-ws-username", "name": "routing-workspace06cfe21141354d6c", "reconcileID": "0f2d9ce3-c086-43e5-8193-c6d38e0aaf2e", "error": "Operation cannot be fulfilled on devworkspaceroutings.controller.devfile.io \"routing-workspace06cfe21141354d6c\": the object has been modified; please apply your changes to the latest version and try again"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:329
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:274
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:235

What would causes this? I would prefer not to have to delete this admission webhook for the whole cluster just to get our che workspace up and running.

Che version

7.75@latest

Steps to reproduce

  1. Install EKS Cluster
  2. Install ingress-nginx helm chart
  3. Install DW operator and CRDs for 0.23.0
  4. Install che operator helm chart
  5. Create CheCluster custom resource (nothing super special here)
  6. create a DW that has a tools container listed first with image quay.io/devfile/universal-developer-image image
  7. add some other containers like nginx or similar (likely optional but gets closer to our devfile)
  8. Observe issue

Expected behavior

No issues syncing ingresses

Runtime

Kubernetes (vanilla)

Screenshots

No response

Installation method

OperatorHub

Environment

Linux, Amazon

Eclipse Che Logs

No response

Additional context

No response

@guydog28 guydog28 added the kind/bug Outline of a bug - must adhere to the bug report template. label Nov 9, 2023
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Nov 9, 2023
@ibuziuk
Copy link
Member

ibuziuk commented Nov 13, 2023

@amisevsk @AObuchow could you please take a look?

@ibuziuk ibuziuk added severity/P1 Has a major impact to usage or development of the system. area/devworkspace-operator and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. labels Nov 13, 2023
@amisevsk
Copy link
Contributor

Hi @guydog28, could you share the following for your user namespace?

oc get ingresses -n che-ws-username -o yaml
oc get dwr -n che-ws-username -o yaml
oc get dw, dwt -n che-ws-username -o yaml

Feel free to redact parts of URLs/other information if it is considered sensitive

@tolusha
Copy link
Contributor

tolusha commented Nov 17, 2023

I've started facing the same issue on minikube when start a workspace the second time:

$ `oc  logs -n ingress-nginx ingress-nginx-controller-77669ff58-48x6t
...
13131-code-redirect-1" ingress="admin-che/workspace05ab7009780046f1-tooling-container-13131-code-redirect-1"
W1117 11:35:05.270445       7 controller.go:1018] Error obtaining Endpoints for Service "admin-che/workspaceb89ca3f404d541f1-service": no object matching key "admin-che/workspaceb89ca3f404d541f1-service" in local store
W1117 11:35:05.270519       7 controller.go:1112] Service "admin-che/workspace05ab7009780046f1-service" does not have any active Endpoint.
W1117 11:35:05.270571       7 controller.go:1333] Error getting SSL certificate "admin-che/workspaceb89ca3f404d541f1-endpoints": local SSL certificate admin-che/workspaceb89ca3f404d541f1-endpoints was not found. Using default certificate
E1117 11:35:05.270649       7 main.go:89] "invalid ingress configuration" err="host \"admin-vscode-code-redirect-1.192.168.59.254.nip.io\" and path \"/\" is already defined in ingress admin-che/workspaceb89ca3f404d541f1-tooling-container-13131-code-redirect-1" ingress="admin-che/workspace05ab7009780046f1-tooling-container-13131-code-redirect-1"

@amisevsk
Copy link
Contributor

I wasn't able to reproduce this issue on minikube v1.27.0 (ingress controller v1.2.1). To test, I started + restarted the Go workspace a few times.

@tolusha
Copy link
Contributor

tolusha commented Nov 27, 2023

When I bump into the issue next time, I will provide additional info.

@guydog28
Copy link
Author

This continues to be a problem for us. Even though I disabled the admission controller, for some workspaces the operator is constantly trying to update the ingresses in a never ending loop. This includes the 3 default endpoints and 3 of ours (we have many more that don't seem to be an issue. See the patterns in the logs when running kubectl -n dev-username-namespace get ingress -w:

workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-2.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m51s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-6.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m51s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-7.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m51s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-8.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-10.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-2.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-3.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-4.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-7.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-12.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-3.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-8.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-10.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-11.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-12.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-6.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-7.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-8.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-10.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-13.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-1.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-4.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-9.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m52s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-10.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-11.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-6.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-8.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-4.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-7.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-11.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-12.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-13.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-3.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-10.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-11.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-12.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-1.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-2.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-3.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-4.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-13.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-1.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-3.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m53s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-4.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-5.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-4.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-8.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-11.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-12.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-13.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-3.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-5.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-10.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-11.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-12.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-7.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-8.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-9.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-12.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-13.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-2.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-3.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-4.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-5.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-monstache-8181-monstache      <none>   workspacea9a0497336ae43ff-8.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-3.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-4.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-5.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-6.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-elastic-9200-es-client        <none>   workspacea9a0497336ae43ff-2.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-9.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-10.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-11.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m55s

Similar issues in the operator logs:

2024-01-17T19:49:17Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-elastic-9200-es-client"}
2024-01-17T19:49:17Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13131-code-redirect-1"}
2024-01-17T19:49:17Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13132-code-redirect-2"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13133-code-redirect-3"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-monstache-8181-monstache"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Ingresses not in sync	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "devworkspace_id": "workspacea9a0497336ae43ff"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Reconciling DevWorkspaceRouting	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "devworkspace_id": "workspacea9a0497336ae43ff"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-elastic-9200-es-client"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13131-code-redirect-1"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13132-code-redirect-2"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13133-code-redirect-3"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Ingresses not in sync	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "devworkspace_id": "workspacea9a0497336ae43ff"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Reconciling DevWorkspaceRouting	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "devworkspace_id": "workspacea9a0497336ae43ff"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-elastic-9200-es-client"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13131-code-redirect-1"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13132-code-redirect-2"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Updated object	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "kind": "v1.Ingress", "name": "workspacea9a0497336ae43ff-tools-13133-code-redirect-3"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Ingresses not in sync	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "devworkspace_id": "workspacea9a0497336ae43ff"}
2024-01-17T19:49:18Z	ERROR	Reconciler error	{"controller": "devworkspacerouting", "controllerGroup": "controller.devfile.io", "controllerKind": "DevWorkspaceRouting", "DevWorkspaceRouting": {"name":"routing-workspacea9a0497336ae43ff","namespace":"dev-username-namespace"}, "namespace": "dev-username-namespace", "name": "routing-workspacea9a0497336ae43ff", "reconcileID": "804e9bc5-ce76-4330-8eb1-38942fad934a", "error": "Operation cannot be fulfilled on devworkspaceroutings.controller.devfile.io \"routing-workspacea9a0497336ae43ff\": the object has been modified; please apply your changes to the latest version and try again"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:329
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:274
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
	/che-operator/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:235
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Reconciling DevWorkspaceRouting	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "devworkspace_id": "workspacea9a0497336ae43ff"}
2024-01-17T19:49:18Z	INFO	controllers.DevWorkspaceRouting	Reconciling DevWorkspaceRouting	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "devworkspace_id": "workspacea9a0497336ae43ff"}
2024-01-17T19:50:11Z	INFO	controllers.DevWorkspaceRouting	Reconciling DevWorkspaceRouting	{"Request.Namespace": "dev-username-namespace", "Request.Name": "routing-workspacea9a0497336ae43ff", "devworkspace_id": "workspacea9a0497336ae43ff"}

We have a large team using this and it is really causing a problem. It seems like maybe two different things are trying to modify the workspace object? is this possible?

@guydog28
Copy link
Author

I would like to add one more detail. Our cluster shuts down (nodes only) at 8pm every night to conserve resources during off hours. Is there any way there could be stale data stored somewhere that needs to be cleaned up causing these issues?

@amisevsk
Copy link
Contributor

You could try checking the managedFields section of the ingresses in question; everything making a change should mark which fields its controlling.

Apart from that, are there somehow two che-operators running in the cluster? What is the update it's stuck on (i.e. what field is being changed repeatedly)?

@guydog28
Copy link
Author

guydog28 commented Jan 17, 2024

managedFields isn't there. But I do see that it is "owned" by a devworkspacerouting object.

The operators currently being used are:

namespace: eclipse-che, operator: che-operator (7.79.0) [same issue was had with 7.77 and 7.75]
namespace: devworkspace-controller, operator: devworkspace-controller-manager (quay.io/devfile/devworkspace-controller:v0.23.0)

@guydog28
Copy link
Author

actually, here are the managedFields of one of the code-redirect ingresses:

managedFields:
    - manager: nginx-ingress-controller
      operation: Update
      apiVersion: networking.k8s.io/v1
      time: '2024-01-17T20:37:21Z'
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          f:loadBalancer:
            f:ingress: {}
      subresource: status
    - manager: manager
      operation: Update
      apiVersion: networking.k8s.io/v1
      time: '2024-01-17T20:48:22Z'
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:che.routing.controller.devfile.io/component-name: {}
            f:che.routing.controller.devfile.io/endpoint-name: {}
            f:kubernetes.io/ingress.class: {}
            f:nginx.ingress.kubernetes.io/proxy-connect-timeout: {}
            f:nginx.ingress.kubernetes.io/proxy-read-timeout: {}
            f:nginx.ingress.kubernetes.io/ssl-redirect: {}
          f:labels:
            .: {}
            f:app.kubernetes.io/part-of: {}
            f:controller.devfile.io/devworkspace_id: {}
          f:ownerReferences:
            .: {}
            k:{"uid":"fe1e743c-b9c7-49bf-81e6-2c13d6a0c8e6"}: {}
        f:spec:
          f:rules: {}
          f:tls: {}

here is for the devworkspacerouting object that controls it:

  managedFields:
    - apiVersion: controller.devfile.io/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:finalizers:
            .: {}
            v:"devworkspacerouting.controller.devfile.io": {}
      manager: manager
      operation: Update
      time: '2024-01-17T20:45:16Z'
    - apiVersion: controller.devfile.io/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:controller.devfile.io/devworkspace-started: {}
          f:labels:
            .: {}
            f:controller.devfile.io/devworkspace_id: {}
          f:ownerReferences:
            .: {}
            k:{"uid":"9d67207e-52be-484a-a944-64d86d6d991d"}: {}
        f:spec:
          .: {}
          f:devworkspaceId: {}
          f:endpoints:
            .: {}
            f:elastic: {}
            f:monstache: {}
            f:tools: {}
          f:podSelector:
            .: {}
            f:controller.devfile.io/devworkspace_id: {}
          f:routingClass: {}
      manager: devworkspace-controller
      operation: Update
      time: '2024-01-17T20:48:22Z'
    - apiVersion: controller.devfile.io/v1alpha1
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          .: {}
          f:message: {}
          f:phase: {}
      manager: manager
      operation: Update
      subresource: status
      time: '2024-01-17T20:48:22Z'

and the devworkspace that controls that:

  managedFields:
    - apiVersion: workspace.devfile.io/v1alpha2
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:finalizers:
            .: {}
            v:"rbac.controller.devfile.io": {}
            v:"storage.controller.devfile.io": {}
      manager: devworkspace-controller
      operation: Update
      time: '2024-01-17T20:43:52Z'
    - apiVersion: workspace.devfile.io/v1alpha2
      fieldsType: FieldsV1
      fieldsV1:
        f:status:
          .: {}
          f:conditions: {}
          f:devworkspaceId: {}
          f:mainUrl: {}
          f:message: {}
          f:phase: {}
      manager: devworkspace-controller
      operation: Update
      subresource: status
      time: '2024-01-17T20:48:22Z'
    - apiVersion: workspace.devfile.io/v1alpha2
      fieldsType: FieldsV1
      fieldsV1:
        f:metadata:
          f:annotations:
            .: {}
            f:che.eclipse.org/devfile: {}
            f:che.eclipse.org/last-updated-timestamp: {}
        f:spec:
          .: {}
          f:contributions: {}
          f:routingClass: {}
          f:started: {}
          f:template:
            .: {}
            f:attributes:
              .: {}
              f:controller.devfile.io/devworkspace-config:
                .: {}
                f:name: {}
                f:namespace: {}
              f:controller.devfile.io/storage-type: {}
              f:dw.metadata.annotations:
                .: {}
                f:che.eclipse.org/devfile-source: {}
            f:components: {}
            f:projects: {}
      manager: unknown
      operation: Update
      time: '2024-01-17T20:48:22Z'

@guydog28
Copy link
Author

guydog28 commented Jan 17, 2024

Apart from that, are there somehow two che-operators running in the cluster? What is the update it's stuck on (i.e. what field is being changed repeatedly)?

I don't think it is repeatedly changing a field. it is repeatedly deleting and creating ingresses.

workspacea9a0497336ae43ff-tools-13131-code-redirect-1 workspacea9a0497336ae43ff-10.dev.ourdomain.comm our-elb-endpoint.elb.amazonaws.com 80, 443 4m54s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2 workspacea9a0497336ae43ff-11.dev.ourdomain.comm our-elb-endpoint.elb.amazonaws.com 80, 443 4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3 workspacea9a0497336ae43ff-12.dev.ourdomain.comm our-elb-endpoint.elb.amazonaws.com 80, 443 4m54s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1 workspacea9a0497336ae43ff-7.dev.ourdomain.comm our-elb-endpoint.elb.amazonaws.com 80, 443 4m54s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2 workspacea9a0497336ae43ff-8.dev.ourdomain.comm our-elb-endpoint.elb.amazonaws.com 80, 443 4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3 workspacea9a0497336ae43ff-9.dev.ourdomain.comm our-elb-endpoint.elb.amazonaws.com 80, 443 4m54s
workspacea9a0497336ae43ff-monstache-8181-monstache workspacea9a0497336ae43ff-12.dev.ourdomain.comm our-elb-endpoint.elb.amazonaws.com 80, 443 4m54s
workspacea9a0497336ae43ff-elastic-9200-es-client workspacea9a0497336ae43ff-13.dev.ourdomain.comm our-elb-endpoint.elb.amazonaws.com 80, 443 4m54s

Notice how the DNS name for the same ingress keeps changing.

@guydog28
Copy link
Author

guydog28 commented Jan 17, 2024

OOOOK, I think I figured out what is happening here. There are no errors anywhere that provide any helpful information, not even in the ingress-nginx-controller. But, I noticed that the ingresses that failed to sync had hostnames that were longer than the RFC 1035 allows, which states that the maximum length of a DNS label is 63 characters. code-redirect-[1-3] would always be a culprit due to the length of those endpoint names being longer than all of ours.

Our Che OIDC configuration uses email instead of username for the che username. So while a user might have a username of gwashington, his email might be [email protected]. Given a workspace name of project-a-wxyz, and the endpoint of code-redirect-1, this would results in a URL like:

george-nmn-washington-our-long-domain-com-project-a-wxyz-code-redirect-1.chebaseurl.com

george-nmn-washington-our-long-domain-com-project-a-wxyz-code-redirect-1 is 73 characters, putting that user in a doom loop of Preparing ingresses.

A user like John Doe would have no issues, since john-doe-our-long-domain-com-project-a-wxyz-code-redirect-1 is only 60 characters.

SO. It seems like we need to remap Che to use Keycloak usernames instead of email addresses. But this is going to make everyone start from scratch since gwashington will be seen as a different user than [email protected]

@guydog28
Copy link
Author

We are in the middle of a deployment push, and we have a few newer devs that haven't been able to launch a workspace due to this. Is there a way to modify a DevWorkspace name after creation, say changing project-a-wxyz to just pa to get the problematic devs going with a shorter DNS name until after our release when it would be a better time to make this over-arching change?

@amisevsk
Copy link
Contributor

Since DevWorkspaces are just Kubernetes objects, it's not possible to change their name (name + namespace is their unique identifier). As a workaround, you could use devfiles with short names in their metadata section; Che should pick up the name from the devfile. If it does not, you can also use a raw devfile link rather than a repository (e.g. posted to a github gist or similar).

I've created #22774 for now; if we're generating invalid ingresses it's definitely a bug in the operator.

@guydog28
Copy link
Author

guydog28 commented Jan 19, 2024

@amisevsk What recourse do i have for the long usernames? I don't see where in the CheCluster resource I can select a different field from the oauth provider to be the username? Right now, I think Che needs the name and email to configure the user's gitconfig, and by default uses the email for the username, but how do I get Che to use the user's keycloak username for its own username instead of email? This would get me running while we wait for #22774 to be completed and built.

@amisevsk
Copy link
Contributor

On the oauth question, I'm not sure -- I haven't looked at that section in a while and mostly work on the operators and editors. @vinokurig Any suggestions here?

I looked briefly into how the Che Operator is generating hostnames, and Che is explicitly checking that generated hostnames are valid (i.e. less than 63 characters) and using a different scheme if they are not. I also tested it by creating a devfile that would have hostnames over that limit, and the operator switched to using workspaceID-<number> for the hostname. This fix has been part of Che since 7.69 (see eclipse-che/che-operator#1702).

I'm really confused as to how you're seeing this behavior 🤔.

@guydog28
Copy link
Author

guydog28 commented Jan 19, 2024

On the oauth question, I'm not sure -- I haven't looked at that section in a while and mostly work on the operators and editors. @vinokurig Any suggestions here?

I looked briefly into how the Che Operator is generating hostnames, and Che is explicitly checking that generated hostnames are valid (i.e. less than 63 characters) and using a different scheme if they are not. I also tested it by creating a devfile that would have hostnames over that limit, and the operator switched to using workspaceID-<number> for the hostname. This fix has been part of Che since 7.69 (see eclipse-che/che-operator#1702).

I'm really confused as to how you're seeing this behavior 🤔.

Interesting, so as you can see from the logs here #22667 (comment), it does seem to do this, as you can see that the naming structure is different. However, these are the ingresses that are constantly being re-synced and re-generated with different numbers at the end by the operator. So something is off in that path through the code.

Looking at these 6 lines from the logs (which was a kubectl get ingresses -w (watch)) You can see it kept updating the DNS for the same ingresses with different number at the end. Here code-redirect-1, -2, -3 respectively became workspacea9a0497336ae43ff-10, -11, -12, and then immediately changed to -7, -8, -9, and that continues to other numbers as it constantly resynced the ingresses.

workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-10.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-11.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-12.dev.ourdomain.comm                                      our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13131-code-redirect-1   <none>   workspacea9a0497336ae43ff-7.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13132-code-redirect-2   <none>   workspacea9a0497336ae43ff-8.dev.ourdomain.comm                                       our-elb-endpoint.elb.amazonaws.com   80, 443   4m54s
workspacea9a0497336ae43ff-tools-13133-code-redirect-3   <none>   workspacea9a0497336ae43ff-9.dev.ourdomain.comm 

@amisevsk
Copy link
Contributor

Ah that's the piece I was missing -- I missed that in your log somehow.

Turns out this is coming from Go iterating through maps randomly, so when we go through too-long endpoint names, we run into an issue where the number suffix is more-or-less random (here). I've updated the created issue.

Still doesn't help us fix your problem in the here-and-now, though.

@guydog28
Copy link
Author

Ah yeah. Would be great to get that in a PR for 7.80 though! would really improve the stability of our cluster and allow us to re-enable our ingress-nginx admission controller. This is causing the k8s api to get hammered all the time trying to sync these up.

@amisevsk
Copy link
Contributor

I believe 7.80 has been branched already, but I opened a PR to hopefully fix it asap in the mean time: eclipse-che/che-operator#1801

cc: @ibuziuk in case this is something we want to pull into a bugfix

@guydog28
Copy link
Author

@amisevsk PR looks great, that should work well. @ibuziuk this would be great to bring in in the near term.

@guydog28
Copy link
Author

do we know when the 7.81 release is planned for? and also, will the merged PR be a part of it?

@amisevsk
Copy link
Contributor

I believe the 7.81 release branch of Che is planned for mid-week next week, and this fix should be part of that release. I think we decided not to backport it and issue a bugfix since the next minor release was a little over a week away.

@ibuziuk
Copy link
Member

ibuziuk commented Feb 13, 2024

@guydog28 hello, could you please confirm that the issue is fixed in 7.81.0 and can be closed ?

@ibuziuk ibuziuk self-assigned this Feb 13, 2024
@ibuziuk ibuziuk moved this to Unplanned Tasks in Eclipse Che Team A Backlog Feb 13, 2024
@guydog28
Copy link
Author

@ibuziuk I can confirm this does appear to be resolved in 7.81. Thanks @amisevsk!

@ibuziuk ibuziuk closed this as completed Feb 14, 2024
@ibuziuk ibuziuk moved this from Unplanned Tasks to ✅ Done in Eclipse Che Team A Backlog Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devworkspace-operator kind/bug Outline of a bug - must adhere to the bug report template. severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

5 participants