loki icon indicating copy to clipboard operation
loki copied to clipboard

fix(helm): fix imagePullSecrets for statefulset-results-cache

Open Haibread opened this issue 1 year ago • 2 comments

What this PR does / why we need it:

If you set the imagePullSecrets value, you will encounter an error as helm cannot template the statefulset-results-cache.yaml file :

helm template loki grafana/loki --version 6.6.1 --set-json imagePullSecrets='["test"]' --set loki.useTestSchema=true --set loki.storage.bucketNames.chunks=chunks

Error: template: loki/templates/results-cache/statefulset-results-cache.yaml:1:4: executing "loki/templates/results-cache/statefulset-results-cache.yaml" at <include "loki.memcached.statefulSet" (dict "ctx" $ "valuesSection" "resultsCache" "component" "results-cache")>: error calling include: template: loki/templates/memcached/_memcached-statefulset.tpl:75:17: executing "loki.memcached.statefulSet" at <$.ctx.Values.image.pullSecrets>: nil pointer evaluating interface {}.pullSecrets

This PR fixes this issue, which appears to be caused by a typo between $.ctx.Values.imagePullSecrets and $.ctx.Values.image.pullSecrets to match the values.yaml file

Which issue(s) this PR fixes: Fixes #12632

Special notes for your reviewer:

Checklist

  • [x] Reviewed the CONTRIBUTING.md guide (required)
  • [ ] Documentation added
  • [ ] Tests updated
  • [x] Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • [ ] Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • [x] For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR
  • [ ] If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

Haibread avatar May 28 '24 16:05 Haibread

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 28 '24 16:05 CLAassistant

+1

HujinoKun avatar May 29 '24 16:05 HujinoKun

@Haibread hey thanks for your contribution :heart:

sorry for the delay; do you mind resolving the conflicts? if you don't have the time this week, I can fix them, just let me know.

DylanGuedes avatar Jul 17 '24 11:07 DylanGuedes

@Haibread hey thanks for your contribution ❤️

sorry for the delay; do you mind resolving the conflicts? if you don't have the time this week, I can fix them, just let me know.

Should be good to go, let me know if I need to edit anything

Haibread avatar Jul 18 '24 08:07 Haibread

This change broke the entire chart? Before we had this in our values.yaml:

image:
  pullSecrets:
    - harbor-infra-run-pull-secret
imagePullSecrets:
  - name: harbor-infra-run-pull-secret

It was strange to specify pull secrets twice in two different formats, but worked for all workloads included in the loki helm chart. With this change, we now can just do

imagePullSecrets:
  - harbor-infra-run-pull-secret

which is nice and works for the cache statefulsets but breaks loki-gateway, loki-read, loki-backend, and loki-write deployments as they are not automtically adding the name: prefix before a pull secret, e.g. see https://github.com/grafana/loki/blob/main/production/helm/loki/templates/read/statefulset-read.yaml#L74-L76

sebhoss avatar Jul 24 '24 04:07 sebhoss