Skip to content

Enable setting serviceType clusterIP or LoadBalancer for sessionServer

Add the sessionServer.serviceType option, which defaults to "LoadBalancer", but can also be set to "ClusterIP". If its set to "ClusterIP" you must set sessionServer.publicIP and NOTES.txt does warn about this. It also wont create a service if you haven't set the publicIP and have set the serviceType "ClusterIP". This is important so the advertise address is sensible.

I primarly did this patch for using Ingress instead of a LoadBalancer service on EKS.

externalPort is enforced to be 443 with serviceType "ClusterIP" since ingress can only expose the 443 and 80 port. This should work even for the use cases when you want to use an internal service only and never expose it publicly with your own ingress resource. But could remove this enforcement if you'd like that.

I particularly dislike the if statements for disabling services if the sessionServer.serviceType "ClusterIP" is not set correctly. Would love some pointers on perhaps wrapping it in a variable that can be reused instead but for the life of me I don't know how to do it in helm charts.

I.e {{- if and (eq (default 1.0 .Values.replicas) 1.0) .Values.sessionServer .Values.sessionServer.enabled (or (eq .Values.sessionServer.serviceType "LoadBalancer") (and (eq .Values.sessionServer.serviceType "ClusterIP") .Values.sessionServer.publicIP)) }} is an erhm... textful?

Example nginx ingress to get this to work:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: gitlab-runner-session-debug
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  rules:
    - host: <your-domain-name>
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: gitlab-runner-helm-clusterip-session-server
                port:
                  number: 443

Should resolve: #360 at least adequately Well probably not solve #360 but be a good start for doing it down the line!

Edited by jumziey

Merge request reports

Loading