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

introduce ct for local helm install test #911

Merged
merged 1 commit into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:

# Need a multi node cluster so descheduler runs until evictions
- name: Create multi node Kind cluster
run: |
kind create cluster --name kind --config ./hack/kind_config.yaml --wait 2m
run: make kind-multi-node

# helm-extra-set-args only available after ct 3.6.0
- name: Run chart-testing (install)
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,6 @@ test-helm: ensure-helm-install

kind-multi-node:
kind create cluster --name kind --config ./hack/kind_config.yaml --wait 2m

ct-helm:
./hack/verify-chart.sh
30 changes: 0 additions & 30 deletions charts/descheduler/templates/tests/test-descheduler-pod.yaml

This file was deleted.

22 changes: 10 additions & 12 deletions docs/contributor-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ make test-unit
make test-e2e
```

## Run Helm Tests
Run the helm test for a particular descheduler release by setting below variables,
```
HELM_IMAGE_REPO="descheduler"
HELM_IMAGE_TAG="helm-test"
HELM_CHART_LOCATION="./charts/descheduler"
```
The helm tests runs as part of descheduler CI. But, to run it manually from the descheduler root,

```
make test-helm
```

## Build Helm Package locally

Expand All @@ -68,5 +56,15 @@ To check linting of your changes in the helm chart locally you can run:
make lint-helm
```

## Test helm changes locally with kind and ct

You will need kind and docker (or equivalent) installed. We can use ct public image to avoid installing ct and all its dependencies.


```
make kind-multi-node
make ct-helm
```

### Miscellaneous
See the [hack directory](https://github.com/kubernetes-sigs/descheduler/tree/master/hack) for additional tools and scripts used for developing the descheduler.
1 change: 1 addition & 0 deletions hack/verify-chart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker run -it --rm --network host --workdir=/data --volume ~/.kube/config:/root/.kube/config:ro --volume $(pwd):/data quay.io/helmpack/chart-testing:v3.7.0 /bin/bash -c "git config --global --add safe.directory /data; ct install --config=.github/ci/ct.yaml --helm-extra-set-args=\"--set=kind=Deployment --set=podSecurityPolicy.create=false\""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily needed in this PR. Though, it would be great to introduce CONTAINER_ENGINE var in the Makefile so we can use e.g. podman instead of the docker.

Copy link
Contributor

@ingvagabund ingvagabund Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ make ct-helm
./hack/verify-chart.sh
Trying to pull quay.io/helmpack/chart-testing:v3.7.0...
Getting image source signatures
Copying blob 530afca65e2e done  
Copying blob 8fc6dd0270c7 done  
Copying blob 11468c6e8c15 done  
Copying blob 44f8ddf0f4fd done  
Copying blob becf289968d8 done  
Copying blob ef1d4f4b02fd done  
Copying blob 1e4c4ffbf3ee done  
Copying blob dff19b98de5f done  
Copying blob d2ab7f174e47 done  
Copying blob 4f4fb700ef54 done  
Copying config 30a5ebe114 done  
Writing manifest to image destination
Storing signatures
Installing charts...
Error: Error loading configuration: Error loading config file: open .github/ci/ct.yaml: permission denied
Error loading configuration: Error loading config file: open .github/ci/ct.yaml: permission denied
make: *** [Makefile:158: ct-helm] Error 1

Not sure whether this is related to running podman instead of docker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With podman I got this

./hack/verify-chart.sh
ERRO[0000] cannot find UID/GID for user lucas: open /etc/subuid: no such file or directory - check rootless mode in man pages. 
WARN[0000] Using rootless single mapping into the namespace. This might break some images. Check /etc/subuid and /etc/subgid for adding sub*ids if not using a network user 
Trying to pull quay.io/helmpack/chart-testing:v3.7.0...
Getting image source signatures
Copying blob 11468c6e8c15 done  
Copying blob ef1d4f4b02fd done  
Copying blob 44f8ddf0f4fd done  
Copying blob 530afca65e2e done  
Copying blob becf289968d8 done  
Copying blob 8fc6dd0270c7 done  
Copying blob 1e4c4ffbf3ee done  
Copying blob d2ab7f174e47 done  
Copying blob dff19b98de5f done  
Copying blob 4f4fb700ef54 done  
Error: writing blob: adding layer with blob "sha256:530afca65e2ea04227630ae746e0c85b2bd1a179379cbf2b6501b49c4cab2ccc": Error processing tar file(exit status 1): potentially insufficient UIDs or GIDs available in user namespace (requested 0:42 for /etc/shadow): Check /etc/subuid and /etc/subgid if configured locally and run podman-system-migrate: lchown /etc/shadow: invalid argument
make: *** [Makefile:158: ct-helm] Error 125

Have you tried this with docker? We can introduce that variable and also podman support in a followup PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it was about running podman with sudo in my case, It just worked after adding sudo (or adding my user to the right group).

Copy link
Contributor Author

@knelasevero knelasevero Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, that error of yours does not make much sense 🤔 that file is 644, so it is readable by all 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selinux was the culprit :)

37 changes: 0 additions & 37 deletions test/run-helm-tests.sh

This file was deleted.