Commit Graph
27 Commits
  • fix(charts): add automountServiceAccountToken and fix schema validations
    - Add automountServiceAccountToken to deployment.yaml template (was missing)
    - Fix image.repository pattern in schema to allow registry with port (e.g., registry.example.com:5000)
    - Add ExternalName to service.type enum in schema
    - Remove ExternalName tests from service_test.yaml and validation_mutual_exclusions_test.yaml (not implemented in template)
    - Fix integration test: change persistence.media.type from 'nfs' to 'hostPath' (nfs not supported)
    
    These fixes address test failures related to schema validation and missing template fields.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • fix(tests): quote regex patterns in matchRegex assertions
    Fix YAML syntax errors where patterns containing colons need to be quoted
    to avoid being interpreted as YAML mapping values.
    
    Affected files:
    - deployment_image_test.yaml
    - regression_defaults_test.yaml
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(charts): add integration scenarios and regression tests
    Phase 4: Create integration tests for real-world scenarios and regression
    tests to lock down all default values.
    
    New test files:
    - integration_common_configs_test.yaml: 12 real-world deployment scenarios
      including DLNA home server, secure production, Prometheus monitoring,
      IPv6-only/dual-stack, cloud providers (AWS IRSA, GCP WI), air-gapped,
      minimal resource-constrained, Gateway API HTTPRoute (50+ tests)
    - regression_defaults_test.yaml: Comprehensive verification of all default
      values across all resources to prevent accidental changes. Covers
      deployment, service, serviceAccount, persistence, probes, labels,
      API versions, critical defaults (80+ tests)
    
    Integration scenarios tested:
    1. DLNA Home Media Server (hostNetwork, NodePort, NAS storage)
    2. Secure Production (NetworkPolicy, security contexts, resources, ingress+TLS)
    3. Kubernetes with Prometheus (metrics, ServiceMonitor, custom NetworkPolicy)
    4. IPv6-only cluster (SingleStack IPv6)
    5. Dual-stack networking (IPv4+IPv6, LoadBalancer)
    6. Development environment (emptyDir, latest tag, debug logging)
    7. High Availability attempt (multiple replicas, ReadWriteMany, pod anti-affinity)
    8. AWS with IRSA (EKS role annotations, gp3 storage, NLB, ALB ingress)
    9. GCP with Workload Identity (GKE service account annotations)
    10. Air-gapped environment (private registry, restrictive NetworkPolicy)
    11. Minimal resource-constrained (low CPU/memory limits, emptyDir)
    12. Gateway API (HTTPRoute with multiple hostnames)
    
    Regression tests lock down:
    - All default values: replicas=1, revisionHistoryLimit=3, ClusterIP service,
      port 8096, IfNotPresent pullPolicy, ClusterFirst dnsPolicy
    - Persistence defaults: config 5Gi, media 25Gi, cache emptyDir
    - Probe defaults: startup (tcpSocket, 0/10/30), liveness/readiness (httpGet)
    - Feature flags: DLNA off, metrics off, NetworkPolicy off, ServiceMonitor off
    - API versions and naming patterns
    - Critical invariants that must never change
    
    Total: 2 new test files, 130+ new test cases
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(charts): add deployment parameter tests and validation suite
    Phase 3: Create comprehensive tests for remaining deployment parameters
    and validation of mutual exclusions.
    
    New test files:
    - deployment_resources_test.yaml: Resources (CPU/memory/GPU), extra volumes,
      volume mounts, sidecar containers (70+ tests)
    - deployment_image_test.yaml: Image repository, tag, pullPolicy,
      imagePullSecrets for various registries (60+ tests)
    - deployment_jellyfin_test.yaml: Jellyfin-specific config including DLNA,
      metrics lifecycle hooks, command/args/env variables (70+ tests)
    - deployment_metadata_test.yaml: Names, labels, annotations, deployment
      strategy, revision history, replica count (70+ tests)
    - validation_mutual_exclusions_test.yaml: Critical validation tests using
      failedTemplate for NetworkPolicy conflicts, ServiceMonitor dependencies,
      persistence validations, port ranges (80+ tests)
    
    Critical validations tested:
    - NetworkPolicy vs DLNA/hostNetwork mutual exclusion (failedTemplate)
    - ServiceMonitor requires both metrics.enabled AND serviceMonitor.enabled
    - DLNA automatically enables hostNetwork and sets correct dnsPolicy
    - Persistence type validations (pvc/hostPath/emptyDir)
    - Port range validations (service.port: 1-65535, nodePort: 30000-32767)
    - DNS policy automatic configuration based on hostNetwork
    
    Edge cases covered:
    - Empty configuration arrays/objects
    - Multiple image pull secrets
    - Various env variable types (value, secretKeyRef, configMapKeyRef, fieldRef)
    - GPU and ephemeral-storage resources
    - All service types (ClusterIP, NodePort, LoadBalancer, ExternalName)
    
    Total: 5 new test files, 350+ new test cases
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(charts): add critical resource tests (ingress, serviceaccount, servicemonitor, security, scheduling)
    Phase 2: Create comprehensive tests for critical resources that had no
    coverage previously.
    
    New test files:
    - ingress_test.yaml: Full ingress coverage including className, annotations,
      hosts, paths, pathTypes, TLS, edge cases (70+ tests)
    - serviceaccount_test.yaml: ServiceAccount creation, custom names,
      annotations (AWS IRSA, GCP Workload Identity, Azure), automount settings,
      integration with deployment (60+ tests)
    - servicemonitor_test.yaml: Prometheus ServiceMonitor with dependencies,
      labels, endpoints, intervals, TLS, relabeling, metricRelabeling (70+ tests)
    - deployment_security_test.yaml: Pod and container security contexts,
      capabilities, host privileges (hostNetwork/IPC/PID), runtime and priority
      classes, DLNA scenarios (30+ tests)
    - deployment_scheduling_test.yaml: Node selector, tolerations, affinity
      (node/pod/podAnti), DNS policy and config, complete scenarios (30+ tests)
    
    Critical validations added:
    - ServiceMonitor requires both metrics.enabled AND serviceMonitor.enabled
    - hostNetwork automatically sets dnsPolicy to ClusterFirstWithHostNet
    - Ingress pathType validation (Prefix, Exact, ImplementationSpecific)
    - ServiceAccount integration with AWS IRSA, GCP WI, Azure WI
    
    Total: 5 new test files, 260+ new test cases
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(charts): comprehensive test improvements and expansions
    Phase 1: Improve and expand existing test coverage with edge cases,
    validations, and regression tests.
    
    Changes:
    - Rename cache_persistence_test → persistence_test with full coverage
      for config, media, and cache persistence (60+ tests)
    - Rename service_ipv6_test → service_test with full service coverage
      including types, ports, annotations, LoadBalancer settings (80+ tests)
    - Rename startup_probe_test → probes_test covering all three probe types:
      startup, liveness, readiness with all configurations (60+ tests)
    - Expand networkpolicy_test with IPv4/IPv6 CIDR validations, egress
      restrictions, and edge cases (+13 tests)
    - Expand init_containers_test with full container spec and merge order
      validation (+5 tests)
    - Expand envfrom_test with prefix, optional, and multiple source
      combinations (+9 tests)
    
    Test coverage improvements:
    - All edge cases for persistence types (pvc, hostPath, emptyDir)
    - Service type validation (ClusterIP, NodePort, LoadBalancer, ExternalName)
    - Probe types validation (httpGet, tcpSocket, exec)
    - NetworkPolicy CIDR format validation (IPv4/IPv6)
    - Comprehensive regression tests for default behavior
    
    Total: 6 improved test files, 230+ new test cases
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • Merge upstream/master-vnext into feature/add-network-policy
    Resolve conflicts by combining NetworkPolicy feature with all features from
    master-vnext integration branch:
    - NetworkPolicy support (this branch)
    - HTTPRoute support
    - envFrom support
    - Startup probe
    - Cache persistence
    - IPv6 dual-stack
    - revisionHistoryLimit
    - initContainers deprecation
    
    Updated version to 3.0.0 and merged all changelog entries.
    Regenerated README.md from template.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(deployment): add revisionHistoryLimit tests and deployment notes
    Add helm-unittest tests for revisionHistoryLimit:
    - Default value (3) verification
    - Custom values support (0, 1, 5, 100)
    - Ability to disable revision history
    
    Add NOTES.txt with revisionHistoryLimit information:
    - Show configured revision history limit
    - Warning when disabled (0)
    - Note for minimal history (1)
    - Rollback command example for normal values
    
    This parameter controls how many old ReplicaSets are retained
    for rollback purposes, reducing etcd storage usage.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(env): add envFrom support tests and deployment notes
    Add helm-unittest tests for envFrom functionality:
    - No envFrom by default
    - ConfigMap reference support
    - Secret reference support
    - Multiple envFrom sources
    - Optional ConfigMap/Secret support
    - Prefix support for variable namespacing
    - Compatibility with regular env variables
    
    Add NOTES.txt with envFrom information:
    - Show count of envFrom sources
    - List each source (ConfigMap or Secret)
    - Display optional and prefix settings
    
    Tests ensure envFrom works correctly for loading environment
    variables from ConfigMaps and Secrets.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(init): add tests for initContainers deprecation and extraInitContainers
    Add helm-unittest tests for init containers:
    - No init containers by default
    - extraInitContainers support (single and multiple)
    - Full container spec preservation (command, args, volumeMounts, securityContext)
    - Backward compatibility with deprecated initContainers parameter
    - Merging of initContainers and extraInitContainers
    - Correct ordering when both are specified
    
    Add NOTES.txt with init containers information:
    - Show count of configured init containers
    - Deprecation warning when old initContainers parameter is used
    - Migration guidance to extraInitContainers
    
    This fixes the critical bug where extraInitContainers didn't work and
    provides clear migration path from deprecated initContainers.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(probes): add startup probe tests and deployment notes
    Add helm-unittest tests for startup probe:
    - Default configuration verification (tcpSocket, timing)
    - Custom timing parameters (initialDelaySeconds, periodSeconds, failureThreshold)
    - Alternative probe types (httpGet)
    - Custom port support
    - Timeout window calculation
    
    Add NOTES.txt with startup probe information:
    - Display max startup time calculation
    - Explain startup probe purpose for large libraries
    - Warning for very long startup timeouts
    
    Tests ensure startup probe works correctly for slow initial startup scenarios.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(persistence): add comprehensive cache volume tests
    Add helm-unittest tests for dedicated cache volume persistence:
    - Default emptyDir behavior
    - PVC creation when enabled
    - hostPath configuration
    - Volume mount verification
    - PVC size, access mode, storage class configuration
    - Annotations support
    - Existing claim usage
    - Type-specific behavior (pvc vs hostPath vs emptyDir)
    
    Add NOTES.txt with persistence information:
    - Show config, media, and cache volume types
    - Display cache volume details when enabled
    - Benefits explanation for cache volume
    - Warning for hostPath usage
    
    Tests ensure cache persistence works correctly for all scenarios.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(service): add IPv6 and dual-stack configuration tests
    Add helm-unittest tests for IPv6 and dual-stack Service configuration:
    - Default behavior (no ipFamilyPolicy/ipFamilies set)
    - SingleStack, PreferDualStack, RequireDualStack policies
    - IPv4 only, IPv6 only configurations
    - Dual-stack with IPv4 primary and IPv6 primary
    - Combined policy and families configurations
    
    Add NOTES.txt with IPv6/dual-stack information:
    - Display configured IP family policy
    - Show IP families list
    - Warning when IPv6 is primary (probe compatibility note)
    - Warning when IPv6 used without policy
    
    Tests ensure IPv6 and dual-stack work correctly for all scenarios.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(httproute): add comprehensive unit tests and deployment notes
    Add helm-unittest test suite for HTTPRoute (Gateway API) covering:
    - Not created by default (enabled: false)
    - Created when enabled with required configuration
    - Annotations support
    - parentRefs configuration (name, namespace, sectionName)
    - Hostnames support (single and multiple)
    - Path matching rules (PathPrefix, Exact)
    - Multiple rules and multiple matches per rule
    - Backend references to Jellyfin service
    - Custom service port handling
    
    Add NOTES.txt with HTTPRoute-specific deployment information:
    - Gateway references and configuration status
    - Configured hostnames
    - Number of routes
    - Backend service details
    - Access URLs when hostnames configured
    - Warnings for missing parentRefs
    
    Tests ensure HTTPRoute works correctly across all Gateway API scenarios.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>
  • test(networkpolicy): add comprehensive helm-unittest test suite
    Add 20+ unit tests for NetworkPolicy template covering:
    
    Creation conditions:
    - Not created by default (enabled: false)
    - Created when enabled: true
    - Fails with clear error when hostNetwork + NetworkPolicy enabled
    - Fails when DLNA + NetworkPolicy enabled
    
    Ingress rules:
    - Default allowExternal behavior (no 'from' restriction)
    - Restricted access with podSelector/namespaceSelector
    - Custom ingress rules application
    - Automatic Prometheus ingress when metrics enabled
    - Prometheus namespace selector when specified
    
    Egress rules:
    - DNS egress with default kube-system/kube-dns
    - Custom DNS namespace and pod selector
    - AllowAllEgress default behavior
    - Restricted egress modes (metadata, in-cluster)
    - Custom CIDR blocks
    - Custom egress rules application
    - DNS disabled scenario
    
    Policy configuration:
    - Correct policyTypes (Ingress, Egress)
    - Pod selector labels matching chart labels
    
    Tests ensure NetworkPolicy works correctly across all supported
    configurations and fails safely when misconfigured.
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    Signed-off-by: Aleksei Sviridkin <f@lex.la>