MCPcopy Create free account
hub / github.com/devfile/devworkspace-operator / AddURLAttributesToEndpoints

Function AddURLAttributesToEndpoints

pkg/library/annotate/urls.go:26–42  ·  view source on GitHub ↗
(workspace *dw.DevWorkspaceTemplateSpec, exposedEndpoints map[string]v1alpha1.ExposedEndpointList)

Source from the content-addressed store, hash-verified

24)
25
26func 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
44func getContainerEndpointByName(name string, container *dw.ContainerComponent) *dw.Endpoint {
45 for idx, endpoint := range container.Endpoints {

Callers 1

ReconcileMethod · 0.92

Calls 2

PutStringMethod · 0.80

Tested by

no test coverage detected