-
Notifications
You must be signed in to change notification settings - Fork 217
/
builder.go
91 lines (81 loc) · 3.43 KB
/
builder.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
89
90
91
package operators
import (
manifestsapi "github.com/openshift/assisted-service/internal/manifests/api"
"github.com/openshift/assisted-service/internal/operators/api"
"github.com/openshift/assisted-service/internal/operators/authorino"
"github.com/openshift/assisted-service/internal/operators/cnv"
"github.com/openshift/assisted-service/internal/operators/lso"
"github.com/openshift/assisted-service/internal/operators/lvm"
"github.com/openshift/assisted-service/internal/operators/mce"
"github.com/openshift/assisted-service/internal/operators/mtv"
"github.com/openshift/assisted-service/internal/operators/nodefeaturediscovery"
"github.com/openshift/assisted-service/internal/operators/nvidiagpu"
"github.com/openshift/assisted-service/internal/operators/odf"
"github.com/openshift/assisted-service/internal/operators/openshiftai"
"github.com/openshift/assisted-service/internal/operators/osc"
"github.com/openshift/assisted-service/internal/operators/pipelines"
"github.com/openshift/assisted-service/internal/operators/serverless"
"github.com/openshift/assisted-service/internal/operators/servicemesh"
"github.com/openshift/assisted-service/models"
"github.com/openshift/assisted-service/pkg/s3wrapper"
"github.com/sirupsen/logrus"
)
var OperatorCVO = models.MonitoredOperator{
Name: "cvo",
OperatorType: models.OperatorTypeBuiltin,
TimeoutSeconds: 60 * 60,
}
var OperatorConsole = models.MonitoredOperator{
Name: "console",
OperatorType: models.OperatorTypeBuiltin,
TimeoutSeconds: 60 * 60,
}
type Options struct {
CheckClusterVersion bool
CNVConfig cnv.Config
}
// NewManager creates new instance of an Operator Manager
func NewManager(log logrus.FieldLogger, manifestAPI manifestsapi.ManifestsAPI, options Options, objectHandler s3wrapper.API) *Manager {
return NewManagerWithOperators(
log, manifestAPI, options, objectHandler,
lso.NewLSOperator(),
odf.NewOcsOperator(log),
odf.NewOdfOperator(log),
cnv.NewCNVOperator(log, options.CNVConfig),
lvm.NewLvmOperator(log),
mce.NewMceOperator(log),
mtv.NewMTVOperator(log),
nodefeaturediscovery.NewNodeFeatureDiscoveryOperator(log),
nvidiagpu.NewNvidiaGPUOperator(log),
pipelines.NewPipelinesOperator(log),
servicemesh.NewServiceMeshOperator(log),
serverless.NewServerLessOperator(log),
openshiftai.NewOpenShiftAIOperator(log),
authorino.NewAuthorinoOperator(log),
osc.NewOscOperator(log),
)
}
// NewManagerWithOperators creates new instance of an Operator Manager and configures it with given operators
func NewManagerWithOperators(log logrus.FieldLogger, manifestAPI manifestsapi.ManifestsAPI, options Options, objectHandler s3wrapper.API, olmOperators ...api.Operator) *Manager {
nameToOperator := make(map[string]api.Operator)
// monitoredOperators includes all the supported operators to be monitored.
monitoredOperators := map[string]*models.MonitoredOperator{
// Builtins
OperatorConsole.Name: &OperatorConsole,
}
if options.CheckClusterVersion {
monitoredOperators[OperatorCVO.Name] = &OperatorCVO
}
for _, olmOperator := range olmOperators {
nameToOperator[olmOperator.GetName()] = olmOperator
// Add OLM operator to the monitoredOperators map
monitoredOperators[olmOperator.GetName()] = olmOperator.GetMonitoredOperator()
}
return &Manager{
log: log,
olmOperators: nameToOperator,
monitoredOperators: monitoredOperators,
manifestsAPI: manifestAPI,
objectHandler: objectHandler,
}
}