FORMAT: use jsonnet for templating
* add jsonnet templates * rewrite all charts to jsonnet
This commit is contained in:
parent
bf2aa26963
commit
e2fe9bb682
19 changed files with 244 additions and 237 deletions
18
_templates/argo_app.template
Normal file
18
_templates/argo_app.template
Normal file
|
@ -0,0 +1,18 @@
|
|||
# vim:ft=jsonnet:
|
||||
local base = import "argo_base.template";
|
||||
|
||||
base + {
|
||||
repo:: error "repo must be defined",
|
||||
version:: error "version must be defined",
|
||||
path:: error "path must be defined",
|
||||
recursive:: true,
|
||||
|
||||
spec+: {
|
||||
source: {
|
||||
repoURL: $.repo,
|
||||
path: $.path,
|
||||
targetRevision: $.version,
|
||||
directory: { recurse: $.recursive },
|
||||
}
|
||||
}
|
||||
}
|
27
_templates/argo_base.template
Normal file
27
_templates/argo_base.template
Normal file
|
@ -0,0 +1,27 @@
|
|||
# vim:ft=jsonnet:
|
||||
{
|
||||
name:: error "name must be defined",
|
||||
namespace:: $.name,
|
||||
syncOptions:: ["CreateNamespace=true"],
|
||||
|
||||
apiVersion: "argoproj.io/v1alpha1",
|
||||
kind: "Application",
|
||||
metadata: {
|
||||
name: $.name,
|
||||
namespace: "argocd",
|
||||
},
|
||||
spec: {
|
||||
project: "baseline",
|
||||
destination: {
|
||||
server: "https://kubernetes.default.svc",
|
||||
namespace: $.namespace,
|
||||
},
|
||||
syncPolicy: {
|
||||
automated: {
|
||||
selfHeal: true,
|
||||
prune: true,
|
||||
},
|
||||
syncOptions: $.syncOptions,
|
||||
}
|
||||
}
|
||||
}
|
30
_templates/argo_helm_app.template
Normal file
30
_templates/argo_helm_app.template
Normal file
|
@ -0,0 +1,30 @@
|
|||
# vim:ft=jsonnet:
|
||||
local base = import "argo_base.template";
|
||||
|
||||
base + {
|
||||
repo:: error "repo must be defined",
|
||||
chart:: $.name,
|
||||
version:: error "version must be defined",
|
||||
skipCrds:: false,
|
||||
values:: "",
|
||||
|
||||
spec+: {
|
||||
source+: {
|
||||
repoURL: $.repo,
|
||||
chart: $.chart,
|
||||
targetRevision: $.version,
|
||||
}
|
||||
|
||||
+ (
|
||||
if std.length($.values) > 0 then
|
||||
{ helm+: { values: $.values } } else {}
|
||||
)
|
||||
|
||||
+ (
|
||||
if $.skipCrds then
|
||||
{ helm+: { skipCrds: true } } else {}
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue