/
fuse.go
92 lines (72 loc) · 1.98 KB
/
fuse.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
92
package config
import (
"errors"
syndesisv1alpha1 "github.com/syndesisio/syndesis/install/operator/pkg/apis/syndesis/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
integreatlyv1alpha1 "github.com/integr8ly/integreatly-operator/pkg/apis/integreatly/v1alpha1"
)
func NewFuse(config ProductConfig) *Fuse {
return &Fuse{config: config}
}
type Fuse struct {
config ProductConfig
}
func (f *Fuse) GetWatchableCRDs() []runtime.Object {
return []runtime.Object{
&syndesisv1alpha1.Syndesis{
TypeMeta: metav1.TypeMeta{
Kind: "Syndesis",
APIVersion: syndesisv1alpha1.SchemeGroupVersion.String(),
},
},
}
}
func (f *Fuse) GetNamespace() string {
return f.config["NAMESPACE"]
}
func (f *Fuse) SetNamespace(newNamespace string) {
f.config["NAMESPACE"] = newNamespace
}
func (f *Fuse) GetOperatorNamespace() string {
return f.config["OPERATOR_NAMESPACE"]
}
func (f *Fuse) SetOperatorNamespace(newNamespace string) {
f.config["OPERATOR_NAMESPACE"] = newNamespace
}
func (f *Fuse) GetHost() string {
return f.config["HOST"]
}
func (f *Fuse) SetHost(newHost string) {
f.config["HOST"] = newHost
}
func (f *Fuse) Read() ProductConfig {
return f.config
}
func (f *Fuse) GetLabelSelector() string {
return "middleware"
}
func (r *Fuse) GetTemplateList() []string {
templateList := []string{
"kube_state_metrics_fuse_online_alerts.yaml",
}
return templateList
}
func (f *Fuse) GetProductName() integreatlyv1alpha1.ProductName {
return integreatlyv1alpha1.ProductFuse
}
func (f *Fuse) GetProductVersion() integreatlyv1alpha1.ProductVersion {
return integreatlyv1alpha1.VersionFuseOnline
}
func (f *Fuse) GetOperatorVersion() integreatlyv1alpha1.OperatorVersion {
return integreatlyv1alpha1.OperatorVersionFuse
}
func (f *Fuse) Validate() error {
if f.GetProductName() == "" {
return errors.New("config product name is not defined")
}
if f.GetNamespace() == "" {
return errors.New("config namespace is not defined")
}
return nil
}