loft-sh / kiosk

kiosk 🏢 Multi-Tenancy Extension For Kubernetes - Secure Cluster Sharing & Self-Service Namespace Provisioning
https://kubernetes.slack.com/?redir=%2Fmessages%2Fkiosk#/
Apache License 2.0
1.07k stars 70 forks source link

Unable to create template instance with parameters #146

Closed lamebear closed 2 years ago

lamebear commented 2 years ago

When trying to create a TemplateInstance resource for a Template that has parameters, the status of the resource has the message: parameter TEST_NAME does not exist in template vcluster

# template.yaml
apiVersion: config.kiosk.sh/v1alpha1
kind: Template
metadata:
  name: vcluster
  namespace: kiosk
resources:
  helm:
    releaseName: vcluster
    chart:
      repository:
        name: vcluster
        repoUrl: https://charts.loft.sh
        version: "0.11.1"
    values: |
      sync:
        serviceaccounts:
          enabled: true
      syncer:
        kubeConfigContextName: "${NAME}"
      ingress:
        enabled: true
        ingressClassName: nginx-internal
        host: "${NAME}.clusters.${PLATFORM}.my-domain.dev"
# template-instance.yaml
apiVersion: config.kiosk.sh/v1alpha1
kind: TemplateInstance
metadata:
  name: test-vcluster-vcluster
  namespace: test-vcluster-space
spec:
  parameters:
    - name: NAME
      value: test-vcluster-vcluster
    - name: PLATFORM
      value: moshpit
  template: vcluster
status:
  message: parameter NAME does not exist in template vcluster
  reason: ErrorValidatingParameters
  status: Failed

I've tried defining the parameters with ${{..}}, ${..}. and $.. but none of them work. Kiosk Version: v0.2.11

lamebear commented 2 years ago

I figured it out after looking through the code. The parameters have to be pre-defined but the helm-based template documentation does not reflect that as being necessary.