Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for transformations in resource templates #59

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

ryannedolan
Copy link
Collaborator

Summary

Templates frequently need the same variable in different forms, e.g. kafkaTopic and kafkaTopicLowerCase. Rather than require Resources to define multiple different formats of the same values, we now support simple transformations to be expressed in the templates themselves. This is similar to how Go/Helm templates allow transformation pipelines.

Details

The following forms are added:

  • {{var toName}}, {{var:default toName}}: canonicalize the variable as a valid K8s object name.
  • {{var toUpperCase}}, {{var:default toUpperCase}}: render in all upper case.
  • {{var toLowerCase}}, {{var:default toLowerCase}}: render in all lower case.
  • {{var concat}}, {{var:default concat}}: concatinate a multiline string into one line
  • {{var concat toUpperCase}}: apply both transformations in sequence.

Testing

New unit test exercises these transformations.

@ryannedolan ryannedolan merged commit 1c992be into main Jan 31, 2024
1 check passed
@ryannedolan ryannedolan deleted the canonicalize-names branch January 31, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants