AppManager: Monitor volumes
Change-Id: I0f1e007099b660dc055371fdf5dea7ba700ed485
diff --git a/core/installer/app_configs/app_base.cue b/core/installer/app_configs/app_base.cue
index 711dbe7..1a60440 100644
--- a/core/installer/app_configs/app_base.cue
+++ b/core/installer/app_configs/app_base.cue
@@ -69,10 +69,81 @@
name: string
size: string
accessMode: "ReadWriteOnce" | "ReadOnlyMany" | "ReadWriteMany" | "ReadWriteOncePod" | *"ReadWriteOnce"
+ ...
}
-#Volume: {
- #VolumeInput
+#Volume: #WithOut & #VolumeInput & {
+ cluster?: #Cluster
+ name: string
+ size: string
+ accessMode: string
+
+ _cluster: cluster
+ _name: name
+ _size: size
+ _accessMode: accessMode
+
+ charts: {
+ volume: {
+ kind: "GitRepository"
+ address: "https://code.v1.dodo.cloud/helm-charts"
+ branch: "main"
+ path: "charts/volumes"
+ }
+ }
+
+ helm: {
+ "\(name)-volume": {
+ chart: charts.volume
+ if _cluster != _|_ {
+ cluster: _cluster
+ }
+ info: "Creating disk for \(name)"
+ annotations: {
+ "dodo.cloud/resource-type": "volume"
+ "dodo.cloud/resource.volume.name": name
+ "dodo.cloud/resource.volume.size": size
+ }
+ values: {
+ name: _name
+ size: _size
+ accessMode: _accessMode
+ }
+ }
+ }
+}
+
+#WithOut: {
+ cluster?: #Cluster
+ _cluster: cluster
+ volume: {...}
+ volume: {
+ for k, v in volume {
+ "\(k)": #Volume & v & {
+ name: k
+ if _cluster != _|_ {
+ cluster: _cluster
+ }
+ }
+ }
+ ...
+ }
+ charts: {
+ for k, v in volume {
+ for x, y in v.charts {
+ "\(x)": y
+ }
+ }
+ }
+ helmR: {
+ for k, v in volume {
+ for x, y in v.helmR {
+ "\(x)": y
+ }
+ }
+ ...
+ }
+ ...
}
#Chart: #GitRepositoryRef | #HelmRepositoryRef
@@ -912,12 +983,6 @@
cluster?: #Cluster
_cluster: cluster
charts: {
- volume: {
- kind: "GitRepository"
- address: "https://code.v1.dodo.cloud/helm-charts"
- branch: "main"
- path: "charts/volumes"
- }
secret: {
kind: "GitRepository"
address: "https://code.v1.dodo.cloud/helm-charts"
@@ -926,34 +991,6 @@
}
...
}
- volume: {...}
- volume: {
- for k, v in volume {
- "\(k)": #Volume & v & {
- name: k
- if _cluster != _|_ {
- cluster: _cluster
- }
- }
- }
- }
- helm: {
- for k, v in volume {
- "\(k)-volume": {
- chart: charts.volume
- info: "Creating disk for \(k)"
- annotations: {
- "dodo.cloud/resource-type": "volume"
- "dodo.cloud/resource.volume.name": v.name
- "dodo.cloud/resource.volume.size": v.size
- }
- values: v
- if v.cluster != _|_ {
- cluster: v.cluster
- }
- }
- }
- }
}
#WithOut: {
diff --git a/core/installer/status/instance.go b/core/installer/status/instance.go
index ad05e5a..c88e5e5 100644
--- a/core/installer/status/instance.go
+++ b/core/installer/status/instance.go
@@ -64,6 +64,13 @@
}
status = mergeStatus(status, hs)
}
+ for _, i := range out.Volume {
+ if s, err := m.monitor(namespace, DodoResource{"volume", i.Name}, i, ret); err != nil {
+ return StatusNoStatus, err
+ } else {
+ s = mergeStatus(status, s)
+ }
+ }
for _, i := range out.PostgreSQL {
if s, err := m.monitor(namespace, DodoResource{"postgresql", i.Name}, i, ret); err != nil {
return StatusNoStatus, err
@@ -105,6 +112,7 @@
type ResourceOut struct {
Name string `json:"name"`
+ Volume map[string]ResourceOut `json:"volume"`
PostgreSQL map[string]ResourceOut `json:"postgresql"`
MongoDB map[string]ResourceOut `json:"mongodb"`
Ingress map[string]resourceIngress `json:"ingress"`