This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
application.go
88 lines (80 loc) · 3.86 KB
/
application.go
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
package application
import (
"github.com/caos/orbos/internal/operator/boom/api/v1beta2"
"github.com/caos/orbos/internal/operator/boom/application/applications/ambassador"
ambassadorinfo "github.com/caos/orbos/internal/operator/boom/application/applications/ambassador/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/argocd"
argocdinfo "github.com/caos/orbos/internal/operator/boom/application/applications/argocd/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/grafana"
grafanainfo "github.com/caos/orbos/internal/operator/boom/application/applications/grafana/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/kubestatemetrics"
kubestatemetricsinfo "github.com/caos/orbos/internal/operator/boom/application/applications/kubestatemetrics/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/loggingoperator"
loggingoperatorinfo "github.com/caos/orbos/internal/operator/boom/application/applications/loggingoperator/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/loki"
lokiinfo "github.com/caos/orbos/internal/operator/boom/application/applications/loki/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/metricsserver"
metricsserverinfo "github.com/caos/orbos/internal/operator/boom/application/applications/metricsserver/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/prometheus"
prometheusinfo "github.com/caos/orbos/internal/operator/boom/application/applications/prometheus/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/prometheusnodeexporter"
prometheusnodeexporterinfo "github.com/caos/orbos/internal/operator/boom/application/applications/prometheusnodeexporter/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/prometheusoperator"
prometheusoperatorinfo "github.com/caos/orbos/internal/operator/boom/application/applications/prometheusoperator/info"
"github.com/caos/orbos/internal/operator/boom/application/applications/prometheussystemdexporter"
prometheussystemdexporterinfo "github.com/caos/orbos/internal/operator/boom/application/applications/prometheussystemdexporter/info"
"github.com/caos/orbos/internal/operator/boom/name"
"github.com/caos/orbos/internal/operator/boom/templator/helm/chart"
"github.com/caos/orbos/mntr"
)
type Application interface {
Deploy(*v1beta2.ToolsetSpec) bool
GetName() name.Application
}
type HelmApplication interface {
Application
GetNamespace() string
GetChartInfo() *chart.Chart
GetImageTags() map[string]string
SpecToHelmValues(mntr.Monitor, *v1beta2.ToolsetSpec) interface{}
}
type YAMLApplication interface {
Application
GetYaml(mntr.Monitor, *v1beta2.ToolsetSpec) interface{}
}
func New(monitor mntr.Monitor, appName name.Application, orb string) Application {
switch appName {
case ambassadorinfo.GetName():
return ambassador.New(monitor)
case argocdinfo.GetName():
return argocd.New(monitor)
case grafanainfo.GetName():
return grafana.New(monitor)
case kubestatemetricsinfo.GetName():
return kubestatemetrics.New(monitor)
case prometheusoperatorinfo.GetName():
return prometheusoperator.New(monitor)
case loggingoperatorinfo.GetName():
return loggingoperator.New(monitor)
case prometheusnodeexporterinfo.GetName():
return prometheusnodeexporter.New(monitor)
case prometheussystemdexporterinfo.GetName():
return prometheussystemdexporter.New()
case prometheusinfo.GetName():
return prometheus.New(monitor, orb)
case lokiinfo.GetName():
return loki.New(monitor)
case metricsserverinfo.GetName():
return metricsserver.New(monitor)
}
return nil
}
func GetOrderNumber(appName name.Application) int {
switch appName {
case prometheusinfo.GetName():
return prometheusinfo.GetOrderNumber()
case lokiinfo.GetName():
return lokiinfo.GetOrderNumber()
}
return 1
}