Skip to content

Support referencing resources in includeWhen CEL expression #845

@dev-marina

Description

@dev-marina

Feature Description

Problem Statement:

Current Behaviour supports only reference the "schema" variable.
I would like to be able to use externalRef in includeWhen statement. Here is example how it can look like:

`apiVersion: kro.run/v1alpha1
 kind: ResourceGraphDefinition
 metadata:
 name: foo
 spec:
    schema:
    apiVersion: v1
    kind: Foo
    spec:
      crdName: string | required=true description="Name of the CRD"

resources:
- id: serviceAccount
  externalRef:
  apiVersion: v1
  kind: ServiceAccount
  metadata:
     name: service-account-name 
     namespace: ${schema.spec.namespace}

- id: storageBucket
  template:
    apiVersion: storage.cnrm.cloud.google.com/v1beta1
    kind: StorageBucket
    metadata:
      name: ${schema.metadata.name}-bucket
      namespace: ${schema.metadata.namespace}
  includeWhen:
    - ${serviceAccount.metadata.exists(x, x.name == 'test')}`

Proposed Solution:

Users can use externalRef resource in includeWhen cel expression to reference to externalRef resource

Alternatives Considered:

Additional Context:

It used to be possible to use externalRef in includeWhen statement before this PR where behaviour was changed.

  • Please vote on this issue by adding a 👍 reaction to the original issue
  • If you are interested in working on this feature, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.needs-kreptriage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions