Skip to content

[BUG] hasLookupFunction() does not detect lookup usage inside helper templates (define blocks) #5198

Description

@susesamu

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Fleet currently fails to detect Helm lookup usage when the lookup call is located inside helper templates defined in _helpers.tpl.
This causes charts that rely on helper-based lookup logic (such as gha-runner-scale-set) to fail when deployed through Fleet, even though they succeed with native Helm CLI.
The issue appears to be in hasLookupFunction() only inspecting t.Tree.Root and not traversing all parsed templates returned by t.Templates().

Expected Behavior

Fleet should detect lookup usage regardless of whether the function appears directly in a manifest template, inside a define block / _helpers.tpl or helper templates referenced through include/template.

Steps To Reproduce

A minimal reproducer:

_helpers.tpl

{{- define "mychart.lookupHelper" -}}
{{ lookup "v1" "Service" "default" "kubernetes" }}
{{- end -}}

configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: test
data:
  value: {{ include "mychart.lookupHelper" . }}

Expected:

hasLookupFunction(chart) == true

Actual:

hasLookupFunction(chart) == false

Environment

- Architecture:
- Fleet Version:
- Cluster:
  - Provider:
  - Options:
  - Kubernetes Version:

Logs

Anything else?

No response

Metadata

Metadata

Labels

Type

Fields

No fields configured for Bug.

Projects

Status
✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions