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

Add helm test #527

Merged
merged 2 commits into from
May 19, 2021
Merged

Add helm test #527

merged 2 commits into from
May 19, 2021

Conversation

pravarag
Copy link
Contributor

This PR Fixes: #440

As part of this PR, we are enabling support for helm test which will be run as part of CI. A new script to run helm tests has been added under tests/ directory using the kind cluster. Also, Makefile has been updated to add support for helm test as a separate check.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 14, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @pravarag. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 14, 2021
@@ -0,0 +1,44 @@
# Copyright 2017 The Kubernetes Authors.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Copyright 2017 The Kubernetes Authors.
# Copyright 2021 The Kubernetes Authors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the license year

@seanmalloy
Copy link
Member

/kind cleanup

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Mar 16, 2021
Comment on lines 26 to 32
export KUBECONFIG="$(kind get kubecofnig-path)"
docker pull kubernetes/pause
kind load docker-image kubernetes/pause
kind get kubeconfig > /tmp/admin.conf
export KUBECONFIG="/tmp/admin.conf"
mkdir -p ~/gopath/src/sigs.k8s.io/
mv ~/gopath/src/github.com/kubernetes-sigs/descheduler ~/gopath/src/sigs.k8s.io/.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export KUBECONFIG="$(kind get kubecofnig-path)"
docker pull kubernetes/pause
kind load docker-image kubernetes/pause
kind get kubeconfig > /tmp/admin.conf
export KUBECONFIG="/tmp/admin.conf"
mkdir -p ~/gopath/src/sigs.k8s.io/
mv ~/gopath/src/github.com/kubernetes-sigs/descheduler ~/gopath/src/sigs.k8s.io/.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seanmalloy shall I keep this line: export KUBECONFIG="$(kind get kubecofnig-path)" or remove that one too? I'm guessing since we aren't running kubectl commands so that might not be required right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the code by removing mentioned lines.

mkdir -p ~/gopath/src/sigs.k8s.io/
mv ~/gopath/src/github.com/kubernetes-sigs/descheduler ~/gopath/src/sigs.k8s.io/.
fi
PRJ_PREFIX="sigs.k8s.io/descheduler"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
PRJ_PREFIX="sigs.k8s.io/descheduler"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

#!/bin/bash

