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
2be44aa3
Commit
2be44aa3
authored
Jul 25, 2019
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sentinel yaml
parent
7cc4f7a4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
44 deletions
+67
-44
commonService.js
app/commonService.js
+0
-40
index.js
app/index.js
+0
-2
resourceLimit.js
serviceTemplate/resourceLimit.js
+1
-0
index.js
yamls/index.js
+2
-0
redis.sentinel.yaml
yamls/redis.sentinel.yaml
+64
-0
redis.yaml
yamls/redis.yaml
+0
-2
No files found.
app/commonService.js
deleted
100644 → 0
View file @
7cc4f7a4
const
Router
=
require
(
'
koa-router
'
)
const
yaml
=
require
(
'
js-yaml
'
)
const
templates
=
require
(
'
../serviceTemplate
'
)
const
IMAGES
=
{
zookeeper
:
'
zookeeper:3.4.10
'
,
rabbitmq
:
'
rabbitmq:3.6-management
'
,
mysql
:
'
mysql:5.7
'
,
}
const
router
=
new
Router
()
module
.
exports
=
router
router
.
post
(
'
/create
'
,
async
(
ctx
)
=>
{
const
{
serviceName
,
namespace
}
=
ctx
.
request
.
body
if
(
!
Object
.
keys
(
IMAGES
).
includes
(
serviceName
))
{
ctx
.
body
=
ctx
.
fail
(
'
不支持的服务类型
'
)
return
}
const
data
=
{
namespace
,
image
:
IMAGES
[
serviceName
],
}
const
template
=
templates
[
serviceName
].
replace
(
/{{
([
A-Za-z0-9_
]
+
)
}}/g
,
function
()
{
if
(
data
[
arguments
[
1
]]
===
undefined
)
{
throw
new
Error
(
'
缺少模板所需变量
'
)
}
return
data
[
arguments
[
1
]]
})
const
params
=
yaml
.
load
(
template
)
await
ctx
.
client
.
service_create
(
params
)
ctx
.
body
=
ctx
.
ok
(
'
创建成功
'
)
})
router
.
post
(
'
/delete
'
,
async
(
ctx
)
=>
{
const
{
serviceName
,
namespace
}
=
ctx
.
request
.
body
await
ctx
.
client
.
service_delete
(
serviceName
,
namespace
)
ctx
.
body
=
ctx
.
ok
(
'
删除成功
'
)
})
app/index.js
View file @
2be44aa3
...
@@ -12,7 +12,6 @@ const namespaceRoute = require('./namespace')
...
@@ -12,7 +12,6 @@ const namespaceRoute = require('./namespace')
const
serviceRoute
=
require
(
'
./service
'
)
const
serviceRoute
=
require
(
'
./service
'
)
const
repositoryRouter
=
require
(
'
./repository
'
)
const
repositoryRouter
=
require
(
'
./repository
'
)
const
tag
=
require
(
'
./tag
'
)
const
tag
=
require
(
'
./tag
'
)
const
commonServiceRoute
=
require
(
'
./commonService
'
)
const
ingressRoute
=
require
(
'
./ingress
'
)
const
ingressRoute
=
require
(
'
./ingress
'
)
const
deploy
=
require
(
'
./restartLatest
'
)
const
deploy
=
require
(
'
./restartLatest
'
)
...
@@ -40,7 +39,6 @@ function loadRoutes(router) {
...
@@ -40,7 +39,6 @@ function loadRoutes(router) {
.
use
(
'
/namespace
'
,
namespaceRoute
.
routes
())
.
use
(
'
/namespace
'
,
namespaceRoute
.
routes
())
.
use
(
'
/service
'
,
serviceRoute
.
routes
())
.
use
(
'
/service
'
,
serviceRoute
.
routes
())
.
use
(
'
/commonService
'
,
commonServiceRoute
.
routes
())
.
use
(
'
/ingress
'
,
ingressRoute
.
routes
())
.
use
(
'
/ingress
'
,
ingressRoute
.
routes
())
.
use
(
'
/repository
'
,
repositoryRouter
.
routes
())
.
use
(
'
/repository
'
,
repositoryRouter
.
routes
())
.
use
(
'
/tag
'
,
tag
.
routes
())
.
use
(
'
/tag
'
,
tag
.
routes
())
...
...
serviceTemplate/resourceLimit.js
View file @
2be44aa3
...
@@ -138,6 +138,7 @@ exports.defaultConfig = {
...
@@ -138,6 +138,7 @@ exports.defaultConfig = {
ui
:
defaultUI
,
ui
:
defaultUI
,
node
:
defaultNodejs
,
node
:
defaultNodejs
,
redis
:
defaultRedis
,
redis
:
defaultRedis
,
'
redis-sentinel
'
:
defaultRedis
,
zookeeper
:
defaultZookeeper
,
zookeeper
:
defaultZookeeper
,
mysql
:
defaultMysql
,
mysql
:
defaultMysql
,
rabbitmq
:
defaultRabbitmq
,
rabbitmq
:
defaultRabbitmq
,
...
...
yamls/index.js
View file @
2be44aa3
...
@@ -2,6 +2,7 @@ const fs = require('fs')
...
@@ -2,6 +2,7 @@ const fs = require('fs')
const
mysql
=
fs
.
readFileSync
(
'
yamls/mysql.pvc.yaml
'
,
'
utf8
'
)
const
mysql
=
fs
.
readFileSync
(
'
yamls/mysql.pvc.yaml
'
,
'
utf8
'
)
const
redis
=
fs
.
readFileSync
(
'
yamls/redis.yaml
'
,
'
utf8
'
)
const
redis
=
fs
.
readFileSync
(
'
yamls/redis.yaml
'
,
'
utf8
'
)
const
redis_sentinel
=
fs
.
readFileSync
(
'
yamls/redis.sentinel.yaml
'
,
'
utf8
'
)
const
rabbitmq
=
fs
.
readFileSync
(
'
yamls/rabbitmq.pvc.yaml
'
,
'
utf8
'
)
const
rabbitmq
=
fs
.
readFileSync
(
'
yamls/rabbitmq.pvc.yaml
'
,
'
utf8
'
)
const
mongodb
=
fs
.
readFileSync
(
'
yamls/mongo.pvc.yaml
'
,
'
utf8
'
)
const
mongodb
=
fs
.
readFileSync
(
'
yamls/mongo.pvc.yaml
'
,
'
utf8
'
)
const
zookeeper
=
fs
.
readFileSync
(
'
yamls/zookeeper.pvc.yaml
'
,
'
utf8
'
)
const
zookeeper
=
fs
.
readFileSync
(
'
yamls/zookeeper.pvc.yaml
'
,
'
utf8
'
)
...
@@ -13,6 +14,7 @@ const python = fs.readFileSync('yamls/python.yaml', 'utf8')
...
@@ -13,6 +14,7 @@ const python = fs.readFileSync('yamls/python.yaml', 'utf8')
module
.
exports
=
{
module
.
exports
=
{
mysql
,
mysql
,
redis
,
redis
,
'
redis-sentinel
'
:
redis_sentinel
,
rabbitmq
,
rabbitmq
,
mongodb
,
mongodb
,
zookeeper
,
zookeeper
,
...
...
yamls/redis.sentinel.yaml
0 → 100644
View file @
2be44aa3
apiVersion
:
apps/v1beta1
kind
:
Deployment
metadata
:
labels
:
type
:
base
qcloud-app
:
{{
serviceName
}}
name
:
{{
serviceName
}}
namespace
:
{{
namespace
}}
spec
:
replicas
:
1
revisionHistoryLimit
:
1
selector
:
matchLabels
:
qcloud-app
:
{{
serviceName
}}
strategy
:
type
:
Recreate
template
:
metadata
:
labels
:
type
:
base
qcloud-app
:
{{
serviceName
}}
spec
:
nodeSelector
:
zone
:
"
3"
containers
:
-
image
:
ccr.ccs.tencentyun.com/{{image}}
imagePullPolicy
:
Always
name
:
{{
serviceName
}}
resources
:
requests
:
cpu
:
{{
resources.cpu.request
}}
m
memory
:
{{
resources.memory.request
}}
Mi
limits
:
cpu
:
{{
resources.cpu.limit
}}
m
memory
:
{{
resources.memory.limit
}}
Mi
imagePullSecrets
:
-
name
:
qcloudregistrykey
-
name
:
tencenthubkey
restartPolicy
:
Always
terminationGracePeriodSeconds
:
30
status
:
{}
---
apiVersion
:
v1
kind
:
Service
metadata
:
labels
:
type
:
base
qcloud-app
:
{{
serviceName
}}
name
:
{{
serviceName
}}
namespace
:
{{
namespace
}}
spec
:
type
:
NodePort
ports
:
-
name
:
'
6379'
port
:
6379
-
name
:
'
6380'
port
:
6380
-
name
:
'
6381'
port
:
6381
-
name
:
'
26379'
port
:
26379
selector
:
qcloud-app
:
{{
serviceName
}}
yamls/redis.yaml
View file @
2be44aa3
...
@@ -62,7 +62,5 @@ spec:
...
@@ -62,7 +62,5 @@ spec:
port
:
6382
port
:
6382
-
name
:
'
6383'
-
name
:
'
6383'
port
:
6383
port
:
6383
-
name
:
'
26379'
port
:
26379
selector
:
selector
:
qcloud-app
:
{{
serviceName
}}
qcloud-app
:
{{
serviceName
}}
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