templates using the lookup function fail to render
gberche-orange opened this issue · 1 comments
gberche-orange commented
Describe the bug
As a hcunit user
- in order to assert templates making use of the lookup function
- I need hcunit to support this keyword
To Reproduce
With the following serviceinstance.yml
template
apiVersion: servicecatalog.k8s.io/v1beta1
kind: ServiceInstance
{{ $serviceInstance:= ( lookup "servicecatalog.k8s.io/v1beta1" "ServiceInstance" .Release.Namespace $fullName) -}}
metadata:
namespace: {{ .Release.Namespace }}
name: {{ include "p-mysql.fullname" . }}
labels:
{{- include "p-mysql.labels" . | nindent 4 }}
spec:
#Let svcat reference service class and service plans from external names (i.e. OSB names)
#See https://github.com/kubernetes-sigs/service-catalog/blob/a204c0d26c60b42121aa608c39a179680e499d2a/contrib/examples/walkthrough/mini-instance.yaml#L1-L11
clusterServiceClassExternalName: {{ .Values.serviceClassName }}
clusterServicePlanExternalName: {{ .Values.servicePlanName }}
when running
helm unit eval -t templates/ -c values.yaml -p my_assert.rego
then
error while rendering: parse error in "hcunit/templates/serviceinstance.yaml": template: hcunit/templates/serviceinstance.yaml:3: function "lookup" not defined
Error: plugin "unit" exited with error
helm.go:81: [debug] plugin "unit" exited with error
on version 0.7.5
gberche-orange commented
Tried to workaround the issue with a if/else/end block with a onlyDuringUnitTest value, but this did not help.
The only workaround I found is to only assert templates without the lookup function :-(