Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.
This repository was archived by the owner on Jul 15, 2024. It is now read-only.

Enhancement: ApplicationSet should support functions in template #447

@Shane-Williamson

Description

@Shane-Williamson

Feature request

ApplicationSet should be able to support functions in the template section of the manifest. This should be generator-agnostic, although for our use-case, we're blocked by the scmGenerator.

Something like this pseudo-code:

template:
  metadata:
    name: {{ repository | replace "some-text" "" }}-{{ branch | replace "/" "-" | lower }}`

Use-case (as example): we want to be able to scan repos in our org that match a naming pattern for branches that match a naming pattern and deploy applications from those branches. The purpose is to support a fully automated gitops development process where developers can create specific branches in their repos and an instance of that app will be automatically deployed by ApplicationSet. This means that there will be several instances of the same app deployed in cluster so names need to be unique. After changes are merged and the branch is deleted, the application should then be deleted by ApplicationSet.

The lack of functions is blocking this in these ways:

  1. Combining the repo name with the branch name for uniqueness (e.g. {{ repository }}-{{ branch }} ) can exceed the character limit in k8s. The replace function would enable shortening the name by any matched string.
  2. We use Jira which only recognizes upper-case ticket identifiers (e.g. DEVOPS-1234). Atlassian has stated this is not something they will fix from the digging I've done. K8s does not allow upper-case resource names. So we either break Jira integration or break deployments.
  3. Our branch names have / in them which is an invalid character to k8s.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions