Skip to content

templates using the lookup function fail to render #31

@gberche-orange

Description

@gberche-orange

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions