helmfile.yaml 2.41 KB
bases:
  - ../common/environments.yaml

---

releases:
  - name: kpg-postgresql
    namespace: {{ .Values.namespace }}
    chart: charts/postgresql
    wait: true
    strategicMergePatches:
      - apiVersion: acid.zalan.do/v1
        kind: postgresql
        metadata:
          name: kpg-postgres
          namespace: {{ .Values.namespace }}
        spec:
          volume:
            size: {{ .Values.postgresql.volume.size | quote }}
          postgresql:
            version: {{ .Values.postgresql.version | quote }}
          {{- if .Values | get "clone.uid" nil }}
          clone:
            {{ merge .Values.clone ( dict "cluster" "kpg-postgres" ) | toYaml | nindent 12 }}
          {{- end }}

  - name: kpg-keycloak
    namespace: {{ .Values.namespace }}
    chart: charts/keycloak
    needs:
    - kpg-postgresql
    strategicMergePatches:
      - apiVersion: cert-manager.io/v1
        kind: Certificate
        metadata:
          name: kpg-keycloak-crt
          namespace: {{ .Values.namespace }}
        spec:
          dnsNames:
            - {{ .Values.certificate.hostName }}
          issuerRef:
            name: {{ .Values.certificate.issuerRef }}
      - apiVersion: networking.istio.io/v1beta1
        kind: VirtualService
        metadata:
          name: kpg-keycloak
          namespace: {{ .Values.namespace }}
        spec:
          hosts:
            - {{ .Values.virtualService.hostName }}
          gateways:
            - {{ .Values.virtualService.gateway }}
          tls:
            - match:
                - sniHosts:
                    - {{ .Values.virtualService.hostName }}

    jsonPatches:
      - target:
          group: k8s.keycloak.org
          version: v2alpha1
          kind: Keycloak
          name: kpg-keycloak
          namespace: {{ .Values.namespace }}
        patch:
          - op: replace
            path: /spec/unsupported/podTemplate/spec/initContainers/0/image
            value: {{ .Values.postgresql.waitForPg.image }}
      - target:
          kind: VirtualService
          name: kpg-keycloak
          namespace: {{ .Values.namespace }}
          version: v1beta1
          group: networking.istio.io
        patch:
          - op: replace
            path: /spec/http/0/route/0/destination/host
            value: kpg-keycloak-service.default.svc.cluster.local
#          - op: replace
#            path: /spec/tls/0/match/0/sniHosts/0
#            value: {{ .Values.virtualService.hostName }}