-
Notifications
You must be signed in to change notification settings - Fork 24
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
helm: fix invalid nri-plugin-index that causes plugins to crash #247
Conversation
Original printf format "%02d" argument for --nri-plugin-index produced argument value "%!d(float64=90)", if nri.pluginIndex was 90. As helm handles the value 90 as float64, use format "%02.0f" instead. Signed-off-by: Antti Kervinen <[email protected]>
That's odd. I really thought I tested this properly with various valid and invalid indices, but maybe I did not after all. BTW, is it so that now you can use |
Hmm... what Helm version are you using ? [root@crio-devel xfer]# grep -Hn -B1 -A2 pluginIndex ./helm/topology-aware/templates/daemonset.yaml
./helm/topology-aware/templates/daemonset.yaml-57- - --nri-plugin-index
./helm/topology-aware/templates/daemonset.yaml:58: - "{{ printf "%02d" .Values.nri.pluginIndex }}"
./helm/topology-aware/templates/daemonset.yaml-59- {{- if .Values.configGroupLabel }}
./helm/topology-aware/templates/daemonset.yaml-60- - --config-group-label
[root@crio-devel xfer]# helm install policy ./helm/topology-aware -n kube-system --set image.name=localhost/policy-test --set image.tag=latest --set nri.pluginIndex=1
NAME: policy
LAST DEPLOYED: Fri Jan 26 09:24:33 2024
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
[root@crio-devel xfer]# kubectl get pods -A | grep nri-resource-policy
kube-system nri-resource-policy-topology-aware-pcjxh 1/1 Running 0 13s
[root@crio-devel xfer]# ps axuw | grep /bin/nri-resource-policy-topology-aware | grep -v grep
root 8009 0.3 0.4 1271032 37376 ? Ssl 09:24 0:00 /bin/nri-resource-policy-topology-aware --host-root /host --config-namespace kube-system --pid-file /tmp/nri-resource-policy.pid -metrics-interval 5s --nri-plugin-index 01
[root@crio-devel xfer]# helm uninstall -n kube-system policy
release "policy" uninstalled
[root@crio-devel xfer]# helm install policy ./helm/topology-aware -n kube-system --set image.name=localhost/policy-test --set image.tag=latest --set nri.pluginIndex=50
NAME: policy
LAST DEPLOYED: Fri Jan 26 09:25:34 2024
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
[root@crio-devel xfer]# kubectl get pods -A | grep nri-resource-policy
kube-system nri-resource-policy-topology-aware-jrrp8 1/1 Running 0 4s
[root@crio-devel xfer]# ps axuw | grep /bin/nri-resource-policy-topology-aware | grep -v grep
root 8346 1.0 0.4 1270776 37888 ? Ssl 09:25 0:00 /bin/nri-resource-policy-topology-aware --host-root /host --config-namespace kube-system --pid-file /tmp/nri-resource-policy.pid -metrics-interval 5s --nri-plugin-index 50
[root@crio-devel xfer]# helm uninstall -n kube-system policy
release "policy" uninstalled
[root@crio-devel xfer]# helm install policy ./helm/topology-aware -n kube-system --set image.name=localhost/policy-test --set image.tag=latest --set nri.pluginIndex=90
NAME: policy
LAST DEPLOYED: Fri Jan 26 09:26:16 2024
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
[root@crio-devel xfer]# kubectl get pods -A | grep nri-resource-policy
kube-system nri-resource-policy-topology-aware-bstdj 1/1 Running 0 3s
[root@crio-devel xfer]# ps axuw | grep /bin/nri-resource-policy-topology-aware | grep -v grep
root 8679 1.6 0.4 1271032 37888 ? Ssl 09:26 0:00 /bin/nri-resource-policy-topology-aware --host-root /host --config-namespace kube-system --pid-file /tmp/nri-resource-policy.pid -metrics-interval 5s --nri-plugin-index 90
[root@crio-devel xfer]# helm version
version.BuildInfo{Version:"v3.11", GitCommit:"", GitTreeState:"", GoVersion:"go1.21rc3"}
[root@crio-devel xfer]# |
Also, with balloons:
|
Can you try if a self-compiled helm (from head or the latest release tag) in the same test environment then works as expected ? And if not, if the golang toolchain has any significance ? If it does, then maybe an alternative fix of self-compiling/go-installing helm in the e2e tests could also work. |
I tried with both the helm release installed by e2e tests, and most resent prebuilt helm release:
Both of these versions fail with It seems likely that both versions of helm exist in the wild, so maybe we should reject this PR and give up trying to do zero padding with printf in our templates. We could as well use string as index, like |
Looks like this is a known problem that people are actively trying to fix, but haven't managed to fully do so yet:
|
Therefore I suggest we add this workaround until that problem is gotten under control in Helm:
I'll file a PR. |
Closing this PR, replaced by #250 |
Original printf format "%02d" argument for --nri-plugin-index produced argument value "%!d(float64=90)", if nri.pluginIndex was 90. As helm handles the value 90 as float64, use format "%02.0f" instead.