-
Notifications
You must be signed in to change notification settings - Fork 348
/
Copy pathproduction.go
90 lines (74 loc) · 2.11 KB
/
production.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
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 productionController struct {
ctx context.Context
jaeger *v1alpha1.Jaeger
}
func newProductionController(ctx context.Context, jaeger *v1alpha1.Jaeger) *productionController {
return &productionController{
ctx: ctx,
jaeger: jaeger,
}
}
func (c *productionController) Create() []runtime.Object {
collector := deployment.NewCollector(c.jaeger)
query := deployment.NewQuery(c.jaeger)
agent := deployment.NewAgent(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,
collector.Get(),
inject.OAuthProxy(c.jaeger, query.Get()),
)
if ds := agent.Get(); nil != ds {
os = append(os, ds)
}
// add the services
for _, svc := range collector.Services() {
os = append(os, svc)
}
for _, svc := range query.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 *productionController) Update() []runtime.Object {
logrus.Debug("Update isn't yet available")
return []runtime.Object{}
}
func (c *productionController) Dependencies() []batchv1.Job {
return storage.Dependencies(c.jaeger)
}