-
Notifications
You must be signed in to change notification settings - Fork 6
/
kargo.cue
98 lines (85 loc) · 2.26 KB
/
kargo.cue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@if(!NoKargo && !NoArgoRollouts && !NoArgoCD)
package holos
import (
project "kargo.akuity.io/project/v1alpha1"
warehouse "kargo.akuity.io/warehouse/v1alpha1"
stage "kargo.akuity.io/stage/v1alpha1"
)
// Custom resource definitions.
#Resources: {
Project?: [_]: project.#Project & {
spec: {...}
}
Warehouse?: [_]: warehouse.#Warehouse
Stage?: [_]: stage.#Stage
}
// Kargo config definition.
#Kargo: {
Namespace: string
Values: {...}
}
Kargo: #Kargo & {
Namespace: "kargo"
// Holos specific kustomizations
Values: #KargoValues & {
// Istio handles mTLS for us.
api: ingress: tls: enabled: false
// Secret generated by the kargo-secrets holos component.
api: secret: name: "admin-credentials"
}
// These values are specific to the k3d local demo environment and should be
// changed for production.
Values: {
controller: serviceAccount: clusterWideSecretReadingEnabled: true
controller: globalCredentials: namespaces: [Namespace]
}
}
// Register namespaces and components with the project.
Projects: {
argocd: {
namespaces: (Kargo.Namespace): _
_components: {
"kargo-secrets": _
"kargo": _
}
}
}
// Register the HTTPRoute to the backend Service
HTTPRoutes: kargo: _backendRefs: "kargo-api": namespace: Kargo.Namespace
#KargoProjectBuilder: #ProjectBuilder & {
name: _
namespaces: _
team: _
environment?: _
stack?: _
let NAME = name
clusters: _
_kargo_cluster_projects: {[CLUSTER=string]: [NAME=string]: metadata: name: NAME}
for CLUSTER in clusters {
if len(_kargo_cluster_projects[CLUSTER.name]) > 0 {
let PROJECT_COMPONENT = #SharedComponent & {
_project: NAME
_cluster: CLUSTER.name
_component: "projects"
_team: team
if stack != _|_ {
_stack: stack
}
if environment != _|_ {
_environment: environment
}
}
components: (PROJECT_COMPONENT.name): PROJECT_COMPONENT.component
}
if len(namespaces) > 0 {
for NS in namespaces {
if NS.metadata.labels["kargo.akuity.io/project"] != _|_ {
if NS.metadata.labels["kargo.akuity.io/project"] == "true" {
_kargo_cluster_projects: (CLUSTER.name): (NS.metadata.name): metadata: name: NS.metadata.name
}
}
}
}
}
}
projects: {[CLUSTER=string]: [NAME=string]: metadata: name: NAME}