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
/
helm.go
53 lines (42 loc) · 1.48 KB
/
helm.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
package loggingoperator
import (
toolsetslatest "github.com/caos/orbos/internal/operator/boom/api/latest"
"github.com/caos/orbos/internal/operator/boom/application/applications/loggingoperator/helm"
"github.com/caos/orbos/internal/operator/boom/application/applications/loki/logs"
"github.com/caos/orbos/internal/operator/boom/templator/helm/chart"
"github.com/caos/orbos/mntr"
)
func (l *LoggingOperator) HelmPreApplySteps(monitor mntr.Monitor, toolsetCRDSpec *toolsetslatest.ToolsetSpec) ([]interface{}, error) {
return logs.GetAllResources(toolsetCRDSpec), nil
}
func (l *LoggingOperator) SpecToHelmValues(monitor mntr.Monitor, toolset *toolsetslatest.ToolsetSpec) interface{} {
// spec := toolset.LoggingOperator
values := helm.DefaultValues(l.GetImageTags())
// if spec.ReplicaCount != 0 {
// values.ReplicaCount = spec.ReplicaCount
// }
spec := toolset.LogCollection
if spec == nil || spec.Operator == nil {
return values
}
if spec.Operator.NodeSelector != nil {
for k, v := range spec.Operator.NodeSelector {
values.NodeSelector[k] = v
}
}
if spec.Operator.Tolerations != nil {
for _, tol := range spec.Operator.Tolerations {
values.Tolerations = append(values.Tolerations, tol)
}
}
if spec.Operator.Resources != nil {
values.Resources = spec.Operator.Resources
}
return values
}
func (l *LoggingOperator) GetChartInfo() *chart.Chart {
return helm.GetChartInfo()
}
func (l *LoggingOperator) GetImageTags() map[string]string {
return helm.GetImageTags()
}