{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/isovalent/json-schema/isovalent-service-schema.json",
  "title": "Service",
  "description": "Collection of endpoints to be served",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/isovalent-service-api-openapi.yml#/components/schemas/Service",
  "type": "object",
  "properties": {
    "spec": {
      "$ref": "#/$defs/ServiceSpec"
    },
    "status": {
      "$ref": "#/$defs/ServiceStatus"
    }
  },
  "$defs": {
    "BackendAddress": {
      "description": "Service backend address",
      "type": "object",
      "required": [
        "ip"
      ],
      "properties": {
        "ip": {
          "description": "Layer 3 address",
          "type": "string"
        },
        "protocol": {
          "description": "Layer 4 protocol (TCP, UDP, etc)",
          "type": "string"
        },
        "port": {
          "description": "Layer 4 port number",
          "type": "integer",
          "format": "uint16"
        },
        "nodeName": {
          "description": "Optional name of the node on which this backend runs",
          "type": "string"
        },
        "state": {
          "description": "State of the backend for load-balancing service traffic",
          "type": "string",
          "enum": [
            "active",
            "terminating",
            "terminating-not-serving",
            "quarantined",
            "maintenance"
          ]
        },
        "preferred": {
          "description": "Indicator if this backend is preferred in the context of clustermesh service affinity. The value is set based\non related annotation of global service. Applicable for active state only.",
          "type": "boolean"
        },
        "weight": {
          "description": "Backend weight",
          "type": [
            "integer",
            "null"
          ],
          "format": "uint16"
        },
        "zone": {
          "description": "Optional name of the zone in which this backend runs",
          "type": "string"
        }
      }
    },
    "FrontendAddress": {
      "description": "Layer 4 address. The protocol is currently ignored, all services will\nbehave as if protocol any is specified. To restrict to a particular\nprotocol, use policy.\n",
      "type": "object",
      "properties": {
        "ip": {
          "description": "Layer 3 address",
          "type": "string"
        },
        "protocol": {
          "description": "Layer 4 protocol",
          "type": "string",
          "enum": [
            "tcp",
            "udp",
            "any"
          ]
        },
        "scope": {
          "description": "Load balancing scope for frontend address",
          "type": "string",
          "enum": [
            "external",
            "internal"
          ]
        },
        "port": {
          "description": "Layer 4 port number",
          "type": "integer",
          "format": "uint16"
        }
      }
    },
    "ServiceSpec": {
      "description": "Configuration of a service",
      "type": "object",
      "required": [
        "frontend-address"
      ],
      "properties": {
        "id": {
          "description": "Unique identification",
          "type": "integer"
        },
        "frontend-address": {
          "description": "Frontend address",
          "$ref": "#/$defs/FrontendAddress"
        },
        "backend-addresses": {
          "description": "List of backend addresses",
          "type": "array",
          "items": {
            "$ref": "#/$defs/BackendAddress"
          }
        },
        "flags": {
          "description": "Optional service configuration flags",
          "type": "object",
          "properties": {
            "type": {
              "description": "Service type",
              "type": "string",
              "enum": [
                "ClusterIP",
                "NodePort",
                "ExternalIPs",
                "HostPort",
                "LoadBalancer",
                "LocalRedirect"
              ]
            },
            "trafficPolicy": {
              "description": "Service external traffic policy (deprecated in favor of extTrafficPolicy)",
              "type": "string",
              "enum": [
                "Cluster",
                "Local"
              ]
            },
            "extTrafficPolicy": {
              "description": "Service external traffic policy",
              "type": "string",
              "enum": [
                "Cluster",
                "Local"
              ]
            },
            "intTrafficPolicy": {
              "description": "Service internal traffic policy",
              "type": "string",
              "enum": [
                "Cluster",
                "Local"
              ]
            },
            "natPolicy": {
              "description": "Service protocol NAT policy",
              "type": "string",
              "enum": [
                "None",
                "Nat46",
                "Nat64"
              ]
            },
            "healthCheckNodePort": {
              "description": "Service health check node port",
              "type": "integer",
              "format": "uint16"
            },
            "name": {
              "description": "Service name  (e.g. Kubernetes service name)",
              "type": "string"
            },
            "namespace": {
              "description": "Service namespace  (e.g. Kubernetes namespace)",
              "type": "string"
            },
            "cluster": {
              "description": "Service cluster",
              "type": "string"
            }
          }
        },
        "updateServices": {
          "description": "Update all services selecting the backends with their given states\n(id and frontend are ignored)\n",
          "type": "boolean"
        }
      }
    },
    "ServiceStatus": {
      "description": "Configuration of a service",
      "type": "object",
      "properties": {
        "realized": {
          "$ref": "#/$defs/ServiceSpec"
        }
      }
    }
  }
}