#
# 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: sonar-mysql
    context: ctpaas_staging_site
spec:
  replicas: 1
  selector:
    app: sonar-mysql
  template:
    metadata:
      labels:
        app: sonar-mysql
    spec:
      containers:
      - name: sonar-mysql
        image: docker.io/mysql:5.7.20
        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'
          - name: MYSQL_USER
            value: 'sonar'
          - name: MYSQL_PASSWORD
            value: 'zaq1XSW@'
        ports:
        - containerPort: 3306
        volumeMounts:
        - mountPath: "/var/lib/sonar-mysql"
          name: sonar-mysql
          readOnly: false
      nodeSelector:
        apptype: infra
      volumes:
        - name: sonar-mysql
          nfs:
            server: kube-master.jigsaw
            path: "/home/nfs/sonar/mysql"
