# TLS Certificate for Vibecarbon application
# Requires cert-manager to be installed (kubectl apply -k k8s/infra/)
#
# DEPLOY-OWNED: the vibecarbon deploy renders this file before it applies the
# base (renderK8sBase in src/lib/deploy/k8s/k3s.js), with the environment's
# names and issuer, and Flux does not own it (its vibecarbon-base
# Kustomization drops it with a $patch: delete, k8s/flux/clusters/*):
#   - issuerRef.name: letsencrypt-{prod,staging} from ACME_CA_SERVER (a pilot
#     standby uses vibecarbon-standby-selfsigned; the real issuer rides the
#     vibecarbon.dev/promote-issuer annotation).
#   - dnsNames: [domain]. k8s routes by path on the apex, and HTTP-01 cannot
#     issue a wildcard.
#
# The placeholders below only keep this template valid for kustomize;
# cert-manager never sees them. prune: disabled keeps Flux's garbage
# collection away from the live object the deploy applied.
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: vibecarbon-tls
  annotations:
    kustomize.toolkit.fluxcd.io/prune: disabled
spec:
  secretName: vibecarbon-tls
  issuerRef:
    name: letsencrypt-prod
    kind: ClusterIssuer
  dnsNames:
    - app.example.com  # Rendered with the actual domain at deploy time
