Skip to content

Commit 91b445e

Browse files
committed
e2e tests: cont
1 parent cb36269 commit 91b445e

File tree

4 files changed

+101
-48
lines changed

4 files changed

+101
-48
lines changed

deployment/pcm/Makefile

Lines changed: 70 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2+
chart-lint-report.txt: values.yaml templates
3+
docker run -ti --rm -w /pcm -v `realpath $(PWD)/../..`:/pcm quay.io/helmpack/chart-testing ct lint --charts deployment/pcm --validate-maintainers=false | tee chart-lint-report.txt
4+
5+
#
6+
# kind cluster targets
7+
#
18
# https://stackoverflow.com/questions/649246/is-it-possible-to-create-a-multi-line-string-variable-in-a-makefile
29
define KIND_EXTRA_MOUNTS
310
nodes:
@@ -7,9 +14,6 @@ nodes:
714
containerPath: /sys/fs/resctrl
815
endef
916

10-
chart-lint-report.txt: values.yaml templates
11-
docker run -ti --rm -w /pcm -v `realpath $(PWD)/../..`:/pcm quay.io/helmpack/chart-testing ct lint --charts deployment/pcm --validate-maintainers=false | tee chart-lint-report.txt
12-
1317
export KIND_EXTRA_MOUNTS
1418
_kind_with_registry.sh:
1519
curl -sl https://kind.sigs.k8s.io/examples/kind-with-registry.sh -o _kind_with_registry.sh.tmp
@@ -23,79 +27,103 @@ _kind_deploy_cluster: _kind_with_registry.sh
2327
touch _kind_deploy_cluster
2428

2529

26-
clean:
27-
kind delete cluster
28-
docker rm -f kind-registry
29-
rm -fv _kind_with_registry.sh
30-
rm -fv _kind_extra_mounts.txt
31-
rm -fv _kind_with_registry.sh.tmp
32-
rm -fv _kind_deploy_cluster
33-
rm -fv _kind_deploy_prometheus
34-
rm -fv _kind_deploy_pcm
35-
36-
3730
#
38-
# e2e-small: minimal E2e pcm pod only test
31+
# 1) e2e-default: minimal E2e pcm pod only test
3932
#
40-
_kind_deploy_pcm:
33+
kind_deploy_pcm:
4134
helm install pcm .
42-
touch _kind_deploy_pcm
35+
kubectl wait daemonset pcm --for=jsonpath='{.status.numberReady}'=1
4336

4437
kind_pcm_test:
4538
helm test pcm
4639

47-
e2e-small: _kind_deploy_cluster _kind_deploy_pcm kind_pcm_test
40+
e2e-default: _kind_deploy_cluster kind_deploy_pcm kind_pcm_test
4841

4942
#
50-
# e2e-small-metal-nfd: minimal E2e pcm pod only test but with direct approach
43+
# 2) e2e-default-local-image: minimal E2e pcm with local image build
5144
#
52-
_kind_deploy_pcm_metal:
53-
helm upgrade --install pcm . -f values-metal.yaml
54-
touch _kind_deploy_pcm_metal
45+
build_local_image:
46+
(cd ../.. ; docker build . -t localhost:5001/pcm-local)
47+
docker push localhost:5001/pcm-local
5548

56-
_kind_deploy_nfd:
57-
helm upgrade --install pcm . -f values-metal.yaml
58-
touch _kind_deploy_pcm_metal
49+
kind_deploy_pcm_local_image:
50+
helm upgrade --install --reset-values --wait pcm . -f values-local-image.yaml
51+
kubectl wait daemonset pcm --for=jsonpath='{.spec.template.spec.containers[0].image'}=localhost:5001/pcm-local:latest
52+
kubectl wait daemonset pcm --for=jsonpath='{.status.numberReady}'=1
5953

60-
kind_pcm_test:
61-
helm test pcm
62-
63-
e2e-small-metal: _kind_deploy_cluster _kind_deploy_pcm_metal kind_pcm_test
54+
e2e-default-local-image: _kind_deploy_cluster build_local_image kind_deploy_pcm_local_image kind_pcm_test
6455

6556
#
66-
# e2e-prometheus: E2E test for podMonitor (pod monitor test)
57+
# 3) e2e-prometheus: E2E test for podMonitor (pod monitor test)
6758
#
6859
_kind_deploy_prometheus:
6960
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
70-
helm upgrade --install prometheus prometheus-community/kube-prometheus-stack --set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false
71-
kubectl wait sts prometheus-prometheus-kube-prometheus-prometheus --for=jsonpath='{.status.replicas}'=1
61+
helm upgrade --install --reset-values prometheus prometheus-community/kube-prometheus-stack --set prometheus.prometheusSpec.podMonitorSelectorNilUsesHelmValues=false --wait
62+
kubectl wait Prometheus prometheus-kube-prometheus-prometheus --for=jsonpath='{.status.availableReplicas}'=1
63+
#kubectl wait sts prometheus-prometheus-kube-prometheus-prometheus --for=jsonpath='{.status.replicas}'=1
7264
touch _kind_deploy_prometheus
7365

74-
_kind_deploy_pcm-with-prometheus:
75-
helm upgrade --install pcm . --set podMonitor=true
66+
kind_deploy_pcm_with_prometheus:
67+
helm upgrade --install --reset-values pcm . --set podMonitor=true
68+
kubectl wait daemonset pcm --for=jsonpath='{.status.numberReady}'=1
69+
70+
kind_pcm_test_prometheus:
71+
kubectl proxy & sleep 10 && curl -sL http://127.0.0.1:8001/api/v1/namespaces/default/services/prometheus-kube-prometheus-prometheus:http-web/proxy/api/v1/query?query=Measurement_Interval_in_us | grep Measurement_Interval_in_us && kill %1
7672

77-
kind_pcm_prometheus_test:
78-
kubectl proxy & sleep 5 && curl -sL http://127.0.0.1:8001/api/v1/namespaces/default/services/prometheus-kube-prometheus-prometheus:http-web/proxy/api/v1/query?query=Measurement_Interval_in_us | grep Measurement_Interval_in_us && kill %1
73+
e2e-prometheus: _kind_deploy_cluster _kind_deploy_prometheus kind_deploy_pcm_with_prometheus kind_pcm_test kind_pcm_test_prometheus
74+
75+
#
76+
# 4) e2e-metal-nfd: e2e thats tests that with node-feature-discovery installed and nfd values are changed, the PCM will be only installed on non hyperviserd system with Intel vendor and RDT available
77+
#
78+
_kind_deploy_nfd:
79+
#kubectl apply -k https://github.com/kubernetes-sigs/node-feature-discovery/deployment/overlays/default?ref=v0.16.0-devel
80+
helm repo add nfd https://kubernetes-sigs.github.io/node-feature-discovery/charts
81+
helm upgrade --install --wait nfd nfd/node-feature-discovery --namespace node-feature-discovery --create-namespace
82+
# please be patient NFD requires around 2 minutes to annotate the node ...
83+
kubectl wait node --timeout=2m kind-control-plane --for=jsonpath='{.metadata.labels.feature\.node\.kubernetes\.io\/cpu-model\.vendor_id}'=Intel
84+
85+
kind_deploy_pcm_with_metal_nfd:
86+
helm upgrade --install --reset-values pcm . -f values-metal-nfd.yaml
87+
kubectl wait daemonset --timeout=2m pcm --for=jsonpath='{.status.numberReady}'=1
88+
89+
kind_pcm_test_nfd:
90+
kubectl wait daemonset pcm --timeout=2m --for=jsonpath='{.spec.template.spec.nodeSelector.feature\.node\.kubernetes\.io\/cpu-model\.vendor_id}'=Intel
91+
helm test pcm
7992

80-
e2e-prometheus: _kind_deploy_cluster _kind_deploy_prometheus _kind_deploy_pcm-with-prometheus kind_pcm_test kind_pcm_prometheus_test
93+
e2e-metal-nfd: _kind_deploy_cluster _kind_deploy_nfd kind_deploy_pcm_with_metal_nfd kind_pcm_test
8194

8295
#
83-
# e2e-vpa: VPA E2E tests
96+
# 5) e2e-vpa: VPA E2E tests
8497
#
8598
_kind_autoscaler:
8699
git clone --depth 1 --single-branch https://github.com/kubernetes/autoscaler _kind_autoscaler
87100

88101
_kind_deploy_metrics_server:
89102
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
90103
helm repo update
91-
helm upgrade --install --set args={--kubelet-insecure-tls} metrics-server metrics-server/metrics-server --namespace kube-system
104+
helm upgrade --install --reset-values --set args={--kubelet-insecure-tls} metrics-server metrics-server/metrics-server --namespace kube-system
105+
kubectl wait daemonset pcm --for=jsonpath='{.status.numberReady}'=1
92106
touch _kind_deploy_metrics_server
93107

94108
_kind_deploy_vpa: autoscaler
95109
./_kind_autoscaler/vertical-pod-autoscaler/hack/vpa-up.sh
96110
touch _kind_deploy_vpa
97111

98-
_kind_deploy_pcm_with_vpa:
99-
helm upgrade --install pcm . --set verticalPodAutoscaler.enabled=true
112+
kind_deploy_pcm_with_vpa:
113+
helm upgrade --install --reset-values pcm . --set verticalPodAutoscaler.enabled=true
114+
kubectl wait daemonset pcm --for=jsonpath='{.status.numberReady}'=1
115+
116+
e2e-vpa: _kind_deploy_cluster _kind_deploy_vpa kind_deploy_pcm_with_vpa kind_pcm_test
117+
118+
#
119+
# Cleanup
120+
#
100121

101-
e2e-vpa: _kind_deploy_cluster _kind_deploy_vpa _kind_deploy_pcm_with_vpa kind_pcm_test
122+
clean:
123+
kind delete cluster
124+
docker rm -f kind-registry
125+
rm -fv _kind_with_registry.sh
126+
rm -fv _kind_extra_mounts.txt
127+
rm -fv _kind_with_registry.sh.tmp
128+
rm -fv _kind_deploy_cluster
129+
rm -fv _kind_deploy_prometheus

