Skip to content

0.6.0 Type Checking Issue #779

@anthonyh-quilt

Description

@anthonyh-quilt

Description

I'm having an issue with 0.6.0- I can no longer use this: ${schema.metadata.namespace}

Observed Behavior:

      message: >-
        failed to validate node "certificate": failed to type-check template
        expression "schema.metadata.namespace" at path "spec.dnsNames[0]":
        ERROR: <input>:1:16: undefined field 'namespace'
         | schema.metadata.namespace
         | ...............^
      observedGeneration: 9
      reason: InvalidResourceGraph
      status: 'False'
      type: ResourceGraphAccepted

I have tried many different ways to try and "safely" reference namespace but the new validation is very restrictive... Or I have no idea what I am doing.

Expected Behavior:
can reference instance's deployed namespace in RGD resources

Reproduction Steps (Please include ResourceGraphDefinition and Instances files):
resource graph:

apiVersion: kro.run/v1alpha1
kind: ResourceGraphDefinition
metadata:
  name: tenant-tls
spec:
  schema:
    apiVersion: v1alpha1
    kind: TenantTLS
    spec:
      domain: string | default=example.com
      issuerRef:
        name: string | default=letsencrypt
        kind: string | default=ClusterIssuer
  resources:
    - id: certificate
      template:
        apiVersion: cert-manager.io/v1
        kind: Certificate
        metadata:
          name: tenant-env-cert
          annotations:
            argocd.argoproj.io/tracking-id: ${schema.metadata.?annotations["argocd.argoproj.io/tracking-id"].orValue("")}
        spec:
          secretName: tenant-env-cert
          issuerRef:
            name: ${schema.spec.issuerRef.name}
            kind: ${schema.spec.issuerRef.kind}
          dnsNames:
            - '*.${schema.metadata.namespace}.${schema.spec.domain}'
            - '${schema.metadata.namespace}.${schema.spec.domain}'

instance:

apiVersion: kro.run/v1alpha1
kind: TenantTLS
metadata:
  name: tenant-env-cert

Note:
I'm using an ArgoCD ApplicationSet that discovers instance resources like: apps/{tenant}/*/{env}/
And it will specify the target namespace like: {tenant}-{env}

Versions:

  • kro version: 0.6.0
  • Kubernetes Version (kubectl version):
Client Version: v1.30.2
Server Version: v1.32.9-eks-113cf36

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Which option describes the most your issue?

No response

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions