Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CFP: unittest helm chart #27514

Closed
tvonhacht-apple opened this issue Aug 15, 2023 · 2 comments
Closed

CFP: unittest helm chart #27514

tvonhacht-apple opened this issue Aug 15, 2023 · 2 comments
Labels
area/helm Impacts helm charts and user deployment experience kind/cfp kind/feature This introduces new functionality. sig/agent Cilium agent related. stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.

Comments

@tvonhacht-apple
Copy link
Contributor

tvonhacht-apple commented Aug 15, 2023

Cilium Feature Proposal

Thanks for taking time to make a feature proposal for Cilium! If you have usage questions, please try the slack channel and see the FAQ first.

Is your proposed feature related to a problem?

Making a helm chart change in any of the templates files, can not be tested until actually run against a cluster.
For example this simple change that was done, was hard to debug, because I could only really see rendered templates when deploying it to a cluster. #27229

Describe the feature you'd like

I want to be able to test helm chart locally without needing to run it against a cluster, easily see all areas my change is impacting the chart, as well as being able to validate via a check that no changes in helm-chart without updating snapshots have been done.

Describe your proposed solution

I would like to use helm unittest, a common plugin used for testing helm charts in the open source community.

Example unittest for `spire/agent/daemonset.yaml

# install/kubernetes/cilium/tests/spire/agent/daemonset.yaml
suite: spire agent daemonset
templates:
  - spire/agent/daemonset.yaml
tests:
  - it: Should not render
    asserts:
      - hasDocuments:
          count: 0

  - it: enabled
    set:
      authentication:
        mutual:
          spire:
            enabled: true
    asserts:
     - matchSnapshot: {}

## This would have been added to test the new flag as added by above PR referenced to test that rendered template with this settings works
  - it: tolerations
    set:
      authentication:
        mutual:
          spire:
            enabled: true
            agent:
              tolerations:
                - operator: Exists
    asserts:
     - matchSnapshot: {}

via helm unittest --update -3 install/kubernetes/cilium/. we could auto generate the snapshots and changes would be part of the PR, easy to review

# install/kubernetes/cilium/tests/snapshots/spire/agent/daemonset.yaml.snap
enabled:
  1: |
    kind: DaemonSet
    metadata:
      name: spire-agent
      # ...
tolerations:
  1: |
    kind: DaemonSet
    metadata:
      name: spire-agent
      # ...
    spec:
      selector:
        matchLabels:
          app: spire-agent
      template:
        metadata:
          namespace: {{ .Values.authentication.mutual.spire.install.namespace }}
          labels:
            app: spire-agent
        spec:
          # ...
          tolerations:
             - operator: Exists

PRB check

helm unittest -3 install/kubernetes/cilium/.

If this is approved, would be happy to create an initial setup with default tests for every object

Once the CFP is close to being finalized, please add it as a PR to the design-cfps repo for final approval.

@tvonhacht-apple tvonhacht-apple added the kind/feature This introduces new functionality. label Aug 15, 2023
@ti-mo ti-mo added area/helm Impacts helm charts and user deployment experience sig/agent Cilium agent related. kind/cfp labels Aug 16, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not
had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Oct 16, 2023
@github-actions
Copy link

This issue has not seen any activity since it was marked stale.
Closing.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm Impacts helm charts and user deployment experience kind/cfp kind/feature This introduces new functionality. sig/agent Cilium agent related. stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.
Projects
None yet
Development

No branches or pull requests

2 participants