#
#  Author: Hari Sekhon
#  Date: 2021-06-03 19:36:47 +0100 (Thu, 03 Jun 2021)
#
#  vim:ts=2:sts=2:sw=2:et
#
#  https://github.com/harisekhon/Kubernetes-configs
#
#  License: see accompanying Hari Sekhon LICENSE file
#
#  If you're using my code you're welcome to connect with me on LinkedIn
#  and optionally send me feedback to help improve or steer this or other code I publish
#
#  https://www.linkedin.com/in/HariSekhon
#

# ============================================================================ #
#             S p i n n a k e r   D e c k   ( U I )   I n g r e s s
# ============================================================================ #

# XXX: you will need to reconfigure the Deck & Gate URLs to match the host names configured below:
#
#     hal config security ui edit --override-base-url https://spinnaker.DOMAIN.COM
#     hal config security api edit --override-base-url https://spinnaker-gate.DOMAIN.COM
#

---
#apiVersion: extensions/v1beta1  # old
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: spin-deck
  namespace: spinnaker
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "true"
    # XXX: Edit to make available externally or apply common ingress.nginx.patch.yaml with shared IP list eg. Cloudflare
    nginx.ingress.kubernetes.io/whitelist-source-range: |
      10.0.0.0/8,
      172.16.0.0/16,
      192.168.0.0/16
spec:
  tls:
    # XXX: Edit
    - hosts:
        - spinnaker.DOMAIN.COM
      secretName: spinnaker-deck-tls
  rules:
    # XXX: Edit
    - host: spinnaker.DOMAIN.COM
      http:
        paths:
          - path: /
            pathType: Prefix  # for new networking.k8s.io/v1
            backend:
              #serviceName: spin-deck
              #servicePort: 9000
              service:
                name: spin-desk
                port:
                  number: 9000
