-
Notifications
You must be signed in to change notification settings - Fork 348
/
Copy pathall-in-one.go
84 lines (68 loc) · 2.01 KB
/
all-in-one.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
package jaeger
import (
"context"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
batchv1 "k8s.io/api/batch/v1"
"k8s.io/apimachinery/pkg/runtime"
"github.com/jaegertracing/jaeger-operator/pkg/account"
"github.com/jaegertracing/jaeger-operator/pkg/apis/io/v1alpha1"
"github.com/jaegertracing/jaeger-operator/pkg/configmap"
"github.com/jaegertracing/jaeger-operator/pkg/deployment"
"github.com/jaegertracing/jaeger-operator/pkg/ingress"
"github.com/jaegertracing/jaeger-operator/pkg/inject"
"github.com/jaegertracing/jaeger-operator/pkg/route"
"github.com/jaegertracing/jaeger-operator/pkg/storage"
)
type allInOneController struct {
ctx context.Context
jaeger *v1alpha1.Jaeger
}
func newAllInOneController(ctx context.Context, jaeger *v1alpha1.Jaeger) *allInOneController {
return &allInOneController{
ctx: ctx,
jaeger: jaeger,
}
}
func (c *allInOneController) Create() []runtime.Object {
logrus.Debugf("Creating all-in-one for '%v'", c.jaeger.Name)
dep := deployment.NewAllInOne(c.jaeger)
os := []runtime.Object{}
// add all service accounts
for _, acc := range account.Get(c.jaeger) {
os = append(os, acc)
}
// add the deployments
os = append(os, inject.OAuthProxy(c.jaeger, dep.Get()))
ds := deployment.NewAgent(c.jaeger).Get()
if nil != ds {
os = append(os, ds)
}
// add the services
for _, svc := range dep.Services() {
os = append(os, svc)
}
// add the routes/ingresses
if viper.GetString("platform") == v1alpha1.FlagPlatformOpenShift {
if q := route.NewQueryRoute(c.jaeger).Get(); nil != q {
os = append(os, q)
}
} else {
if q := ingress.NewQueryIngress(c.jaeger).Get(); nil != q {
os = append(os, q)
}
}
// add the config map
cm := configmap.NewUIConfig(c.jaeger).Get()
if nil != cm {
os = append(os, cm)
}
return os
}
func (c *allInOneController) Update() []runtime.Object {
logrus.Debug("Update isn't available for all-in-one")
return []runtime.Object{}
}
func (c *allInOneController) Dependencies() []batchv1.Job {
return storage.Dependencies(c.jaeger)
}