# yamllint configuration for Kubernetes YAML files
# This config follows Kubernetes best practices

extends: default

rules:
  # Allow longer lines for Kubernetes resources
  line-length:
    max: 120
    level: warning

  # Kubernetes uses 2-space indentation
  # indent-sequences: consistent allows both K8s-style (- at same level) and
  # standard style (- indented). Use 'whatever' for maximum flexibility.
  indentation:
    spaces: 2
    indent-sequences: consistent

  # Allow comments without space from content
  comments:
    min-spaces-from-content: 1

  # Allow document start markers (helpful for multi-resource files)
  document-start: disable

  # Truthy values: Kubernetes uses YAML 1.1 parser which recognizes yes/no/on/off
  # as boolean values. We allow these for compatibility, but recommend using
  # explicit 'true'/'false' for clarity and YAML 1.2 compatibility.
  # See: https://yaml.org/type/bool.html
  truthy:
    allowed-values: ['true', 'false', 'yes', 'no', 'on', 'off']
    level: warning

  # Kubernetes YAMLs often have long lines in annotations/labels
  comments-indentation: {}

  # Allow empty values (common in K8s for optional fields)
  empty-values:
    forbid-in-block-mappings: false
    forbid-in-flow-mappings: false

  # Detect duplicate keys in mappings (uses default: error level)
  key-duplicates: {}

  # Enforce no trailing whitespace (uses default: error level)
  trailing-spaces: {}

  # Be strict about new lines at end of file
  new-line-at-end-of-file: enable

  # K8s resources often have complex nested structures
  braces:
    max-spaces-inside: 1

  brackets:
    max-spaces-inside: 1