(workspace *dw.DevWorkspaceTemplateSpec, exposedEndpoints map[string]v1alpha1.ExposedEndpointList)
| 24 | ) |
| 25 | |
| 26 | func AddURLAttributesToEndpoints(workspace *dw.DevWorkspaceTemplateSpec, exposedEndpoints map[string]v1alpha1.ExposedEndpointList) { |
| 27 | for _, component := range workspace.Components { |
| 28 | if component.Container == nil { |
| 29 | continue |
| 30 | } |
| 31 | container := component.Container |
| 32 | endpoints := exposedEndpoints[component.Name] |
| 33 | for _, exposedEndpoint := range endpoints { |
| 34 | if containerEndpoint := getContainerEndpointByName(exposedEndpoint.Name, container); containerEndpoint != nil { |
| 35 | if containerEndpoint.Attributes == nil { |
| 36 | containerEndpoint.Attributes = attributes.Attributes{} |
| 37 | } |
| 38 | containerEndpoint.Attributes.PutString(constants.EndpointURLAttribute, exposedEndpoint.Url) |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func getContainerEndpointByName(name string, container *dw.ContainerComponent) *dw.Endpoint { |
| 45 | for idx, endpoint := range container.Endpoints { |
no test coverage detected