Description
Description
If a devworkspace's endpoint contains the discoverable: true
attribute, then a service will be created for that specific endpoint. The endpoint's service will be given the same name as the endpoint. The intention behind the discoverable attribute is to allow endpoint services to have a static, predetermined name.
However, if 2 devworkspace's in the same namespace both have discoverable endpoints with the same name, then DWO will enter an endless reconcile loop as it tries to modify the same service for both devworkspaces.
I suggest having the devworkspacerouting controller check all discoverable endpoints for a given workspace, and see if a service already exists that shares the same name as one of the discoverable endpoints. If a service already exists with the same endpoint name, then the devworkspace should fail. This would alert the user that they need to modify their devfile/devworkspace to use a different discoverable endpoint name.
To reproduce this issue, you could create the following two devworkspace's and watch the devworkspace controller go into an endless reconcile loop:
kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: plain-dw-discoverable-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: my-endpoint
targetPort: 8080
protocol: http
attributes:
discoverable: true
kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: plain-dw-discoverable-endpoint-2
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: my-endpoint
targetPort: 8080
protocol: http
attributes:
discoverable: true
Additional context
Upstream issue with further context.