# This runs helm tests for a release using `helm test` command
if [[ -n "${KIND_E2E}" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need this conditional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the conditional with latest push.

@pravarag
Copy link
Contributor Author

@seanmalloy I've updated the code as per review comments. Also, I'm guessing the script should run during any changes to PR are being done, so is that the only way to test it or I can still test it in my local?

@seanmalloy
Copy link
Member

@seanmalloy I've updated the code as per review comments. Also, I'm guessing the script should run during any changes to PR are being done, so is that the only way to test it or I can still test it in my local?

Let's start with testing it locally.

Comment on lines 19 to 20
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
wget https://github.com/kubernetes-sigs/kind/releases/download/v0.9.0/kind-linux-amd64
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need kubectl, so I believe these lines can be removed.

Suggested change
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
wget https://github.com/kubernetes-sigs/kind/releases/download/v0.9.0/kind-linux-amd64

If you come up with a reason why running helm tests would need kubectl then these lines do not need to be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed kubectl download as suggested above.

#!/bin/bash

# This runs helm tests for a release using `helm test` command
K8S_VERSION=${KUBERNETES_VERSION:-v1.18.2}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
K8S_VERSION=${KUBERNETES_VERSION:-v1.18.2}
K8S_VERSION=${KUBERNETES_VERSION:-v1.20.2}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the K8s version with latest push.

@pravarag
Copy link
Contributor Author

@seanmalloy I've tested the changes for both the scenarios (helm test failed & helm test passed) and below are the logs,

For failure scenario:

 ->  sh -x ./test/run-helm-tests.sh
+ K8S_VERSION=v1.20.2
+ wget https://github.com/kubernetes-sigs/kind/releases/download/v0.9.0/kind-linux-amd64
./test/run-helm-tests.sh: line 19: wget: command not found
+ chmod +x kind-linux-amd64
chmod: cannot access 'kind-linux-amd64': No such file or directory
+ mv kind-linux-amd64 kind
mv: cannot stat 'kind-linux-amd64': No such file or directory
+ export PATH=/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/gawk/libexec/gnubin:/usr/local/opt/gsed/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/ed/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/Users/pravaragrawal/Work/go_work/src/k8s.io/kubernetes/third_party/etcd:/usr/local/bin:/usr/local/Cellar:/Users/pravaragrawal/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/go/1.15.2/libexec/bin:/Users/pravaragrawal/Work/go_work/bin:/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler
+ PATH=/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/gawk/libexec/gnubin:/usr/local/opt/gsed/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/ed/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/Users/pravaragrawal/Work/go_work/src/k8s.io/kubernetes/third_party/etcd:/usr/local/bin:/usr/local/Cellar:/Users/pravaragrawal/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/go/1.15.2/libexec/bin:/Users/pravaragrawal/Work/go_work/bin:/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler
+ echo /Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler
/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler
+ kind create cluster --image kindest/node:v1.20.2 --config=./hack/kind_config.yaml
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.20.2) 🖼
 ✓ Preparing nodes 📦 📦 📦
 ✓ Writing configuration 📜
 ✓ Starting control-plane 🕹️
 ✓ Installing CNI 🔌
 ✓ Installing StorageClass 💾
 ✓ Joining worker nodes 🚜
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Thanks for using kind! 😊
+ helm install descheduler-ci --namespace kube-system ./charts/descheduler
NAME: descheduler-ci
LAST DEPLOYED: Tue Mar 23 23:20:34 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Descheduler installed as a cron job.
+ helm test descheduler-ci
Error: release: not found
+ last_status=1
+ [[ ! -n '' ]]
+ echo 'Helm test failed'
Helm test failed
+ exit 1

So above, the helm-test failed as the command requires --namespace flag which I didn't give in first place and thus the flow failed to run helm test command for that particular release.

Success scenario,

 ->  sh -x ./test/run-helm-tests.sh
+ K8S_VERSION=v1.20.2
+ wget https://github.com/kubernetes-sigs/kind/releases/download/v0.9.0/kind-linux-amd64
./test/run-helm-tests.sh: line 19: wget: command not found
+ chmod +x kind-linux-amd64
chmod: cannot access 'kind-linux-amd64': No such file or directory
+ mv kind-linux-amd64 kind
mv: cannot stat 'kind-linux-amd64': No such file or directory
+ export PATH=/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/gawk/libexec/gnubin:/usr/local/opt/gsed/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/ed/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/Users/pravaragrawal/Work/go_work/src/k8s.io/kubernetes/third_party/etcd:/usr/local/bin:/usr/local/Cellar:/Users/pravaragrawal/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/go/1.15.2/libexec/bin:/Users/pravaragrawal/Work/go_work/bin:/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler
+ PATH=/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/gawk/libexec/gnubin:/usr/local/opt/gsed/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/ed/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/Users/pravaragrawal/Work/go_work/src/k8s.io/kubernetes/third_party/etcd:/usr/local/bin:/usr/local/Cellar:/Users/pravaragrawal/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/go/1.15.2/libexec/bin:/Users/pravaragrawal/Work/go_work/bin:/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler
+ echo /Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler
/Users/pravaragrawal/Work/go_work/src/github.com/pravarag/descheduler
+ kind create cluster --image kindest/node:v1.20.2 --config=./hack/kind_config.yaml
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.20.2) 🖼
 ✓ Preparing nodes 📦 📦 📦
 ✓ Writing configuration 📜
 ✓ Starting control-plane 🕹️
 ✓ Installing CNI 🔌
 ✓ Installing StorageClass 💾
 ✓ Joining worker nodes 🚜 e
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a nice day! 👋
+ helm install descheduler-ci --namespace kube-system ./charts/descheduler
NAME: descheduler-ci
LAST DEPLOYED: Tue Mar 23 23:26:47 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Descheduler installed as a cron job.
+ helm test descheduler-ci --namespace kube-system
NAME: descheduler-ci
LAST DEPLOYED: Tue Mar 23 23:26:47 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Descheduler installed as a cron job.
+ last_status=0
+ [[ 0 -eq 1 ]]
+ echo 'Helm test verified.'
Helm test verified.
+ kind delete cluster
Deleting cluster "kind" ...

In above logs, we can ignore the error for wget since I'm testing on an OSX system and I think that's the reason that command might be failing. Otherwise, rest looks fine.
I've pushed the latest code with few minor changes, kindly let me know if any further testing is required or not.

@pravarag pravarag marked this pull request as ready for review March 23, 2021 18:02
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 23, 2021
@seanmalloy
Copy link
Member

@pravarag the changes you have so far looks good.

I think you just need to create a helm test file now. See below link for an example.
https://helm.sh/docs/topics/chart_tests/#example-test

You could create a file named charts/descheduler/templates/tests/test-descheduler-cronjob.yaml. I think we just need to come up with one simple test case. Let me know if you need any help coming up with a test case.

@pravarag
Copy link
Contributor Author

pravarag commented Mar 25, 2021

You could create a file named charts/descheduler/templates/tests/test-descheduler-cronjob.yaml. I think we just need to come up with one simple test case. Let me know if you need any help coming up with a test case.

@seanmalloy thanks for suggesting creation of new test for verifying helm test. So, I'm assuming that the test will basically verify if the pod created by descheduler-ci cronJob is up and running successfully or not - correct me if I'm wrong here.

Also, one observation - while trying to deploy the helm chart today in one of my local kind cluster I noticed the pod created by cronJob is not getting created and getting CreateContainerConfigError . Here's a describe of the pod events for the same,

->  kubectl get pods -nkube-system
NAME                                         READY   STATUS                       RESTARTS   AGE
coredns-74ff55c5b-dkqmk                      1/1     Running                      0          8m17s
coredns-74ff55c5b-v7gs9                      1/1     Running                      0          8m17s
descheduler-ci-1616664240-26tq8              0/1     CreateContainerConfigError   0          7m28s

 ->  kubectl describe pod descheduler-ci-1616664240-26tq8 -nkube-system
Name:                 descheduler-ci-1616664240-26tq8
Namespace:            kube-system
Priority:             2000000000
Priority Class Name:  system-cluster-critical
Node:                 kind-worker2/172.18.0.4
Start Time:           Thu, 25 Mar 2021 14:54:04 +0530
Labels:               app.kubernetes.io/instance=descheduler-ci
                      app.kubernetes.io/name=descheduler
                      controller-uid=7de8161b-eaec-43cc-a927-79bea4ee4296
                      job-name=descheduler-ci-1616664240
Annotations:          checksum/config: 85bcdbaaffd5c9abe2e01dc318936cb7c5fdaeca4e1b3c1a0391ea9028027d9a
Status:               Pending
IP:                   10.244.2.2
IPs:
  IP:           10.244.2.2
Controlled By:  Job/descheduler-ci-1616664240
Containers:
  descheduler:
    Container ID:
    Image:         k8s.gcr.io/descheduler/descheduler:v0.20.0
    Image ID:
    Port:          <none>
    Host Port:     <none>
    Command:
      /bin/descheduler
    Args:
      --policy-config-file
      /policy-dir/policy.yaml
      --v
      3
    State:          Waiting
      Reason:       CreateContainerConfigError
    Ready:          False
    Restart Count:  0
    Requests:
      cpu:        500m
      memory:     256Mi
    Environment:  <none>
    Mounts:
      /policy-dir from policy-volume (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from descheduler-ci-token-d4z8h (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  policy-volume:
    Type:      ConfigMap (a volume populated by a ConfigMap)
    Name:      descheduler-ci
    Optional:  false
  descheduler-ci-token-d4z8h:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  descheduler-ci-token-d4z8h
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                    From               Message
  ----     ------     ----                   ----               -------
  Normal   Scheduled  6m7s                   default-scheduler  Successfully assigned kube-system/descheduler-ci-1616664240-26tq8 to kind-worker2
  Normal   Pulling    6m6s                   kubelet            Pulling image "k8s.gcr.io/descheduler/descheduler:v0.20.0"
  Normal   Pulled     6m2s                   kubelet            Successfully pulled image "k8s.gcr.io/descheduler/descheduler:v0.20.0" in 3.998081107s
  Warning  Failed     3m48s (x12 over 6m2s)  kubelet            Error: container has runAsNonRoot and image will run as root (pod: "descheduler-ci-1616664240-26tq8_kube-system(51903ae7-ee89-4245-93d6-58849fac9802)", container: descheduler)
  Normal   Pulled     57s (x24 over 6m2s)    kubelet            Container image "k8s.gcr.io/descheduler/descheduler:v0.20.0" already present on machine

I'm thinking if it could be a problem specific to my cluster or in general?

@pravarag
Copy link
Contributor Author

@seanmalloy so I deployed the helm chart for v1.20 release as suggested here link and I can see that the descheduler-ci cronJob is working fine. Now, I wanted to check what can be put inside the test file which will be used for verifying descheduler cronJob. Like I mentioned, is it going to be something like - we'll verify if the pods status is marked as completed or not? Or, is the helm test going to be a cronJob which will run periodically and maybe check some endpoint to verify if the descheduler is working on that particular node using a curL maybe?

@seanmalloy
Copy link
Member

we'll verify if the pods status is marked as completed or not

yes, I believe that is a good first test.

@seanmalloy
Copy link
Member

Also, one observation - while trying to deploy the helm chart today in one of my local kind cluster I noticed the pod created by cronJob is not getting created and getting CreateContainerConfigError

I suggest modifying the script with the below commands

VERSION=helm-test make image
kind create cluster --image kindest/node:"${K8S_VERSION}" --config=./hack/kind_config.yaml
kind load docker-image descheduler:helm-test
helm install descheduler-ci --set image.repository=descheduler,image.tag=helm-test --namespace kube-system ./charts/descheduler

This will do a container image build and load it into the kind cluster. This will ensure that changes in the Dockerfile and helm chart are working together which will avoid the above mentioned CreateContainerConfigError error.

@pravarag pravarag force-pushed the add-helm-test branch 2 times, most recently from dbf5ae1 to 4bc99c3 Compare April 13, 2021 05:30
@pravarag
Copy link
Contributor Author

I've updated code as per review comments @seanmalloy

export PATH=$PATH:$PWD
kind create cluster --image kindest/node:"${K8S_VERSION}" --config=./hack/kind_config.yaml
kind load docker-image descheduler:helm-test
helm install descheduler-ci --set image.repository=descheduler,image.tag=helm-test --namespace kube-system ./charts/descheduler
Copy link
Member

Choose a reason for hiding this comment

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

Last change for this shell script ...

We want to be able to test different versions of the descheduler helm chart. For example a released version of the chart with released version of the container image. The CLI options you have are correct, and we want these to be the defaults.

So --set image.repository=descheduler needs a variable that can be overridden, --set image.tag=helm-test needs a variable. and the last parameters ./charts/descheduler needs a variable.

Let me know if you need more details. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with the latest push.

curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl &&
chmod +x ./kubectl &&
mv ./kubectl /usr/local/bin/kubectl &&
/usr/local/bin/kubectl get pods --namespace kube-system --token "$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" | grep "Completed"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/usr/local/bin/kubectl get pods --namespace kube-system --token "$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" | grep "Completed"
/usr/local/bin/kubectl get pods --namespace kube-system --token "$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" | grep "descheduler" | grep "Completed"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as suggested above.

@seanmalloy
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 14, 2021
@seanmalloy
Copy link
Member

@pravarag one more thing. Please add some documentation to https://github.com/kubernetes-sigs/descheduler/blob/master/docs/contributor-guide.md with instructions for running the helm tests. Thanks!

@pravarag pravarag force-pushed the add-helm-test branch 3 times, most recently from 6a8e740 to c05d36d Compare April 14, 2021 07:51
@pravarag
Copy link
Contributor Author

I've updated the code as per review comments and have added to the documentation as well @seanmalloy

@@ -39,5 +39,18 @@ make test-unit
make test-e2e
```

## Run Helm tests
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
## Run Helm tests
## Run Helm Tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with latest push

@@ -39,5 +39,18 @@ make test-unit
make test-e2e
```

## Run Helm tests
We can run the helm test for a particular descheduler release by setting below variables,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
We can run the helm test for a particular descheduler release by setting below variables,
Run the helm test for a particular descheduler release by setting below variables,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated with latest push.

## Run Helm tests
We can run the helm test for a particular descheduler release by setting below variables,
```
HELM_IMGAE_REPO="descheduler"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
HELM_IMGAE_REPO="descheduler"
HELM_IMAGE_REPO="descheduler"

```
HELM_IMGAE_REPO="descheduler"
HELM_IMAGE_TAG="helm-test"
CHARTS_PATH="./charts/descheduler"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
CHARTS_PATH="./charts/descheduler"
HELM_CHART_LOCATION="./charts/descheduler"

Comment on lines 21 to 24
HELM_IMAGE_REPO="descheduler"
HELM_IMAGE_TAG="helm-test"
CHARTS_PATH="./charts/descheduler"
VERSION=helm-test make image
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
HELM_IMAGE_REPO="descheduler"
HELM_IMAGE_TAG="helm-test"
CHARTS_PATH="./charts/descheduler"
VERSION=helm-test make image
IMAGE_REPO=${HELM_IMAGE_REPO:-descheduler}
IMAGE_TAG=${HELM_IMAGE_TAG:-helm-test}
CHART_LOCATION=${HELM_CHART_LOCATION:-./charts/descheduler}
VERSION=helm-test make image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

export PATH=$PATH:$PWD
kind create cluster --image kindest/node:"${K8S_VERSION}" --config=./hack/kind_config.yaml
kind load docker-image descheduler:helm-test
helm install descheduler-ci --set image.repository="${HELM_IMAGE_REPO}",image.tag="${HELM_IMAGE_TAG}" --namespace kube-system "${CHARTS_PATH}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
helm install descheduler-ci --set image.repository="${HELM_IMAGE_REPO}",image.tag="${HELM_IMAGE_TAG}" --namespace kube-system "${CHARTS_PATH}"
helm install descheduler-ci --set image.repository="${IMAGE_REPO}",image.tag="$IMAGE_TAG}" --namespace kube-system "${CHART_LOCATION}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code updated with latest push.

@seanmalloy
Copy link
Member

@pravarag I added some additional inline suggestions. I believe these are the last set of changes required before this PR gets merged. I'm hoping my suggestions result in a working script. :-)

Also, thanks again for your help. You are doing a great job.

@pravarag
Copy link
Contributor Author

pravarag commented Apr 15, 2021

@seanmalloy thanks for your review and suggestions, I've updated the code as per review comments. Also one more thing, do we need to add a separate CI check like you have mentioned here: #440 (comment) ?

@seanmalloy
Copy link
Member

@seanmalloy thanks for your review and suggestions, I've updated the code as per review comments. Also one more thing, do we need to add a separate CI check like you have mentioned here: #440 (comment) ?

We can sort out adding the helm test CI check after this PR merges. Being able to run the helm tests locally is the first step which is what this PR does. One thing to note is that I'm having some problems starting up kind clusters on my laptop, so I was not able to fully test the script.

Nice work!

/lgtm
/assign @damemi

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 23, 2021
@pravarag
Copy link
Contributor Author

@seanmalloy thanks for the review, let me know if any more testing is required from my end for the same.

@seanmalloy
Copy link
Member

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pravarag, seanmalloy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 19, 2021
@k8s-ci-robot k8s-ci-robot merged commit 31fd097 into kubernetes-sigs:master May 19, 2021
briend pushed a commit to briend/descheduler that referenced this pull request Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Helm Test To Descheduler Automated CI Checks
4 participants