{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://helm.sh/schemas/values-yaml.json",
  "title": "Helm Values YAML",
  "description": "Schema for the values.yaml file in a Helm chart. The values.yaml file provides default configuration values for a chart. Values can be overridden during installation or upgrade using --set flags or additional values files. While the structure of values.yaml is chart-specific, this schema describes common conventional patterns used across the Helm ecosystem.",
  "type": "object",
  "properties": {
    "replicaCount": {
      "type": "integer",
      "description": "Number of pod replicas to deploy.",
      "minimum": 0,
      "default": 1
    },
    "image": {
      "type": "object",
      "description": "Container image configuration.",
      "properties": {
        "repository": {
          "type": "string",
          "description": "Container image repository and name.",
          "examples": [
            "nginx",
            "docker.io/library/nginx"
          ]
        },
        "tag": {
          "type": "string",
          "description": "Container image tag. Defaults to the chart appVersion if empty."
        },
        "pullPolicy": {
          "type": "string",
          "description": "Image pull policy for Kubernetes.",
          "enum": [
            "Always",
            "IfNotPresent",
            "Never"
          ],
          "default": "IfNotPresent"
        },
        "pullSecrets": {
          "type": "array",
          "description": "List of image pull secret names.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "nameOverride": {
      "type": "string",
      "description": "Override the chart name used in resource names."
    },
    "fullnameOverride": {
      "type": "string",
      "description": "Override the full resource name prefix."
    },
    "serviceAccount": {
      "type": "object",
      "description": "Service account configuration.",
      "properties": {
        "create": {
          "type": "boolean",
          "description": "Whether to create a service account.",
          "default": true
        },
        "name": {
          "type": "string",
          "description": "The name of the service account. Auto-generated if not set."
        },
        "annotations": {
          "type": "object",
          "description": "Annotations to add to the service account.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "automount": {
          "type": "boolean",
          "description": "Whether to automount the service account token.",
          "default": true
        }
      }
    },
    "podAnnotations": {
      "type": "object",
      "description": "Annotations to add to the pod.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "podLabels": {
      "type": "object",
      "description": "Labels to add to the pod.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "podSecurityContext": {
      "type": "object",
      "description": "Security context for the pod.",
      "properties": {
        "fsGroup": {
          "type": "integer"
        },
        "runAsUser": {
          "type": "integer"
        },
        "runAsGroup": {
          "type": "integer"
        },
        "runAsNonRoot": {
          "type": "boolean"
        }
      }
    },
    "securityContext": {
      "type": "object",
      "description": "Security context for the container.",
      "properties": {
        "allowPrivilegeEscalation": {
          "type": "boolean"
        },
        "capabilities": {
          "type": "object",
          "properties": {
            "drop": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "add": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "readOnlyRootFilesystem": {
          "type": "boolean"
        },
        "runAsNonRoot": {
          "type": "boolean"
        },
        "runAsUser": {
          "type": "integer"
        }
      }
    },
    "service": {
      "type": "object",
      "description": "Kubernetes Service configuration.",
      "properties": {
        "type": {
          "type": "string",
          "description": "Kubernetes Service type.",
          "enum": [
            "ClusterIP",
            "NodePort",
            "LoadBalancer",
            "ExternalName"
          ],
          "default": "ClusterIP"
        },
        "port": {
          "type": "integer",
          "description": "Service port number.",
          "default": 80
        },
        "annotations": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "ingress": {
      "type": "object",
      "description": "Kubernetes Ingress configuration.",
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": false
        },
        "className": {
          "type": "string",
          "description": "Ingress class name."
        },
        "annotations": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "hosts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "host": {
                "type": "string"
              },
              "paths": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "pathType": {
                      "type": "string",
                      "enum": [
                        "Exact",
                        "Prefix",
                        "ImplementationSpecific"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "tls": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "secretName": {
                "type": "string"
              },
              "hosts": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "resources": {
      "type": "object",
      "description": "CPU and memory resource requests and limits for the container.",
      "properties": {
        "limits": {
          "type": "object",
          "properties": {
            "cpu": {
              "type": "string",
              "examples": ["500m", "1"]
            },
            "memory": {
              "type": "string",
              "examples": ["128Mi", "512Mi"]
            }
          }
        },
        "requests": {
          "type": "object",
          "properties": {
            "cpu": {
              "type": "string",
              "examples": ["100m", "250m"]
            },
            "memory": {
              "type": "string",
              "examples": ["64Mi", "256Mi"]
            }
          }
        }
      }
    },
    "autoscaling": {
      "type": "object",
      "description": "Horizontal Pod Autoscaler configuration.",
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": false
        },
        "minReplicas": {
          "type": "integer",
          "default": 1
        },
        "maxReplicas": {
          "type": "integer",
          "default": 100
        },
        "targetCPUUtilizationPercentage": {
          "type": "integer"
        },
        "targetMemoryUtilizationPercentage": {
          "type": "integer"
        }
      }
    },
    "nodeSelector": {
      "type": "object",
      "description": "Node labels for pod assignment.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "tolerations": {
      "type": "array",
      "description": "Tolerations for pod scheduling.",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "operator": {
            "type": "string",
            "enum": ["Exists", "Equal"]
          },
          "value": {
            "type": "string"
          },
          "effect": {
            "type": "string",
            "enum": ["NoSchedule", "PreferNoSchedule", "NoExecute"]
          },
          "tolerationSeconds": {
            "type": "integer"
          }
        }
      }
    },
    "affinity": {
      "type": "object",
      "description": "Affinity rules for pod scheduling.",
      "properties": {
        "nodeAffinity": {
          "type": "object"
        },
        "podAffinity": {
          "type": "object"
        },
        "podAntiAffinity": {
          "type": "object"
        }
      }
    },
    "global": {
      "type": "object",
      "description": "Global values shared across all chart dependencies. These values are accessible to both the parent chart and all subcharts.",
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
