Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tke-eos
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
tke-eos
Commits
a836920d
Commit
a836920d
authored
Jun 14, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化删除rs
parent
cf6608b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
11 deletions
+37
-11
service.js
app/service.js
+19
-3
service.js
kubeService/service.js
+12
-2
java.yaml
yamls/java.yaml
+1
-1
ui.node.yaml
yamls/ui.node.yaml
+5
-5
No files found.
app/service.js
View file @
a836920d
...
...
@@ -4,7 +4,15 @@ const logger = require('koa-log4').getLogger()
const
{
ingressCreate
,
ingressDelete
}
=
require
(
'
../kubeService/ingress
'
)
const
{
projectConfig
,
defaultConfig
}
=
require
(
'
../serviceTemplate/resourceLimit
'
)
const
{
getPods
,
serviceCreate
,
getServices
,
getServiceDetail
,
serviceRestart
,
serviceDelete
,
imageUpdate
,
getPods
,
serviceCreate
,
getServices
,
getServiceDetail
,
serviceRestart
,
serviceDelete
,
imageUpdate
,
getReplicaSet
,
replicaSetDelete
,
}
=
require
(
'
../kubeService/service
'
)
const
router
=
new
Router
()
...
...
@@ -57,8 +65,16 @@ router.post('/details', async (ctx) => {
})
router
.
post
(
'
/delete
'
,
async
(
ctx
)
=>
{
const
rsName
=
ctx
.
request
.
body
.
podName
.
slice
(
0
,
-
6
)
await
serviceDelete
(
ctx
.
request
.
body
.
namespace
,
ctx
.
request
.
body
.
serviceName
,
rsName
)
const
{
namespace
,
serviceName
}
=
ctx
.
request
.
body
await
serviceDelete
(
namespace
,
serviceName
)
// const rsName = ctx.request.body.podName.slice(0, -6)
let
rsData
=
await
getReplicaSet
(
namespace
)
rsData
=
rsData
.
map
(
item
=>
item
.
metadata
.
name
).
filter
(
item
=>
item
.
indexOf
(
serviceName
)
!==
-
1
)
for
(
const
rs
of
rsData
)
{
await
replicaSetDelete
(
namespace
,
rs
)
}
if
(
ctx
.
request
.
body
.
serviceName
===
'
xyqb-user2
'
)
{
await
ingressDelete
(
ctx
.
request
.
body
.
namespace
,
'
xyqb-user2-2
'
)
}
...
...
kubeService/service.js
View file @
a836920d
...
...
@@ -221,10 +221,18 @@ const serviceRestart = async (namespace, name) => {
await
client
.
api
.
v1
.
namespaces
(
namespace
).
pods
(
name
).
delete
()
}
const
serviceDelete
=
async
(
namespace
,
name
,
rsName
)
=>
{
const
serviceDelete
=
async
(
namespace
,
name
)
=>
{
await
client
.
api
.
v1
.
namespaces
(
namespace
).
services
(
name
).
delete
()
await
client
.
apis
.
apps
.
v1beta1
.
namespaces
(
namespace
).
deployments
(
name
).
delete
()
}
const
getReplicaSet
=
async
(
namespace
)
=>
{
const
rsData
=
await
client
.
apis
.
apps
.
v1beta2
.
namespaces
(
namespace
).
replicasets
.
get
()
return
rsData
.
body
.
items
}
const
replicaSetDelete
=
async
(
namespace
,
rsName
)
=>
{
await
client
.
apis
.
apps
.
v1
.
namespaces
(
namespace
).
replicasets
(
rsName
).
delete
()
await
client
.
api
.
v1
.
namespaces
(
namespace
).
services
(
name
).
delete
()
}
module
.
exports
=
{
...
...
@@ -237,4 +245,6 @@ module.exports = {
serviceRestart
,
serviceDelete
,
imageUpdate
,
getReplicaSet
,
replicaSetDelete
,
}
yamls/java.yaml
View file @
a836920d
...
...
@@ -8,6 +8,7 @@ metadata:
qcloud-app
:
{{
serviceName
}}
spec
:
replicas
:
1
revisionHistoryLimit
:
1
selector
:
matchLabels
:
qcloud-app
:
{{
serviceName
}}
...
...
@@ -20,7 +21,6 @@ spec:
type
:
{{
label
}}
spec
:
terminationGracePeriodSeconds
:
0
revisionHistoryLimit
:
1
containers
:
-
name
:
{{
serviceName
}}
image
:
ccr.ccs.tencentyun.com/{{image}}
...
...
yamls/ui.node.yaml
View file @
a836920d
...
...
@@ -7,10 +7,11 @@ metadata:
type
:
{{
label
}}
qcloud-app
:
{{
serviceName
}}
spec
:
replicas
:
1
selector
:
matchLabels
:
qcloud-app
:
{{
serviceName
}}
# replicas: 1
revisionHistoryLimit
:
1
# selector:
# matchLabels:
# qcloud-app: {{serviceName}}
strategy
:
type
:
Recreate
template
:
...
...
@@ -20,7 +21,6 @@ spec:
type
:
{{
label
}}
spec
:
terminationGracePeriodSeconds
:
0
revisionHistoryLimit
:
1
containers
:
-
name
:
{{
serviceName
}}
image
:
ccr.ccs.tencentyun.com/{{image}}
...
...
Write
Preview
Markdown
is supported
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