@@ -6,6 +6,7 @@ package proxy
6
6
7
7
import (
8
8
"fmt"
9
+ "strings"
9
10
10
11
"github.com/gitpod-io/gitpod/installer/pkg/common"
11
12
"github.com/gitpod-io/gitpod/installer/pkg/config/v1/experimental"
@@ -15,6 +16,19 @@ import (
15
16
)
16
17
17
18
func service (ctx * common.RenderContext ) ([]runtime.Object , error ) {
19
+ serviceType := corev1 .ServiceTypeLoadBalancer
20
+ _ = ctx .WithExperimental (func (cfg * experimental.Config ) error {
21
+ if cfg .Common != nil && cfg .Common .ServiceConfig != nil {
22
+ st , ok := cfg .Common .ServiceConfig ["proxy" ]
23
+ if ok {
24
+ if strings .ToLower (st .ServiceType ) == "clusterip" {
25
+ serviceType = corev1 .ServiceTypeClusterIP
26
+ }
27
+ }
28
+ }
29
+ return nil
30
+ })
31
+
18
32
loadBalancerIP := ""
19
33
_ = ctx .WithExperimental (func (cfg * experimental.Config ) error {
20
34
if cfg .WebApp != nil && cfg .WebApp .ProxyConfig != nil && cfg .WebApp .ProxyConfig .StaticIP != "" {
@@ -57,8 +71,10 @@ func service(ctx *common.RenderContext) ([]runtime.Object, error) {
57
71
}
58
72
59
73
return common .GenerateService (Component , ports , func (service * corev1.Service ) {
60
- service .Spec .Type = corev1 .ServiceTypeLoadBalancer
61
- service .Spec .LoadBalancerIP = loadBalancerIP
74
+ service .Spec .Type = serviceType
75
+ if serviceType == corev1 .ServiceTypeLoadBalancer {
76
+ service .Spec .LoadBalancerIP = loadBalancerIP
77
+ }
62
78
63
79
service .Annotations ["external-dns.alpha.kubernetes.io/hostname" ] = fmt .Sprintf ("%s,*.%s,*.ws.%s" , ctx .Config .Domain , ctx .Config .Domain , ctx .Config .Domain )
64
80
service .Annotations ["cloud.google.com/neg" ] = `{"exposed_ports": {"80":{},"443": {}}}`
0 commit comments