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

user-guide: Templates organization #2807

Merged
merged 17 commits into from
Oct 30, 2022
Merged

user-guide: Templates organization #2807

merged 17 commits into from
Oct 30, 2022

Conversation

foot
Copy link
Contributor

@foot foot commented Sep 28, 2022

Closes weaveworks/weave-gitops-enterprise#1687

Documentation Changes
Update Using templates docs with new sections:

  • Organizing templates
  • Enable/disable template components
  • Default profile values
  • Template rendering language and functions supported when using go-templating
  • create-request annotation details
  • Setting default param values

@ranatrk ranatrk added the documentation Improvements or additions to documentation label Oct 20, 2022
@ranatrk ranatrk marked this pull request as ready for review October 20, 2022 17:19
@ranatrk ranatrk requested a review from a team October 20, 2022 17:20

```yaml
apiVersion: capi.weave.works/v1alpha1
kind: CAPITemplate
Copy link
Contributor

@JamWils JamWils Oct 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update any references to GitOpsTemplate instead of CAPITemplate so it is consistent across our docs. The apiVersion will need to be updated as well.

@ranatrk ranatrk force-pushed the templates-organization branch 3 times, most recently from 9ec3fed to a149834 Compare October 25, 2022 10:11

## Rendering Templates

Declare the render type indicating the templating language to be used to render the template by using the `renderType` spec.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec.renderType can be set to either:

  • envsubst (default): where ${CLUSTER_NAME} style syntax can be used.
  • templating: go-templating style syntax {{ .params.CLUSTER_NAME }}. Where params are provided by the .params variable. You can also use template functions.

@bigkevmcd
Copy link
Contributor

I had started some notes on templating a while back https://gist.github.com/bigkevmcd/314559c2c6912f405a8052bec63c99d3 feel free to take anything (or nothing) from this.

@ranatrk
Copy link
Contributor

ranatrk commented Oct 25, 2022

I had started some notes on templating a while back https://gist.github.com/bigkevmcd/314559c2c6912f405a8052bec63c99d3 feel free to take anything (or nothing) from this.

thanks @bigkevmcd , used some points from it!

@ranatrk ranatrk force-pushed the templates-organization branch 2 times, most recently from cccbf01 to d015448 Compare October 25, 2022 16:10
Comment on lines 76 to 79
| `${var-default` | If `$var` is not set, evaluate expression as `$default`
| `${var:-default` | If `$var` is not set or is empty, evaluate expression as `$default`
| `${var=default` | If `$var` is not set, evaluate expression as `$default`
| `${var:=default` | If `$var` is not set or is empty, evaluate expression as `$default`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From https://github.com/a8m/envsubst, I think these should still have the closing }

import TierLabel from "../_components/TierLabel";

# Using templates <TierLabel tiers="enterprise" />

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little preamble here about what problems templates solve and a little example would be neat. @davidstauffer @JamWils do we have any material lying around we could include re: "why use templates"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we do! I will work on compiling the things we have from the initiative etc into a comprehensive why section. Should land before end of the week.

@ranatrk ranatrk merged commit 44b6c4d into main Oct 30, 2022
@ranatrk ranatrk deleted the templates-organization branch October 30, 2022 11:47
This was referenced Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[user-guide] Make sure all template features are well doc'd
6 participants