-
Notifications
You must be signed in to change notification settings - Fork 42
Support for verification of the Helm charts using BDD approach #100
Support for verification of the Helm charts using BDD approach #100
Conversation
e2e/helm_charts_test.go
Outdated
|
||
func (ts *HelmChartTestSuite) podsManagedByDaemonSet() error { | ||
args := []string{ | ||
"get", "daemonsets", "--namespace=default", "-l", "app=" + ts.Name + "-" + ts.Name, "-o", "jsonpath='{.items[0].metadata.labels.chart}'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kuisathaverat is this enough to check that a DaemonSet exists for the chart?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only ensures that the DaemonSet is deployed, but the DaemonSet pods can be in fail, so you have to check if the number of scheduled pods is the same as the pods ready(maybe is redundant) and the pods available.
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#daemonset-v1-apps
kubectl get -n kube-system daemonset metricbeat -o jsonpath='{.status.currentNumberScheduled}'
kubectl get -n kube-system daemonset metricbeat -o jsonpath='{.status.numberAvailable}'
kubectl get -n kube-system daemonset metricbeat -o jsonpath='{.status.numberReady}'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it mean we are checking that k8s is doing its job? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, you are checking the configuration settings of the pods are correct and can deploy
# install kubectl | ||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use sudo
in a worker? Otherwise this will fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we can not, because of that we install everything in the Jenkins workspace job
this will work only with Helm 2.x, the commands are a little different for Helm 3.x |
I'm using Helm 3:
|
ouch!!, in that case, is the other way around would not work on Helm 2.x |
We will make the test to fail, instead of making the build to fail. On the other hand, we should add those tools to the linux workers to make the tests pass
It would be an implementation detail, so meaningless at high level perspective
…athaverat/metricbeat-tests-poc into kuisathaverat-99-helm-charts-verification
What is this PR doing?
It creates the first feature file and the implementation of the steps for verifying that the Elastic's Helm charts for Metricbeat are correct.
For that, each step in the feature file will represent each of the verification points required for the Helm chart.
The implementation of each step will leverage the local binaries for
helm
andkubectl
, so each step will run different commands for these tools reading the output and checking those values.The test cluster will be managed by kind, and the binaries needed for it (kind, kubectl, helm) are installed by the shell script that runs the e2e tests.
Why is it important?
We are going to manually verify the Helm charts, but adding this automated test suite will support the verification of the charts with any frequency: with a PR, on each release, on feature freeze, etc.
How to test this PR?
helm
andkubectl
installed in your local machine.e2e
directory, run:Related issues