Skip to content

Add tests for Kubernetes Helm value rendering #71

Description

@MuttleyD

Context

The MIDAS Helm chart now renders a numeric non-root pod security context by default. This was added after local kind validation showed that Kubernetes could not start the MIDAS distroless image when runAsNonRoot: true was set without numeric runAsUser and runAsGroup values.

The chart is currently validated manually with:

helm lint charts/midas
helm template midas charts/midas --namespace midas -f examples/kubernetes/kind-values.yaml

A small test would help prevent future changes from accidentally removing or breaking the rendered security context.

Scope

Add or extend a test that renders the Helm chart and verifies the Deployment includes the expected pod security context.

The test should confirm that the rendered Deployment includes:

securityContext:
  runAsNonRoot: true
  runAsUser: 65532
  runAsGroup: 65532
  seccompProfile:
    type: RuntimeDefault

It should also confirm the container hardening remains present:

allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
  drop:
    - ALL

Recommended area to inspect first:

cmd/midas/helm_pool_values_test.go
charts/midas/values.yaml
charts/midas/templates/deployment.yaml

Acceptance Criteria

  • A test verifies the chart renders numeric non-root pod security context values.
  • A test verifies the container security context still disables privilege escalation, uses a read-only root filesystem, and drops capabilities.
  • The test uses the existing test style in the repository.
  • No runtime behaviour is changed.
  • No chart values are changed unless the test reveals a clear existing mismatch.
  • go test ./cmd/midas passes.
  • helm lint charts/midas passes if Helm is available.
  • git diff --check passes.

Out of Scope

  • Changing the Helm chart security model.
  • Adding new Helm features.
  • Adding CI infrastructure.
  • Adding Kubernetes runtime tests.
  • Changing Docker image behaviour.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions