1
1
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2
2
3
3
Date: Wed, 9 Jun 2021 16:32:33 +0800
4
- Subject: [PATCH] run operator
4
+ Subject: run operator
5
5
6
6
Signed-off-by: l1b0k <
[email protected] >
7
7
---
8
- daemon/cmd/daemon_main.go | 25 +++--
9
- operator/Makefile | 2 +-
10
- operator/main.go | 225 --------------------------------------
11
- 3 files changed, 19 insertions(+), 233 deletions(-)
8
+ operator/Makefile | 2 +-
9
+ operator/main.go | 243 ++--------------------------------------------
10
+ 2 files changed, 11 insertions(+), 234 deletions(-)
12
11
13
- diff --git a/daemon/cmd/daemon_main.go b/daemon/cmd/daemon_main.go
14
- index 28bf66a7a9..1f2796810b 100644
15
- --- a/daemon/cmd/daemon_main.go
16
- +++ b/daemon/cmd/daemon_main.go
17
- @@ -14,13 +14,6 @@ import (
18
- "strings"
19
- "time"
20
-
21
- - "github.com/go-openapi/loads"
22
- - gops "github.com/google/gops/agent"
23
- - "github.com/sirupsen/logrus"
24
- - "github.com/spf13/cobra"
25
- - "github.com/spf13/viper"
26
- - "google.golang.org/grpc"
27
- -
28
- "github.com/cilium/cilium/api/v1/server"
29
- "github.com/cilium/cilium/api/v1/server/restapi"
30
- "github.com/cilium/cilium/pkg/aws/eni"
31
- @@ -28,6 +21,7 @@ import (
32
- "github.com/cilium/cilium/pkg/bgpv1/gobgp"
33
- "github.com/cilium/cilium/pkg/bpf"
34
- "github.com/cilium/cilium/pkg/cgroups"
35
- + "github.com/cilium/cilium/pkg/command/exec"
36
- "github.com/cilium/cilium/pkg/common"
37
- "github.com/cilium/cilium/pkg/components"
38
- "github.com/cilium/cilium/pkg/controller"
39
- @@ -75,6 +69,12 @@ import (
40
- "github.com/cilium/cilium/pkg/version"
41
- wireguard "github.com/cilium/cilium/pkg/wireguard/agent"
42
- wireguardTypes "github.com/cilium/cilium/pkg/wireguard/types"
43
- + "github.com/go-openapi/loads"
44
- + gops "github.com/google/gops/agent"
45
- + "github.com/sirupsen/logrus"
46
- + "github.com/spf13/cobra"
47
- + "github.com/spf13/viper"
48
- + "google.golang.org/grpc"
49
- )
50
-
51
- const (
52
- @@ -1624,6 +1624,17 @@ func (d *Daemon) initKVStore() {
53
- }
54
-
55
- func runDaemon() {
56
- + go func() {
57
- + if os.Getenv("DISABLE_CILIUM_OPERATOR") == "true" {
58
- + return
59
- + }
60
- + cmd := exec.CommandContext(server.ServerCtx, "cilium-operator-generic", "--skip-crd-creation", "--k8s-namespace", os.Getenv("CILIUM_K8S_NAMESPACE"), "--identity-gc-interval", "10m", "--identity-heartbeat-timeout", "20m")
61
- + cmd.Stdout = os.Stdout
62
- + cmd.Stderr = os.Stderr
63
- + err := cmd.Run()
64
- + log.Fatal(fmt.Errorf("cilium-operator exited, %w", err))
65
- + }()
66
- +
67
- datapathConfig := linuxdatapath.DatapathConfiguration{
68
- HostDevice: defaults.HostDevice,
69
- ProcFs: option.Config.ProcFs,
70
12
diff --git a/operator/Makefile b/operator/Makefile
71
13
index ebd1285e3d..1710880c84 100644
72
14
--- a/operator/Makefile
@@ -81,7 +23,7 @@ index ebd1285e3d..1710880c84 100644
81
23
cilium-operator-aws: GO_TAGS_FLAGS+=ipam_provider_aws
82
24
cilium-operator-azure: GO_TAGS_FLAGS+=ipam_provider_azure
83
25
diff --git a/operator/main.go b/operator/main.go
84
- index 756b218121..ec71d565dc 100644
26
+ index 756b218121..ec0a329109 100644
85
27
--- a/operator/main.go
86
28
+++ b/operator/main.go
87
29
@@ -15,30 +15,22 @@ import (
@@ -123,7 +65,33 @@ index 756b218121..ec71d565dc 100644
123
65
"github.com/cilium/cilium/pkg/rand"
124
66
"github.com/cilium/cilium/pkg/rate"
125
67
"github.com/cilium/cilium/pkg/version"
126
- @@ -250,14 +241,6 @@ func runOperator() {
68
+ @@ -72,15 +63,17 @@ var (
69
+ }
70
+
71
+ // Open socket for using gops to get stacktraces of the agent.
72
+ - addr := fmt.Sprintf("127.0.0.1:%d", viper.GetInt(option.GopsPort))
73
+ - addrField := logrus.Fields{"address": addr}
74
+ - if err := gops.Listen(gops.Options{
75
+ - Addr: addr,
76
+ - ReuseSocketAddrAndPort: true,
77
+ - }); err != nil {
78
+ - log.WithError(err).WithFields(addrField).Fatal("Cannot start gops server")
79
+ + if viper.GetInt(option.GopsPort) > 0 {
80
+ + addr := fmt.Sprintf("127.0.0.1:%d", viper.GetInt(option.GopsPort))
81
+ + addrField := logrus.Fields{"address": addr}
82
+ + if err := gops.Listen(gops.Options{
83
+ + Addr: addr,
84
+ + ReuseSocketAddrAndPort: true,
85
+ + }); err != nil {
86
+ + log.WithError(err).WithFields(addrField).Fatal("Cannot start gops server")
87
+ + }
88
+ + log.WithFields(addrField).Info("Started gops server")
89
+ }
90
+ - log.WithFields(addrField).Info("Started gops server")
91
+
92
+ initEnv()
93
+ runOperator()
94
+ @@ -250,14 +243,6 @@ func runOperator() {
127
95
}
128
96
}()
129
97
@@ -138,7 +106,7 @@ index 756b218121..ec71d565dc 100644
138
106
initK8s(k8sInitDone)
139
107
140
108
capabilities := k8sversion.Capabilities()
141
- @@ -367,189 +350 ,6 @@ func onOperatorStartLeading(ctx context.Context) {
109
+ @@ -367,189 +352 ,6 @@ func onOperatorStartLeading(ctx context.Context) {
142
110
go cesController.Run(operatorWatchers.CiliumEndpointStore, stopCh)
143
111
}
144
112
@@ -328,7 +296,7 @@ index 756b218121..ec71d565dc 100644
328
296
if operatorOption.Config.IdentityGCInterval != 0 {
329
297
identityRateLimiter = rate.NewLimiter(
330
298
operatorOption.Config.IdentityGCRateInterval,
331
- @@ -583,31 +383 ,6 @@ func onOperatorStartLeading(ctx context.Context) {
299
+ @@ -583,31 +385 ,6 @@ func onOperatorStartLeading(ctx context.Context) {
332
300
enableCiliumEndpointSyncGC(true)
333
301
}
334
302
@@ -361,5 +329,5 @@ index 756b218121..ec71d565dc 100644
361
329
362
330
<-shutdownSignal
363
331
- -
364
- 2.39.1
332
+ 2.39.5 (Apple Git-154)
365
333
0 commit comments