UNCLASSIFIED - NO CUI

Add kas http path to istio virtual service

Feature Request

Why

If KAS is deployed on the same hostname as Gitlab (i.e. gitlab.example.com/-/kubernetes-agent), then it needs to use the same VirtualService and have a path matching to /-/kubernetes-agent that routes to the kas Service. This helps the people who don't want a separate hostname for kas.

Proposed Solution

Please just simply add a section like so to the istio VirtualService that gets created for gitlab

{{- if and .Values.istio.enabled .Values.istio.gitlab.enabled }}
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: {{ .Release.Name }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- if .Values.istio.gitlab.labels }}
      {{ toYaml .Values.istio.gitlab.labels | indent 4 }}
    {{- end }}
    app.kubernetes.io/component: "gitlab"
  {{- if .Values.istio.gitlab.annotations }}
  annotations:
    {{ toYaml .Values.istio.gitlab.annotations | indent 4 }}
  {{- end }}
spec:
  gateways:
  {{- range .Values.istio.gitlab.gateways }}
    - {{ . }}
  {{- end }}
  hosts:
  {{- if .Values.istio.gitlab.hosts }}
  {{- range .Values.istio.gitlab.hosts }}
    - {{ . | quote }}
  {{- end }}
  {{- else }}
    - "{{ .Values.global.hosts.gitlab.name }}"
  {{- end }}
  http:
    - fault:
        abort:
          httpStatus: 403
          percentage:
            value: 100
      match:
      - uri:
          prefix: /-/metrics
      route:
      - destination:
          host: {{ .Release.Name }}-webservice-default.{{ .Release.Namespace }}.svc.cluster.local
          port:
            number: 8181
    - match:
      - uri:
          prefix: /
      route:
      - destination:
          host: {{ .Release.Name }}-webservice-default.{{ .Release.Namespace }}.svc.cluster.local
          port:
            number: 8181
    - match:
      - uri:
          prefix: /admin/sidekiq
      route:
      - destination:
          host: {{ .Release.Name }}-webservice-default.{{ .Release.Namespace }}.svc.cluster.local
          port:
            number: 8080
    - match:
      - uri:
          prefix: /-/kubernetes-agent
      route:
      - destination:
          host: {{ .Release.Name }}-kas.{{ .Release.Namespace }}.svc.cluster.local
          port:
            number: 8150
{{- end }}