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


---

releases:
  - name: {{ .Values.name }}-gateway
    chart: charts/gateway
    namespace: {{ .Values.namespace }}
    values:
      - namePrefix: "{{ .Values.name }}-"

    jsonPatches:
      - target:
          version: v1
          group: cert-manager.io
          kind: Certificate
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-exact-cert
        patch:
          - op: replace
            path: /spec/dnsNames
            value:
              - {{ .Values.baseDomain }}
      - target:
          version: v1
          group: cert-manager.io
          kind: Certificate
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-subs-cert
        patch:
          - op: replace
            path: /spec/dnsNames
            value: {{ .Values.subDomains | toYaml | nindent 14 }}
      - target:
          version: v1beta1
          group: gateway.networking.k8s.io
          kind: Gateway
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-gateway
        patch:
          - op: replace
            path: /spec/gatewayClassName
            value: {{ .Values.gatewayClassName }}
          - op: replace
            path: /spec/listeners/1/hostname
            value: {{ .Values.baseDomain }}
          - op: replace
            path: /spec/listeners/1/tls/certificateRefs/0/name
            value: {{ .Values.name }}-exact-cert
          - op: replace
            path: /spec/listeners/2/hostname
            value: "*.{{ .Values.baseDomain }}"
          - op: replace
            path: /spec/listeners/2/tls/certificateRefs/0/name
            value: {{ .Values.name }}-subs-cert
      - target:
          version: v1
          group: cert-manager.io
          kind: Issuer
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-letsencrypt-staging
        patch:
          - op: replace
            path: /spec/acme/solvers/0/http01/gatewayHTTPRoute/parentRefs/0/name
            value: {{ .Values.name }}-gateway
      - target:
          version: v1
          group: cert-manager.io
          kind: Issuer
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-letsencrypt-production
        patch:
          - op: replace
            path: /spec/acme/solvers/0/http01/gatewayHTTPRoute/parentRefs/0/name
            value: {{ .Values.name }}-gateway
    strategicMergePatches:
      - apiVersion: cert-manager.io/v1
        kind: Certificate
        metadata:
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-exact-cert
        spec:
          issuerRef:
            name: {{ .Values.name }}-letsencrypt-staging
          secretName: {{ .Values.name }}-exact-cert
      - apiVersion: cert-manager.io/v1
        kind: Certificate
        metadata:
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-subs-cert
        spec:
          issuerRef:
            name: {{ .Values.name }}-letsencrypt-staging
          secretName: {{ .Values.name }}-subs-cert
      - apiVersion: cert-manager.io/v1
        kind: Issuer
        metadata:
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-letsencrypt-staging
        spec:
          acme:
            email: {{ .Values.letsEncrypt.email }}
            privateKeySecretRef:
              name: {{ .Values.name }}-letsencrypt-account
      - apiVersion: cert-manager.io/v1
        kind: Issuer
        metadata:
          namespace: {{ .Values.namespace }}
          name: {{ .Values.name }}-letsencrypt-production
        spec:
          acme:
            email: {{ .Values.letsEncrypt.email }}
            privateKeySecretRef:
              name: {{ .Values.name }}-letsencrypt-account