110 lines
3.3 KiB
Jsonnet
110 lines
3.3 KiB
Jsonnet
{
|
|
helmApplication(
|
|
name,
|
|
sourceRepoUrl,
|
|
sourceChart,
|
|
sourceTargetRevision,
|
|
namespace="",
|
|
helmValues={}) ::
|
|
{
|
|
apiVersion: "argoproj.io/v1alpha1",
|
|
kind: "Application",
|
|
metadata: {
|
|
name: name,
|
|
namespace: "argo",
|
|
finalizers: ["resources-finalizer.argocd.argoproj.io"]
|
|
},
|
|
spec: {
|
|
project: "default",
|
|
source: {
|
|
chart: sourceChart,
|
|
repoURL: sourceRepoUrl,
|
|
targetRevision: sourceTargetRevision,
|
|
[if helmValues != {} then "helm"]: {
|
|
valuesObject: helmValues
|
|
}
|
|
},
|
|
destination: {
|
|
server: "https://kubernetes.default.svc",
|
|
namespace: if namespace == "" then name else namespace
|
|
},
|
|
syncPolicy: {
|
|
automated: {
|
|
prune: true
|
|
},
|
|
syncOptions: ["CreateNamespace=true"]
|
|
}
|
|
}
|
|
},
|
|
localApplication(
|
|
name,
|
|
path="",
|
|
namespace="",
|
|
nonHelmApp=false) ::
|
|
{
|
|
apiVersion: "argoproj.io/v1alpha1",
|
|
kind: "Application",
|
|
metadata: {
|
|
name: name,
|
|
namespace: "argo",
|
|
finalizers: ["resources-finalizer.argocd.argoproj.io"]
|
|
},
|
|
spec: {
|
|
project: "default",
|
|
source: {
|
|
repoURL: "https://gitea.scubbo.org/scubbo/helm-charts.git",
|
|
targetRevision: "HEAD",
|
|
path: if path == "" then std.join('/', ['charts', name]) else path,
|
|
// I _think_ every locally-defined chart is going to have a `values.yaml`, but we can make this
|
|
// parameterized if desired
|
|
[if nonHelmApp != true then "helm"]: {
|
|
valueFiles: ['values.yaml']
|
|
}
|
|
},
|
|
destination: {
|
|
server: 'https://kubernetes.default.svc',
|
|
namespace: if namespace == "" then name else namespace
|
|
},
|
|
syncPolicy: {
|
|
automated: {
|
|
prune: true
|
|
},
|
|
syncOptions: ["CreateNamespace=true"]
|
|
}
|
|
}
|
|
},
|
|
kustomizeApplication(
|
|
name,
|
|
repoUrl="",
|
|
namespace="",
|
|
path="") ::
|
|
{
|
|
apiVersion: "argoproj.io/v1alpha1",
|
|
kind: "Application",
|
|
metadata: {
|
|
name: name,
|
|
namespace: "argo",
|
|
finalizers: ["resources-finalizer.argocd.argoproj.io"]
|
|
},
|
|
spec: {
|
|
project: "default",
|
|
source: {
|
|
repoURL: if repoUrl=="" then std.join('', ['https://gitea.scubbo.org/scubbo/', name, '-deployment']) else repoUrl,
|
|
targetRevision: "HEAD",
|
|
path: if path == "" then "." else path
|
|
},
|
|
destination: {
|
|
server: 'https://kubernetes.default.svc',
|
|
namespace: if namespace == "" then name else namespace
|
|
},
|
|
syncPolicy: {
|
|
automated: {
|
|
prune: true
|
|
},
|
|
syncOptions: ["CreateNamespace=true"]
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|