Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Rainbond
Commits
272764b1
Unverified
Commit
272764b1
authored
3 years ago
by
barnettZQG
Committed by
GitHub
3 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #1056 from GLYASAI/issue-1041
bug fix: close closed channel
parents
7221c487
e78c8aed
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
worker/master/master.go
+20
-17
worker/master/master.go
with
20 additions
and
17 deletions
+20
-17
worker/master/master.go
+
20
-
17
View file @
272764b1
...
...
@@ -52,6 +52,7 @@ type Controller struct {
ctx
context
.
Context
cancel
context
.
CancelFunc
conf
option
.
Config
restConfig
*
rest
.
Config
store
store
.
Storer
dbmanager
db
.
Manager
memoryUse
*
prometheus
.
GaugeVec
...
...
@@ -106,35 +107,19 @@ func NewMasterController(conf option.Config, store store.Storer, kubeClient kube
},
serverVersion
.
GitVersion
)
stopCh
:=
make
(
chan
struct
{})
mgr
,
err
:=
ctrl
.
NewManager
(
restConfig
,
ctrl
.
Options
{
Scheme
:
common
.
Scheme
,
LeaderElection
:
false
,
LeaderElectionID
:
"controllers.rainbond.io"
,
})
if
err
!=
nil
{
cancel
()
return
nil
,
err
}
thirdcomponentController
,
err
:=
thirdcomponent
.
Setup
(
ctx
,
mgr
)
if
err
!=
nil
{
cancel
()
return
nil
,
err
}
helmAppController
:=
helmapp
.
NewController
(
ctx
,
stopCh
,
kubeClient
,
rainbondClient
,
store
.
Informer
()
.
HelmApp
,
store
.
Lister
()
.
HelmApp
,
conf
.
Helm
.
RepoFile
,
conf
.
Helm
.
RepoCache
,
conf
.
Helm
.
RepoCache
)
return
&
Controller
{
conf
:
conf
,
restConfig
:
restConfig
,
pc
:
pc
,
helmAppController
:
helmAppController
,
controllers
:
[]
mcontroller
.
Controller
{
thirdcomponentController
},
store
:
store
,
stopCh
:
stopCh
,
cancel
:
cancel
,
ctx
:
ctx
,
dbmanager
:
db
.
GetManager
(),
mgr
:
mgr
,
memoryUse
:
prometheus
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Namespace
:
"app_resource"
,
Name
:
"appmemory"
,
...
...
@@ -211,7 +196,24 @@ func (m *Controller) Start() error {
// helm app controller
go
m
.
helmAppController
.
Start
()
defer
m
.
helmAppController
.
Stop
()
// start controller
mgr
,
err
:=
ctrl
.
NewManager
(
m
.
restConfig
,
ctrl
.
Options
{
Scheme
:
common
.
Scheme
,
LeaderElection
:
false
,
LeaderElectionID
:
"controllers.rainbond.io"
,
})
if
err
!=
nil
{
logrus
.
Errorf
(
"create new manager: %v"
,
err
)
return
}
thirdComponentController
,
err
:=
thirdcomponent
.
Setup
(
ctx
,
mgr
)
if
err
!=
nil
{
logrus
.
Errorf
(
"setup third component controller: %v"
,
err
)
return
}
m
.
mgr
=
mgr
m
.
controllers
=
append
(
m
.
controllers
,
thirdComponentController
)
stopchan
:=
make
(
chan
struct
{})
go
m
.
mgr
.
Start
(
stopchan
)
...
...
@@ -310,6 +312,7 @@ func (m *Controller) Scrape(ch chan<- prometheus.Metric, scrapeDurationDesc *pro
logrus
.
Infof
(
"success collect worker master metric"
)
}
// GetStore -
func
(
m
*
Controller
)
GetStore
()
store
.
Storer
{
return
m
.
store
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help