9.6 KiB
helm-deployment Specification
Purpose
TBD - created by archiving change update-helm-chart-best-practices. Update Purpose after archive.
Requirements
Requirement: Configuration Values Structure
The Helm chart SHALL provide a comprehensive values.yaml structure that exposes all configuration options documented in the README.
Scenario: All environment variables configurable
- WHEN a user deploys the chart
- THEN values.yaml MUST include sections for: config (adminToken, jwtSecret, ports), k8s (enabled), ws (enabled), api (enabled), tcp (enabled), oidc (all 8 variables), and redis (all 5 variables)
Scenario: Default values match README defaults
- WHEN a user deploys without custom values
- THEN environment variables MUST default to values documented in README (e.g., K8S_ENABLED=true in K8s context, HTTP_PORT=8883, TCP_PORT=1883)
Requirement: Persistent Volume Support
The chart SHALL support optional persistent storage for the /data directory with configurable storage class.
Scenario: Enable persistence with default storage class
- WHEN
persistence.enabled=trueis set - THEN a PersistentVolumeClaim MUST be created and mounted to
/datain the container
Scenario: Custom storage class
- WHEN
persistence.storageClassis specified - THEN the PVC MUST request that storage class
Scenario: Configurable volume size
- WHEN
persistence.sizeis specified - THEN the PVC MUST request that storage size (default: 1Gi)
Scenario: Persistence disabled by default
- WHEN no persistence configuration is provided
- THEN no PVC MUST be created and deployment uses emptyDir or no volume
Requirement: Resource Management
The chart SHALL support Kubernetes resource limits and requests configuration.
Scenario: Resource limits configurable
- WHEN
resources.limits.cpuorresources.limits.memoryare set - THEN the deployment MUST include these resource limits
Scenario: Resource requests configurable
- WHEN
resources.requests.cpuorresources.requests.memoryare set - THEN the deployment MUST include these resource requests
Scenario: Default resources
- WHEN no resources are specified
- THEN the deployment MUST NOT set resource constraints (Kubernetes default behavior)
Requirement: Pod Scheduling
The chart SHALL support standard Kubernetes pod scheduling options.
Scenario: Node selector support
- WHEN
nodeSelectorvalues are provided - THEN the deployment MUST include the node selector configuration
Scenario: Tolerations support
- WHEN
tolerationsarray is provided - THEN the deployment MUST include the tolerations
Scenario: Affinity support
- WHEN
affinityconfiguration is provided - THEN the deployment MUST include the affinity rules
Requirement: Health Probes
The chart SHALL support configurable liveness and readiness probes.
Scenario: HTTP probes when API enabled
- WHEN
api.enabled=trueand probes are enabled - THEN liveness and readiness probes MUST use HTTP GET on
/healthendpoint
Scenario: TCP probes as fallback
- WHEN
api.enabled=falseand probes are enabled - THEN liveness and readiness probes MUST use TCP socket checks on configured ports
Scenario: Configurable probe parameters
- WHEN probe values (
initialDelaySeconds,periodSeconds,timeoutSeconds) are set - THEN the deployment MUST use these probe configurations
Scenario: Probes can be disabled
- WHEN
livenessProbe.enabled=falseorreadinessProbe.enabled=false - THEN the respective probe MUST be omitted from the deployment
Requirement: Security Context
The chart SHALL support security context configuration following Kubernetes security best practices.
Scenario: Pod security context
- WHEN
podSecurityContextvalues are provided - THEN the deployment MUST apply these security settings at pod level
Scenario: Container security context
- WHEN
securityContextvalues are provided - THEN the deployment MUST apply these security settings at container level
Scenario: Default security settings
- WHEN no security context is specified
- THEN the deployment SHOULD use secure defaults (runAsNonRoot, non-root UID)
Requirement: Service Configuration
The chart SHALL support configurable service types and settings for both HTTP and TCP services.
Scenario: HTTP service type configurable
- WHEN
service.http.typeis set to LoadBalancer, ClusterIP, or NodePort - THEN the HTTP service MUST use that service type
Scenario: TCP service type configurable
- WHEN
service.tcp.typeis set to LoadBalancer, ClusterIP, or NodePort - THEN the TCP service MUST use that service type
Scenario: Service annotations
- WHEN
service.http.annotationsorservice.tcp.annotationsare provided - THEN the respective services MUST include those annotations
Scenario: Service ports configurable
- WHEN
service.http.portorservice.tcp.portare specified - THEN the services MUST expose those external ports (targeting container ports from config)
Requirement: ServiceAccount Management
The chart SHALL create and manage a ServiceAccount for the deployment with configurable name and annotations.
Scenario: ServiceAccount creation
- WHEN the chart is deployed
- THEN a ServiceAccount resource MUST be created
Scenario: ServiceAccount name configurable
- WHEN
serviceAccount.nameis specified - THEN the ServiceAccount and deployment MUST use that name
Scenario: ServiceAccount annotations
- WHEN
serviceAccount.annotationsare provided - THEN the ServiceAccount MUST include those annotations (useful for IRSA, Workload Identity)
Requirement: Ingress Support
The chart SHALL support optional Ingress configuration for exposing the HTTP API.
Scenario: Ingress creation
- WHEN
ingress.enabled=true - THEN an Ingress resource MUST be created
Scenario: Ingress host configuration
- WHEN
ingress.hostsarray is provided - THEN the Ingress MUST include rules for those hosts
Scenario: Ingress TLS
- WHEN
ingress.tlsconfiguration is provided - THEN the Ingress MUST include TLS settings with specified secret names
Scenario: Ingress class
- WHEN
ingress.classNameis specified - THEN the Ingress MUST use that ingress class
Scenario: Ingress annotations
- WHEN
ingress.annotationsare provided - THEN the Ingress MUST include those annotations (e.g., for cert-manager, nginx settings)
Requirement: Labels and Annotations
The chart SHALL apply standard Helm and Kubernetes labels following best practices.
Scenario: Standard labels applied
- WHEN resources are created
- THEN they MUST include labels:
app.kubernetes.io/name,app.kubernetes.io/instance,app.kubernetes.io/version,app.kubernetes.io/managed-by
Scenario: Custom labels support
- WHEN
commonLabelsare defined in values - THEN all resources MUST include these additional labels
Scenario: Custom annotations support
- WHEN
commonAnnotationsare defined in values - THEN all resources MUST include these additional annotations
Requirement: Environment Variable Mapping
The chart SHALL correctly map all values.yaml configuration to container environment variables matching README documentation.
Scenario: Admin and JWT configuration
- WHEN
config.adminTokenorconfig.jwtSecretare set - THEN environment variables
ADMIN_TOKENandJWT_SECRETMUST be set in the container
Scenario: Feature toggles
- WHEN
k8s.enabled,ws.enabled,api.enabled, ortcp.enabledare set - THEN corresponding environment variables
K8S_ENABLED,WS_ENABLED,API_ENABLED,TCP_ENABLEDMUST be set as string "true" or "false"
Scenario: Port configuration
- WHEN
config.httpPortorconfig.tcpPortare set - THEN environment variables
HTTP_PORTandTCP_PORTMUST be set
Scenario: OIDC configuration
- WHEN OIDC values (
oidc.enabled,oidc.discovery, etc.) are provided - THEN all 8 OIDC environment variables MUST be set correctly
Scenario: Redis configuration
- WHEN Redis values (
redis.enabled,redis.host, etc.) are provided - THEN all 5 Redis environment variables MUST be set correctly
Scenario: Sensitive values from secrets
- WHEN
config.jwtSecret,config.adminToken,oidc.clientSecret, orredis.passwordreference existing secrets - THEN the deployment MUST use valueFrom/secretKeyRef to inject these values
Requirement: Template Syntax Correctness
The chart templates SHALL use correct Helm template syntax without errors.
Scenario: Valid Go template syntax
- WHEN templates are rendered with
helm template - THEN no syntax errors MUST occur
Scenario: No spacing in template delimiters
- WHEN examining template files
- THEN template expressions MUST use
{{and}}without internal spaces (e.g.,{{ .Value }}not{ { .Value } })
Requirement: Chart Validation
The chart SHALL pass Helm linting and validation checks.
Scenario: Helm lint passes
- WHEN
helm lintis run on the chart - THEN no errors MUST be reported
Scenario: Chart renders successfully
- WHEN
helm templateis run with default values - THEN valid Kubernetes manifests MUST be produced
Scenario: Chart renders with custom values
- WHEN
helm templateis run with various custom values combinations - THEN valid Kubernetes manifests MUST be produced without errors