Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tpl function to template rendering #140

Open
tpickett opened this issue Nov 14, 2024 · 0 comments · May be fixed by #137
Open

Add tpl function to template rendering #140

tpickett opened this issue Nov 14, 2024 · 0 comments · May be fixed by #137
Labels
enhancement New feature or request

Comments

@tpickett
Copy link

What problem are you facing?

Currently the helm function tpl is not available in the function list when rendering a template: https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function

How to reproduce?

#XR
apiVersion: example.crossplane.io/v1beta1
kind: XR
metadata:
  name: example
spec:
  labels:
    key1: value1
    key2: "{{ .val2 }}"
  val2: value2

#Template
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
  name: example-function-tpl
spec:
  compositeTypeRef:
    apiVersion: example.crossplane.io/v1beta1
    kind: XR
  mode: Pipeline
  pipeline:
    - step: render-templates
      functionRef:
        name: function-go-templating
      input:
        apiVersion: gotemplating.fn.crossplane.io/v1beta1
        kind: GoTemplate
        source: Inline
        inline:
          template: |
            {{$vals:= .observed.composite.resource.spec}}
            apiVersion: apps/v1
            kind: Deployment
            metadata:
              name: nginx-deployment
              annotations:
                gotemplating.fn.crossplane.io/composition-resource-name: test1
              labels:
                {{- toYaml (tpl $vals.labels $vals) | nindent 4}}

What environment did it happen in?

Function version: 0.8.0

@tpickett tpickett added the enhancement New feature or request label Nov 14, 2024
@tpickett tpickett linked a pull request Nov 14, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant