# Control Center Kubernetes Service
# Exposes Control Center API and UI
#
# Usage:
#   nickel eval --format json control-center-service.yaml.ncl | yq -P > control-center-service.yaml
#   kubectl apply -f control-center-service.yaml

{
  apiVersion = "v1",
  kind = "Service",
  metadata = {
    name = "control-center",
    labels = {
      app = "control-center",
      component = "provisioning-platform",
    },
    annotations = {
      "description" = "Control Center service for policy and RBAC management",
    },
  },
  spec = {
    type = "ClusterIP",

    sessionAffinity = "ClientIP",
    sessionAffinityConfig = {
      clientIP = {
        timeoutSeconds = 10800,
      },
    },

    selector = {
      app = "control-center",
    },

    ports = [
      {
        name = "http",
        protocol = "TCP",
        port = 8080,
        targetPort = 8080,
      },
      {
        name = "metrics",
        protocol = "TCP",
        port = 8081,
        targetPort = 8081,
      },
    ],
  },
}
