Skip to content

Commit

Permalink
[installer]: accept serviceAnnotation config for each component
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Emms committed Oct 26, 2021
1 parent 1e4d2fc commit 0d42c51
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
12 changes: 9 additions & 3 deletions installer/pkg/common/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,18 @@ func GenerateServiceWithServiceType(component string, ports map[string]ServicePo
spec.ClusterIP = "None"
}

var annotations map[string]string
if componentConfig, found := cfg.Config.Workspace.Components[component]; found != false {
annotations = componentConfig.ServiceAnnotations
}

return []runtime.Object{&corev1.Service{
TypeMeta: TypeMetaService,
ObjectMeta: metav1.ObjectMeta{
Name: component,
Namespace: cfg.Namespace,
Labels: labels,
Name: component,
Namespace: cfg.Namespace,
Labels: labels,
Annotations: annotations,
},
Spec: spec,
}}, nil
Expand Down
11 changes: 8 additions & 3 deletions installer/pkg/config/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,15 @@ type WorkspaceTemplates struct {
Probe *corev1.Pod `json:"probe"`
}

type WorkspaceComponent struct {
ServiceAnnotations map[string]string `json:"serviceAnnotations,omitempty"`
}

type Workspace struct {
Runtime WorkspaceRuntime `json:"runtime" validate:"required"`
Resources Resources `json:"resources" validate:"required"`
Templates *WorkspaceTemplates `json:"templates,omitempty"`
Runtime WorkspaceRuntime `json:"runtime" validate:"required"`
Resources Resources `json:"resources" validate:"required"`
Templates *WorkspaceTemplates `json:"templates,omitempty"`
Components map[string]WorkspaceComponent `json:"components,omitempty"`
}

type FSShiftMethod string
Expand Down

0 comments on commit 0d42c51

Please sign in to comment.