Skip to content

[installer]: grant option for disabling proxy load balancer #7280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,21 @@ Kubernetes objects, such as your TLS certificate or connection secrets.
kubectl create namespace gitpod
```

# I need to add additional configuration to my load balancer - what do I do?

By default, this will create a `proxy` service with `ServiceType: LoadBalancer`.
If you want to specify your own ingress, you can do this easily by changing
your Installer configuration:

```yaml
components:
proxy:
serviceType: ClusterIP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a validation checking that serviceType is LoadBalancer or ClusterIP only?
Both, proxy and ws-proxy are configured on ports 80 and 443

```

This will set the `ServiceType` to `ClusterIP` allowing you to create your own
ingress controller.

# Todo

PRs/comments welcome
Expand Down
2 changes: 1 addition & 1 deletion installer/pkg/components/proxy/objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var Objects = common.CompositeRenderFunc(
ServicePort: PrometheusPort,
},
}, func(service *corev1.Service) {
service.Spec.Type = corev1.ServiceTypeLoadBalancer
service.Spec.Type = cfg.Config.Components.Proxy.ServiceType
service.Annotations["external-dns.alpha.kubernetes.io/hostname"] = fmt.Sprintf("%s,*.%s,*.ws.%s", cfg.Config.Domain, cfg.Config.Domain, cfg.Config.Domain)
service.Annotations["cloud.google.com/neg"] = `{"exposed_ports": {"80":{},"443": {}}}`
})(cfg)
Expand Down
17 changes: 16 additions & 1 deletion installer/pkg/config/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func (v version) Factory() interface{} {
Enabled: false,
Passlist: []string{},
},
Components: &Components{
Proxy: &ProxyComponent{
ServiceType: corev1.ServiceTypeLoadBalancer,
},
},
}
}
func (v version) Defaults(in interface{}) error {
Expand Down Expand Up @@ -79,6 +84,8 @@ type Config struct {

ImagePullSecrets []ObjectRef `json:"imagePullSecrets"`

Components *Components `json:"components,omitempty"`

Workspace Workspace `json:"workspace" validate:"required"`

AuthProviders []ObjectRef `json:"authProviders" validate:"dive"`
Expand Down Expand Up @@ -163,7 +170,7 @@ const (
type ContainerRegistry struct {
InCluster *bool `json:"inCluster,omitempty" validate:"required"`
External *ContainerRegistryExternal `json:"external,omitempty" validate:"required_if=InCluster false"`
S3Storage *S3Storage `json:"s3storage"`
S3Storage *S3Storage `json:"s3storage,omitempty"`
}

type ContainerRegistryExternal struct {
Expand Down Expand Up @@ -222,6 +229,14 @@ type Workspace struct {
Templates *WorkspaceTemplates `json:"templates,omitempty"`
}

type Components struct {
Proxy *ProxyComponent `json:"proxy,omitempty"`
}

type ProxyComponent struct {
ServiceType corev1.ServiceType `json:"serviceType,omitempty" validate:"k8s_service_type"`
}

type FSShiftMethod string

const (
Expand Down
14 changes: 12 additions & 2 deletions installer/pkg/config/v1/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import (
"fmt"

"github.com/gitpod-io/gitpod/installer/pkg/cluster"
"sigs.k8s.io/yaml"

"github.com/go-playground/validator/v10"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/yaml"
)

var InstallationKindList = map[InstallationKind]struct{}{
Expand Down Expand Up @@ -39,6 +38,13 @@ var FSShiftMethodList = map[FSShiftMethod]struct{}{
FSShiftShiftFS: {},
}

var KubernetesServiceTypeList = map[corev1.ServiceType]struct{}{
corev1.ServiceTypeClusterIP: {},
corev1.ServiceTypeNodePort: {},
corev1.ServiceTypeLoadBalancer: {},
corev1.ServiceTypeExternalName: {},
}

// LoadValidationFuncs load custom validation functions for this version of the config API
func (v version) LoadValidationFuncs(validate *validator.Validate) error {
funcs := map[string]validator.Func{
Expand All @@ -54,6 +60,10 @@ func (v version) LoadValidationFuncs(validate *validator.Validate) error {
_, ok := InstallationKindList[InstallationKind(fl.Field().String())]
return ok
},
"k8s_service_type": func(fl validator.FieldLevel) bool {
_, ok := KubernetesServiceTypeList[corev1.ServiceType(fl.Field().String())]
return ok
},
"log_level": func(fl validator.FieldLevel) bool {
_, ok := LogLevelList[LogLevel(fl.Field().String())]
return ok
Expand Down