Created
July 24, 2020 21:09
-
-
Save ggolin/e326cdaee8687ae5f4825d12ea3eaad7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:data", "data") | |
#@ load("consts.star", "version", "comment") | |
#@ def cpus(n): | |
#@ return str(n)+"m" | |
#@ end | |
#@ def memorys(n): | |
#@ return "{}Mi".format(n) | |
#@ end | |
#! request_50m_per_factor — generates a resources request | |
#! given a scaling factor such that the limits are twice | |
#! the initial request. | |
#@ def request_50m_per_factor(factor): | |
#@ initial = { "cpu": 50*factor, "memory": 50*factor } | |
requests: | |
cpu: #@ cpus(initial["cpu"]) | |
memory: #@ memorys(initial["memory"]) | |
limits: | |
cpu: #@ cpus(2*initial["cpu"]) | |
memory: #@ memorys(2*initial["memory"]) | |
#@ end | |
#@ def labels(forSelecting=False): | |
app.kubernetes.io/component: controller | |
app.kubernetes.io/name: #@ data.values.app_name | |
#@ if not forSelecting: | |
app.kubernetes.io/version: #@ version | |
#@ end | |
#@ end | |
#@ def foo(secrets): | |
#@ for/end secret in secrets: | |
- name: #@ secret | |
secretRef: | |
name: #@ secret | |
#@ end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment