Skip to content

Commit c80aa6e

Browse files
authored
chore: remove the container killer from parameters (#9843)
1 parent 4261175 commit c80aa6e

31 files changed

+113
-2181
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# ignore go generate code files
55
pkg/testutil/k8s/mocks/*_mocks.go
66
pkg/configuration/proto/mocks/*_mocks.go
7-
pkg/configuration/container/mocks/*_mocks.go
87
# pkg/configuration/proto/*.pb.go
98

109
# ignore go mock temporary files

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ endif
134134
.PHONY: test-go-generate
135135
test-go-generate: ## Run go generate against test code.
136136
$(GO) generate -x ./pkg/testutil/k8s/mocks/...
137-
$(GO) generate -x ./pkg/configuration/container/mocks/...
138137
$(GO) generate -x ./pkg/configuration/proto/mocks/...
139138

140139
.PHONY: fmt

apis/parameters/v1alpha1/types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ type ReloadPolicy string
173173
const (
174174
NonePolicy ReloadPolicy = "none"
175175
RestartPolicy ReloadPolicy = "restart"
176-
RestartContainerPolicy ReloadPolicy = "restartContainer"
177-
RollingPolicy ReloadPolicy = "rolling"
178176
AsyncDynamicReloadPolicy ReloadPolicy = "asyncReload"
179177
SyncDynamicReloadPolicy ReloadPolicy = "syncReload"
180178
DynamicReloadAndRestartPolicy ReloadPolicy = "dynamicReloadBeginRestart"

cmd/reloader/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,21 @@ Usage:
3333
reloader [flags]
3434

3535
Flags:
36-
--container-runtime string the config set cri runtime type. (default "auto")
3736
--debug the config set debug.
38-
--disable-runtime the config set disable runtime.
3937
-h, --help help for reloader
4038
--log-level string the config set log level. enum: [error, info, debug] (default "info")
4139
--notify-type notifyType the config describe how to process notification messages. (default signal)
4240
--pod-ip string the config set pod ip address. (default "127.0.0.1")
4341
--process string the config describe what is db program.
4442
--regex string the config set filter config file.
45-
--runtime-endpoint string the config set cri runtime endpoint.
4643
--signal string the config describe reload unix signal. (default "SIGHUP")
4744
--tcp int the config set service port. (default 9901)
4845
--volume-dir stringArray the config map volume directory to watch for updates; may be used multiple times.
4946

5047
```
5148

5249
```shell
53-
./bin/reloader --disable-runtime --log-level debug --process mysqld --signal SIGHUP --volume-dir /opt/mysql --volume-dir /etc/mysql
50+
./bin/reloader --log-level debug --process mysqld --signal SIGHUP --volume-dir /opt/mysql --volume-dir /etc/mysql
5451

5552
```
5653

cmd/reloader/app/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func run(ctx context.Context, opt *VolumeWatcherOpts) error {
119119

120120
func checkAndCreateService(ctx context.Context, opt *VolumeWatcherOpts, handler cfgcore.ConfigHandler) error {
121121
serviceOpt := opt.ServiceOpt
122-
if !serviceOpt.ContainerRuntimeEnable && !serviceOpt.RemoteOnlineUpdateEnable {
122+
if !serviceOpt.RemoteOnlineUpdateEnable {
123123
return nil
124124
}
125125
if err := startGRPCService(opt, ctx, handler); err != nil {

cmd/reloader/app/flags.go

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/spf13/pflag"
2626

2727
appsv1beta1 "github.com/apecloud/kubeblocks/apis/apps/v1beta1"
28-
cfgutil "github.com/apecloud/kubeblocks/pkg/configuration/container"
2928
cfgcore "github.com/apecloud/kubeblocks/pkg/configuration/core"
3029
viper "github.com/apecloud/kubeblocks/pkg/viperx"
3130
)
@@ -89,12 +88,8 @@ type ReconfigureServiceOptions struct {
8988

9089
// EnableRemoteOnlineUpdate enables remote online update
9190
RemoteOnlineUpdateEnable bool
92-
// EnableContainerRuntime enables container runtime
93-
ContainerRuntimeEnable bool
9491

95-
DebugMode bool
96-
ContainerRuntime cfgutil.CRIType
97-
RuntimeEndpoint string
92+
DebugMode bool
9893
}
9994

10095
type VolumeWatcherOpts struct {
@@ -115,9 +110,7 @@ func NewVolumeWatcherOpts() *VolumeWatcherOpts {
115110
ServiceOpt: ReconfigureServiceOptions{
116111
GrpcPort: configManagerDefaultPort,
117112
PodIP: viper.GetString(configPodIPEnvName),
118-
ContainerRuntime: cfgutil.AutoType,
119113
DebugMode: false,
120-
ContainerRuntimeEnable: false,
121114
RemoteOnlineUpdateEnable: false,
122115
},
123116
LogLevel: "info",
@@ -129,42 +122,6 @@ func InstallFlags(flags *pflag.FlagSet, opt *VolumeWatcherOpts) {
129122
"volume-dir",
130123
opt.VolumeDirs,
131124
"the config map volume directory to be watched for updates; may be used multiple times.")
132-
133-
// flags.Var(&opt.NotifyHandType,
134-
// "notify-type",
135-
// "the config describes how to process notification messages.",
136-
// )
137-
//
138-
// for signal handle
139-
// flags.StringVar(&opt.ProcessName,
140-
// "process",
141-
// opt.ProcessName,
142-
// "the config describes what db program is.")
143-
// flags.StringVar((*string)(&opt.Signal),
144-
// "signal",
145-
// string(opt.Signal),
146-
// "the config describes the reload unix signal.")
147-
//
148-
// for exec handle
149-
// flags.StringVar(&opt.Command,
150-
// "command",
151-
// opt.Command,
152-
// "the config describes reload command. ")
153-
//
154-
// for exec tpl scripts
155-
// flags.StringVar(&opt.TPLConfig,
156-
// "tpl-config",
157-
// opt.TPLConfig,
158-
// "the config describes reload behaviors by tpl script.")
159-
// flags.StringVar(&opt.BackupPath,
160-
// "backup-path",
161-
// opt.BackupPath,
162-
// "the config describes backup path.")
163-
// flags.StringVar(&opt.FileRegex,
164-
// "regex",
165-
// opt.FileRegex,
166-
// "the config sets filter config file.")
167-
168125
flags.StringVar(&opt.LogLevel,
169126
"log-level",
170127
opt.LogLevel,
@@ -181,23 +138,10 @@ func InstallFlags(flags *pflag.FlagSet, opt *VolumeWatcherOpts) {
181138
"debug",
182139
opt.ServiceOpt.DebugMode,
183140
"the config sets debug mode.")
184-
flags.StringVar((*string)(&opt.ServiceOpt.ContainerRuntime),
185-
"container-runtime",
186-
string(opt.ServiceOpt.ContainerRuntime),
187-
"the config sets cri runtime type.")
188-
flags.StringVar(&opt.ServiceOpt.RuntimeEndpoint,
189-
"runtime-endpoint",
190-
opt.ServiceOpt.RuntimeEndpoint,
191-
"the config sets cri runtime endpoint.")
192-
193-
flags.BoolVar(&opt.ServiceOpt.ContainerRuntimeEnable,
194-
"cri-enable",
195-
opt.ServiceOpt.ContainerRuntimeEnable,
196-
"the config sets enable cri.")
197141

198142
flags.BoolVar(&opt.ServiceOpt.RemoteOnlineUpdateEnable,
199143
"operator-update-enable",
200-
opt.ServiceOpt.ContainerRuntimeEnable,
144+
opt.ServiceOpt.RemoteOnlineUpdateEnable,
201145
"the config sets enable operator update parameter.")
202146

203147
// for multi handler

cmd/reloader/app/proxy.go

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,68 +25,28 @@ import (
2525
"go.uber.org/zap"
2626

2727
cfgcm "github.com/apecloud/kubeblocks/pkg/configuration/config_manager"
28-
cfgutil "github.com/apecloud/kubeblocks/pkg/configuration/container"
2928
cfgcore "github.com/apecloud/kubeblocks/pkg/configuration/core"
3029
cfgproto "github.com/apecloud/kubeblocks/pkg/configuration/proto"
31-
viper "github.com/apecloud/kubeblocks/pkg/viperx"
3230
)
3331

3432
type reconfigureProxy struct {
3533
cfgproto.ReconfigureServer
3634
updater cfgcm.DynamicUpdater
3735

38-
ctx context.Context
39-
opt ReconfigureServiceOptions
40-
killer cfgutil.ContainerKiller
36+
ctx context.Context
37+
opt ReconfigureServiceOptions
4138

4239
logger *zap.SugaredLogger
4340
}
4441

45-
var stopContainerSignal = viper.GetString(cfgutil.KillContainerSignalEnvName)
46-
4742
func (r *reconfigureProxy) Init(handler cfgcm.ConfigHandler) error {
4843
if err := r.initOnlineUpdater(handler); err != nil {
4944
r.logger.Errorf("init online updater failed: %+v", err)
5045
return err
5146
}
52-
if err := r.initContainerKiller(); err != nil {
53-
r.logger.Errorf("init container killer failed: %+v", err)
54-
return err
55-
}
5647
return nil
5748
}
5849

59-
func (r *reconfigureProxy) initContainerKiller() error {
60-
if !r.opt.ContainerRuntimeEnable {
61-
r.logger.Info("container killer is disabled.")
62-
return nil
63-
}
64-
65-
killer, err := cfgutil.NewContainerKiller(r.opt.ContainerRuntime, r.opt.RuntimeEndpoint, r.logger)
66-
if err != nil {
67-
return cfgcore.WrapError(err, "failed to create container killer")
68-
}
69-
if err := killer.Init(r.ctx); err != nil {
70-
return cfgcore.WrapError(err, "failed to init killer")
71-
}
72-
r.killer = killer
73-
return nil
74-
}
75-
76-
func (r *reconfigureProxy) StopContainer(ctx context.Context, request *cfgproto.StopContainerRequest) (*cfgproto.StopContainerResponse, error) {
77-
if r.killer == nil {
78-
return nil, cfgcore.MakeError("container killing process is not initialized.")
79-
}
80-
ds := request.GetContainerIDs()
81-
if len(ds) == 0 {
82-
return &cfgproto.StopContainerResponse{ErrMessage: "no match for any container with containerId."}, nil
83-
}
84-
if err := r.killer.Kill(ctx, ds, stopContainerSignal, nil); err != nil {
85-
return nil, err
86-
}
87-
return &cfgproto.StopContainerResponse{}, nil
88-
}
89-
9050
func (r *reconfigureProxy) OnlineUpgradeParams(ctx context.Context, request *cfgproto.OnlineUpgradeParamsRequest) (*cfgproto.OnlineUpgradeParamsResponse, error) {
9151
if r.updater == nil {
9252
return nil, cfgcore.MakeError("online updating process is not initialized.")

controllers/parameters/parallel_upgrade_policy.go

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)