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
小 白蛋
Tke
Commits
9c8d339d
Unverified
Commit
9c8d339d
authored
4 years ago
by
Leo Ryu
Committed by
GitHub
4 years ago
Browse files
Options
Download
Email Patches
Plain Diff
feat(installer): upgrade monitor during upgrade (#1131)
parent
74def1c7
master
dev-api-1.19.7
fix-dev
github_env_test
industry-cloud-1.9
listai-bug-fix
mcm
release-1.6
release-1.7
release-1.8
release-1.9
revert-1247-add-registered-cluster
revert-1394-feat/enable-container-runtime
revert-1751-ingress-version
support-cilium
support-containerd-design
test
test_etcd_image
v1.9.0
v1.8.1
v1.8.0
v1.7.1
v1.7.0
v1.6.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/tke-installer/app/installer/upgrader.go
+66
-6
cmd/tke-installer/app/installer/upgrader.go
with
66 additions
and
6 deletions
+66
-6
cmd/tke-installer/app/installer/upgrader.go
+
66
-
6
View file @
9c8d339d
...
...
@@ -79,12 +79,20 @@ func (t *TKE) upgradeSteps() {
t
.
steps
=
append
(
t
.
steps
,
[]
types
.
Handler
{
{
Name
:
"Up
dat
e tke-platform-api"
,
Func
:
t
.
up
dat
eTKEPlatformAPI
,
Name
:
"Up
grad
e tke-platform-api"
,
Func
:
t
.
up
grad
eTKEPlatformAPI
,
},
{
Name
:
"Update tke-platform-controller"
,
Func
:
t
.
updateTKEPlatformController
,
Name
:
"Upgrade tke-platform-controller"
,
Func
:
t
.
upgradeTKEPlatformController
,
},
{
Name
:
"Upgrade tke-monitor-api"
,
Func
:
t
.
upgradeTKEMonitorAPI
,
},
{
Name
:
"Upgrade tke-monitor-controller"
,
Func
:
t
.
upgradeTKEMonitorController
,
},
}
...
)
...
...
@@ -116,7 +124,7 @@ func (t *TKE) upgradeSteps() {
}
}
func
(
t
*
TKE
)
up
dat
eTKEPlatformAPI
(
ctx
context
.
Context
)
error
{
func
(
t
*
TKE
)
up
grad
eTKEPlatformAPI
(
ctx
context
.
Context
)
error
{
com
:=
"tke-platform-api"
depl
,
err
:=
t
.
globalClient
.
AppsV1
()
.
Deployments
(
t
.
namespace
)
.
Get
(
ctx
,
com
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
...
...
@@ -142,7 +150,7 @@ func (t *TKE) updateTKEPlatformAPI(ctx context.Context) error {
})
}
func
(
t
*
TKE
)
up
dat
eTKEPlatformController
(
ctx
context
.
Context
)
error
{
func
(
t
*
TKE
)
up
grad
eTKEPlatformController
(
ctx
context
.
Context
)
error
{
com
:=
"tke-platform-controller"
depl
,
err
:=
t
.
globalClient
.
AppsV1
()
.
Deployments
(
t
.
namespace
)
.
Get
(
ctx
,
com
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
...
...
@@ -190,6 +198,58 @@ func (t *TKE) updateTKEPlatformController(ctx context.Context) error {
})
}
func
(
t
*
TKE
)
upgradeTKEMonitorAPI
(
ctx
context
.
Context
)
error
{
com
:=
"tke-monitor-api"
depl
,
err
:=
t
.
globalClient
.
AppsV1
()
.
Deployments
(
t
.
namespace
)
.
Get
(
ctx
,
com
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
err
}
if
len
(
depl
.
Spec
.
Template
.
Spec
.
Containers
)
==
0
{
return
fmt
.
Errorf
(
"%s has no containers"
,
com
)
}
depl
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
=
images
.
Get
()
.
TKEMonitorAPI
.
FullName
()
_
,
err
=
t
.
globalClient
.
AppsV1
()
.
Deployments
(
t
.
namespace
)
.
Update
(
ctx
,
depl
,
metav1
.
UpdateOptions
{})
if
err
!=
nil
{
return
err
}
return
wait
.
PollImmediate
(
5
*
time
.
Second
,
10
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
ok
,
err
:=
apiclient
.
CheckDeployment
(
ctx
,
t
.
globalClient
,
t
.
namespace
,
com
)
if
err
!=
nil
{
return
false
,
nil
}
return
ok
,
nil
})
}
func
(
t
*
TKE
)
upgradeTKEMonitorController
(
ctx
context
.
Context
)
error
{
com
:=
"tke-monitor-controller"
depl
,
err
:=
t
.
globalClient
.
AppsV1
()
.
Deployments
(
t
.
namespace
)
.
Get
(
ctx
,
com
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
err
}
if
len
(
depl
.
Spec
.
Template
.
Spec
.
Containers
)
==
0
{
return
fmt
.
Errorf
(
"%s has no containers"
,
com
)
}
depl
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
=
images
.
Get
()
.
TKEMonitorController
.
FullName
()
_
,
err
=
t
.
globalClient
.
AppsV1
()
.
Deployments
(
t
.
namespace
)
.
Update
(
ctx
,
depl
,
metav1
.
UpdateOptions
{})
if
err
!=
nil
{
return
err
}
return
wait
.
PollImmediate
(
5
*
time
.
Second
,
10
*
time
.
Minute
,
func
()
(
bool
,
error
)
{
ok
,
err
:=
apiclient
.
CheckDeployment
(
ctx
,
t
.
globalClient
,
t
.
namespace
,
com
)
if
err
!=
nil
{
return
false
,
nil
}
return
ok
,
nil
})
}
func
(
t
*
TKE
)
prepareForUpgrade
(
ctx
context
.
Context
)
error
{
t
.
namespace
=
namespace
...
...
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