Skip to content

fix(helm): Add release namespace metadata to HorizontalPodAutoscaling that lack it - #18453

Merged
Jayclifford345 merged 2 commits into
grafana:mainfrom
Arkaniad:rdanzey/loki-hpa-ns
Jul 21, 2025
Merged

fix(helm): Add release namespace metadata to HorizontalPodAutoscaling that lack it#18453
Jayclifford345 merged 2 commits into
grafana:mainfrom
Arkaniad:rdanzey/loki-hpa-ns

Conversation

@Arkaniad

@Arkaniad Arkaniad commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

I've noticed when using a combination of ArgoCD and Helmfile to deploy Loki in it's own namespace, the HPA resource for the read component gets created in the ArgoCD Application's default namespace, while all of the other Loki components that get deployed are in the proper namespace I've set in the Helmfile.

As long as the Helm template for the resource has namespace: {{ .Release.Namespace }}, this works as I'd expect it, but I noticed that while a lot of the HPA resource templates in this chart have this configured, a few including the read HPA that just confused me do not have it in the template. I flipped through the components and remedied all the HPAs I could see by filename, though there could be more resources throughout the chart that have similar behavior that I've yet to find.

This is probably not exclusive to ArgoCD or Helmfile, but any deployment scenario relying on Helm to deploy to the specified -n/--namespace switch rather than the current Kubeconfig default namespace will probably do the same thing. HPA resources will have a status similar to:

the HPA controller was unable to get the target's current scale: deployments/scale.apps "loki-read" not found

as the HPA resource needs to be in the same namespace as the deployment resource.

Which issue(s) this PR fixes:

  • Unable to find any issues referencing this behavior

Special notes for your reviewer:

  • No docs or tests added as I don't think this really changes anything for the chart besides making these few HPAs get placed properly for folks with corner cases such as mine. Happy to add some mention somewhere if it feels necessary though.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • 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
  • 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
… that lack it

Signed-off-by: Rhea Danzey <rdanzey@element.io>
@Arkaniad
Arkaniad requested a review from a team as a code owner July 14, 2025 19:09
@CLAassistant

CLAassistant commented Jul 14, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@jkroepke jkroepke left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Jayclifford345 Jayclifford345 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@Jayclifford345
Jayclifford345 merged commit faae40a into grafana:main Jul 21, 2025
74 checks passed
@Arkaniad

Copy link
Copy Markdown
Contributor Author

Thank you!!

felix0102 pushed a commit to felix0102/loki that referenced this pull request Aug 2, 2026
… that lack it (grafana#18453)

Signed-off-by: Rhea Danzey <rdanzey@element.io>
Co-authored-by: J Stickler <julie.stickler@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment