init infra project with k8s scripts

This commit is contained in:
paymentrpc
2017-11-05 21:08:51 +08:00
parent fd7bfacf74
commit 403c332398
5 changed files with 183 additions and 0 deletions
@@ -0,0 +1,57 @@
#
# Licensed to the Jigsaw Projects under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The Jigsaw Projects licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 创建sonarqube的resource
apiVersion: v1
kind: ReplicationController
metadata:
name: sonar-mysql
namespace: sonar
labels:
name: mysql
context: ctpaas_staging_site
spec:
replicas: 1
template:
metadata:
labels:
name: mysql
spec:
containers:
- name: mysql
image: docker.io/mysql
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--max_allowed_packet=32M"]
env:
- name: TZ
value: 'Asia/Shanghai'
- name: LANG
value: 'C.UTF-8'
- name: MYSQL_ROOT_PASSWORD
value: 'zaq1XSW@'
- name: MYSQL_DATABASE
value: 'sonar'
ports:
- containerPort: 3306
volumeMounts:
- mountPath: "/var/lib/sonar-mysql"
name: sonar-mysql-data-dir
volumes:
- name: sonar-mysql-data-dir
nfs:
server: kube-master.jigsaw
path: "/nfs_share/mysql/sonar_data"
@@ -0,0 +1,36 @@
#
# Licensed to the Jigsaw Projects under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The Jigsaw Projects licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: v1
kind: Service
metadata:
name: svc-mysql
namespace: sonar
spec:
ports:
- port: 3306 # the port that this service should serve on
# the container on each pod to connect to, can be a name
# (e.g. 'www') or a number (e.g. 80)
targetPort: 3306
protocol: TCP
nodePort: 0
# just like the selector in the replication controller,
# but this time it identifies the set of pods to load balance
# traffic to.
selector:
name: mysql
type:
NodePort
+23
View File
@@ -0,0 +1,23 @@
#
# Licensed to the Jigsaw Projects under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The Jigsaw Projects licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 创建sonarqube的namespace
apiVersion: v1
kind: Namespace
metadata:
name: sonar
+54
View File
@@ -0,0 +1,54 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: sonar-rc
namespace: sonar
labels:
name: sonar
spec:
replicas: 1
selector:
name: sonar
template:
metadata:
labels:
name: sonar
spec:
containers:
- name: sonar
image: docker.io/sonarqube
env:
- name: SONARQUBE_JDBC_USERNAME
value: sonar
- name: SONARQUBE_JDBC_PASSWORD
value: zaq1XSW@
- name: SONARQUBE_JDBC_URL
value: 'jdbc:mysql://10.100.243.163:3306/sonar?useUnicode=true&characterEncoding=utf8'
ports:
- containerPort: 9000
volumeMounts:
- mountPath: "/opt/sonarqube/conf"
name: sonar-conf
- mountPath: "/opt/sonarqube/data"
name: sonar-data
- mountPath: "/opt/sonarqube/extensions"
name: sonar-extensions
- mountPath: "/opt/sonarqube/logs"
name: sonar-logs
volumes:
- name: sonar-conf
nfs:
server: kube-master.jigsaw
path: "/nfs_share/sonar/conf"
- name: sonar-data
nfs:
server: kube-master.jigsaw
path: "/nfs_share/sonar/data"
- name: sonar-extensions
nfs:
server: kube-master.jigsaw
path: "/nfs_share/sonar/extensions"
- name: sonar-logs
nfs:
server: kube-master.jigsaw
path: "/nfs_share/sonar/logs"
+13
View File
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: sonar-svc
namespace: sonar
spec:
type: NodePort
ports:
- port: 9000
protocol: TCP
nodePort: 0
selector:
name: sonar