Skip to content

Commit 0b599a8

Browse files
Andrew Farriesroboquat
authored andcommitted
Add ServiceAnnotations config to proxy
Allow the annotations on the service to be added to by specifying them in the experimental config.
1 parent 5362e22 commit 0b599a8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

install/installer/pkg/components/proxy/service.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ func service(ctx *common.RenderContext) ([]runtime.Object, error) {
2323
return nil
2424
})
2525

26+
var annotations map[string]string
27+
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
28+
if cfg.WebApp != nil && cfg.WebApp.ProxyConfig != nil {
29+
annotations = cfg.WebApp.ProxyConfig.ServiceAnnotations
30+
}
31+
return nil
32+
})
33+
2634
ports := map[string]common.ServicePort{
2735
ContainerHTTPName: {
2836
ContainerPort: ContainerHTTPPort,
@@ -47,7 +55,12 @@ func service(ctx *common.RenderContext) ([]runtime.Object, error) {
4755
return common.GenerateService(Component, ports, func(service *corev1.Service) {
4856
service.Spec.Type = corev1.ServiceTypeLoadBalancer
4957
service.Spec.LoadBalancerIP = loadBalancerIP
58+
5059
service.Annotations["external-dns.alpha.kubernetes.io/hostname"] = fmt.Sprintf("%s,*.%s,*.ws.%s", ctx.Config.Domain, ctx.Config.Domain, ctx.Config.Domain)
5160
service.Annotations["cloud.google.com/neg"] = `{"exposed_ports": {"80":{},"443": {}}}`
61+
62+
for k, v := range annotations {
63+
service.Annotations[k] = v
64+
}
5265
})(ctx)
5366
}

install/installer/pkg/config/v1/experimental/experimental.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ type ServerConfig struct {
134134
}
135135

136136
type ProxyConfig struct {
137-
StaticIP string `json:"staticIP"`
137+
StaticIP string `json:"staticIP"`
138+
ServiceAnnotations map[string]string `json:"serviceAnnotations"`
138139
}
139140

140141
type PublicAPIConfig struct {

0 commit comments

Comments
 (0)