deployment/pcm/README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Helm chart instructions
55
### Features:
66

77
- Configurable as non-privileged container (value: `privileged`, default: false) and privileged container,
8-
- Support for bare-metal and VM host configurations (files: [values-metal.yaml](values-metal.yaml), [values-vm.yaml](values-vm.yaml)),
8+
- Support for bare-metal and VM host configurations (files: [values-metal-nfd.yaml](values-metal.yaml), [values-vm.yaml](values-vm.yaml)),
99
- Ability to deploy multiple releases alongside configured differently to handle different kinds of machines (bare-metal, VM) at the [same time](#heterogeneous-mixed-vmmetal-instances-cluster),
1010
- Linux Watchdog handling (controlled with `PCM_KEEP_NMI_WATCHDOG`, `PCM_NO_AWS_WORKAROUND`, `nmiWatchdogMount` values).
1111
- Deploy to own namespace with "helm install ... **-n pcm --create-namespace**".
@@ -77,6 +77,22 @@ More information here: https://kubernetes.io/docs/tutorials/security/ns-level-ps
7777
- hostPort 9738 is exposed on host. (TODO: security review, consider TLS, together with Prometheus scrapping !!).
7878
- Prometheus podMonitor is disabled (enabled it with --set podMonitor=true).
7979

80+
### TLS
81+
82+
TODO:
83+
- requires pcm-sensor-server to be build with SSL support
84+
- ERRROR !!!!
85+
86+
```
87+
mkdir build
88+
cd build
89+
cmake .. -DCMAKE_CXX_FLAGS='-DUSE_SSL -lssl'
90+
zypper install openssl-devel
91+
make pcm-sensor-server -j
92+
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname"
93+
./bin/pcm-sensor-server -s -p 8443 --certificateFile cert.pem --privateKeyFile key.pem
94+
```
95+
8096
### Validation on local kind cluster
8197

8298
#### Requirements
@@ -282,7 +298,7 @@ helm install pcm . -f values-direct-privileged.yaml
282298
#### Homogeneous bare metal instances cluster (full set of metrics)
283299

284300
```
285-
helm install pcm . -f values-metal.yaml
301+
helm install pcm . -f values-metal-nfd.yaml
286302
```
287303

288304
#### Homogenizer VM instances cluster (limited set of metrics core)
@@ -293,10 +309,10 @@ helm install pcm . -f values-vm.yaml
293309

294310
#### Heterogeneous (mixed VM/metal instances) cluster
295311

296-
values-metal.yaml requires node-feature-discovery to be preinstallaed
312+
values-metal-nfd.yaml requires node-feature-discovery to be preinstallaed
297313
```
298314
helm install pcm-vm . -f values-vm.yaml
299-
helm install pcm-metal . -f values-metal.yaml
315+
helm install pcm-metal . -f values-metal-nfd.yaml
300316
```
301317

302318
#### Direct method as non-privileged container (not recommended)
@@ -402,3 +418,12 @@ kubectl run -ti --rm --image busybox pcm-test-connection-manual -- wget -S -T 15
402418
| | energy | | | cpucounters.cpp initEnergyMonitoring() | |
403419

404420

421+
### E2E tests
422+
423+
Following end to end tests based on kind enviornment are provided by make targets:
424+
425+
- `e2e-default` - test PCM with default configuration (indirect) and checks connection by calling `helm test`
426+
- `e2e-default-local-image` - same as above but build and deploys PCM with local image
427+
- `e2e-prometheus` - test PCM chart with deployed PodMonitor with Prometheus stack and queries Prometheus for collected data,
428+
- `e2e-vpa` - deploy PCM with VerticalPodAutoscaler (requires metrics-service to be deployed alongside)
429+
- `e2e-metal-nfd` - test PCM chart on metal scheduled by features exposed by node-feature-discovery (uses: values-metal-nfd.yaml),

deployment/pcm/values-metal.yaml renamed to deployment/pcm/values-metal-nfd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ PCM_NO_AWS_WORKAROUND: 1
55
PCM_KEEP_NMI_WATCHDOG: 0
66
nfd: true
77
nfdBaremetalAffinity: true
8-
nfdRDTAffinity: true

deployment/pcm/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ nriBalloonsPolicyIntegration: false
124124
nfd: false
125125
# if enabled daemonset nodeAffinity will require node without feature.node.kubernetes.io/cpu-cpuid.HYPERVISOR flag (requires nfd=true)
126126
nfdBaremetalAffinity: false
127-
# if enabled, followin RDT labels will be required for scheduling (requires nfd=true)
127+
# if enabled, following RDT labels will be required for scheduling (requires nfd=true)
128+
# TODO: those labels are no longer available with default node-feature-discovery deployment
128129
# feature.node.kubernetes.io/cpu-rdt.RDTCMT=true
129130
# feature.node.kubernetes.io/cpu-rdt.RDTL3CA=true
130131
# feature.node.kubernetes.io/cpu-rdt.RDTMBA=true

0 commit comments

Comments
 (0)