Installer: Simplify volume usage API
Change-Id: I4a7189af9194c70a6c5aac96d39618a6827965bd
diff --git a/core/installer/app_configs/app_base.cue b/core/installer/app_configs/app_base.cue
index 322f736..4138024 100644
--- a/core/installer/app_configs/app_base.cue
+++ b/core/installer/app_configs/app_base.cue
@@ -47,6 +47,25 @@
fullNameWithTag: "\(fullName):\(tag)"
}
+#Volume: {
+ size: string
+ accessMode: "ReadWriteOnce" | "ReadOnlyMany" | "ReadWriteMany" | "ReadWriteOncePod" | *"ReadWriteOnce"
+}
+
+#volume: {
+ #Volume
+ name: string
+}
+
+volumes: {}
+volumes: {
+ for key, value in volumes {
+ "\(key)": #volume & value & {
+ name: key
+ }
+ }
+}
+
#Chart: #GitRepositoryRef | #HelmRepositoryRef
#GitRepositoryRef: {
@@ -112,7 +131,6 @@
}
charts: {}
-
charts: {
for key, value in charts {
"\(key)": #Chart & value & {
@@ -127,6 +145,14 @@
}
}
}
+charts: {
+ volume: {
+ kind: "GitRepository"
+ address: "https://github.com/giolekva/pcloud.git"
+ branch: "main"
+ path: "charts/volumes"
+ }
+}
localCharts: {
for key, _ in charts {
@@ -153,6 +179,13 @@
name: key
}
}
+ for key, value in volumes {
+ "\(key)-volume": #Helm & {
+ chart: charts.volume
+ info: "Creating disk for \(key)"
+ values: value
+ }
+ }
for key, value in _ingressValidate {
for ing, ingValue in value.out.helm {
// TODO(gio): support multiple ingresses
diff --git a/core/installer/values-tmpl/env-dns.cue b/core/installer/values-tmpl/env-dns.cue
index b4a80a9..99941be 100644
--- a/core/installer/values-tmpl/env-dns.cue
+++ b/core/installer/values-tmpl/env-dns.cue
@@ -38,12 +38,6 @@
branch: "main"
path: "charts/dns-api"
}
- volume: {
- kind: "GitRepository"
- address: "https://github.com/giolekva/pcloud.git"
- branch: "main"
- path: "charts/volumes"
- }
service: {
kind: "GitRepository"
address: "https://github.com/giolekva/pcloud.git"
@@ -58,12 +52,9 @@
}
}
-volumes: {
- data: {
- name: "data"
- accessMode: "ReadWriteMany"
- size: "5Gi"
- }
+volumes: data: {
+ accessMode: "ReadWriteMany"
+ size: "5Gi"
}
helm: {
@@ -174,10 +165,6 @@
}
}
}
- "data-volume": {
- chart: charts.volume
- values: volumes.data
- }
"coredns-svc-cluster": {
chart: charts.service
values: {
diff --git a/core/installer/values-tmpl/gerrit.cue b/core/installer/values-tmpl/gerrit.cue
index 060a7d2..21a0716 100644
--- a/core/installer/values-tmpl/gerrit.cue
+++ b/core/installer/values-tmpl/gerrit.cue
@@ -56,12 +56,6 @@
branch: "main"
path: "charts/ingress"
}
- volume: {
- kind: "GitRepository"
- address: "https://github.com/giolekva/pcloud.git"
- branch: "main"
- path: "charts/volumes"
- }
gerrit: {
kind: "GitRepository"
address: "https://github.com/giolekva/pcloud.git"
@@ -84,12 +78,10 @@
volumes: {
git: {
- name: "git"
accessMode: "ReadWriteMany"
size: "50Gi"
}
logs: {
- name: "logs"
accessMode: "ReadWriteMany"
size: "5Gi"
}
@@ -307,14 +299,4 @@
}
}
}
- "git-volume": {
- chart: charts.volume
- info: "Creating disk for Git repositories"
- values: volumes.git
- }
- "log-volume": {
- chart: charts.volume
- info: "Creating disk for logging"
- values: volumes.logs
- }
}
diff --git a/core/installer/values-tmpl/jenkins.cue b/core/installer/values-tmpl/jenkins.cue
index 9fce898..40f2085 100644
--- a/core/installer/values-tmpl/jenkins.cue
+++ b/core/installer/values-tmpl/jenkins.cue
@@ -42,12 +42,6 @@
branch: "main"
path: "charts/jenkins"
}
- volume: {
- kind: "GitRepository"
- address: "https://github.com/giolekva/pcloud.git"
- branch: "main"
- path: "charts/volumes"
- }
oauth2Client: {
kind: "GitRepository"
address: "https://github.com/giolekva/pcloud.git"
@@ -56,13 +50,7 @@
}
}
-volumes: {
- jenkins: {
- name: "jenkins"
- accessMode: "ReadWriteOnce"
- size: "10Gi"
- }
-}
+volumes: jenkins: size: "10Gi"
_oauth2ClientCredentials: "oauth2-credentials"
_oauth2ClientId: "client_id"
@@ -136,9 +124,4 @@
}
}
}
- "jenkins-data": {
- chart: charts.volume
- info: "Creating disk"
- values: volumes.jenkins
- }
}
diff --git a/core/installer/values-tmpl/zot.cue b/core/installer/values-tmpl/zot.cue
index 0c63c76..cd0feca 100644
--- a/core/installer/values-tmpl/zot.cue
+++ b/core/installer/values-tmpl/zot.cue
@@ -46,21 +46,9 @@
branch: "main"
path: "charts/zot"
}
- volume: {
- kind: "GitRepository"
- address: "https://github.com/giolekva/pcloud.git"
- branch: "main"
- path: "charts/volumes"
- }
}
-volumes: {
- zot: {
- name: "zot"
- accessMode: "ReadWriteOnce"
- size: "100Gi"
- }
-}
+volumes: zot: size: "100Gi"
_httpPort: 80
@@ -105,9 +93,4 @@
startupProbe: {}
}
}
- volume: {
- chart: charts.volume
- info: "Creating disk"
- values: volumes.zot
- }
}
diff --git a/core/installer/welcome/env_test.go b/core/installer/welcome/env_test.go
index 35e968d..d3f5d42 100644
--- a/core/installer/welcome/env_test.go
+++ b/core/installer/welcome/env_test.go
@@ -336,7 +336,6 @@
}
t.Log("----- START ------")
err := util.Walk(bfs, "/", func(path string, info fs.FileInfo, err error) error {
- t.Logf("%s %t\n", path, info.IsDir())
if _, ok := f[path]; ok && !info.IsDir() {
contents, err := util.ReadFile(bfs, path)
if err != nil {