Skip to content

Support Go templates with Sprig functions in TenantResource #1692

@CorentinPtrl

Description

@CorentinPtrl

Describe the feature

Add support for Go templating (with Sprig) to GlobalTenantResource/TenantResource definitions. This enhancement would allow users to leverage Go templates and Sprig functions to generate more dynamic, context-aware manifests for example based on tenant metadata, annotations, labels.

What would the new user story look like?

  1. A tenant owner creates or updates a Tenant.
  2. The TenantResource controller renders the provided manifest template using Go templates + Sprig functions.
  3. Context (tenant metadata, labels, etc.) is passed to the template engine.
  4. The rendered resource is applied to the appropriate namespaces.

Example:

With Sprig, users could do things like:

metadata:
  name: "{{ .Tenant.metadata.name | lower | trunc 20 }}"

Expected behavior

  • TenantResource manifests are processed using Go templates with Sprig functions available.
  • Capsule passes structured context (Tenant, Namespace) to the template.
  • Validation errors are surfaced clearly if templates fail to render.
  • Backward compatibility

I’d be happy to work on implementing this feature if it's accepted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions