github.com/wmuizelaar/kpt@v0.0.0-20221018115725-bd564717b2ed/package-examples/wordpress-with-dependencies/mysql/statefulset.yaml (about)

     1  # Copyright 2021 Google LLC
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #      http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  apiVersion: v1
    15  kind: Service
    16  metadata:
    17    name: wordpress-mysql
    18    namespace: default
    19    labels:
    20      app: wordpress
    21      tier: mysql
    22  spec:
    23    selector:
    24      app: wordpress
    25      tier: mysql
    26    ports:
    27      - protocol: TCP
    28        port: 3306
    29    clusterIP: None
    30  ---
    31  apiVersion: apps/v1
    32  kind: StatefulSet
    33  metadata:
    34    name: wordpress-mysql
    35    namespace: default
    36    labels:
    37      app: wordpress
    38      tier: mysql
    39  spec:
    40    serviceName: "wordpress-mysql"
    41    replicas: 1
    42    selector:
    43      matchLabels:
    44        app: wordpress
    45        tier: mysql
    46    template:
    47      metadata:
    48        labels:
    49          app: wordpress
    50          tier: mysql
    51      spec:
    52        containers:
    53          - name: mysql
    54            image: mysql:5.6
    55            ports:
    56            - name: mysql
    57              protocol: TCP
    58              containerPort: 3306
    59            env:
    60            - name: MYSQL_ROOT_PASSWORD
    61              valueFrom:
    62                secretKeyRef:
    63                  name: mysql-pass
    64                  key: password
    65            volumeMounts:
    66            - name: wordpress-persistent-storage
    67              mountPath: /var/lib/mysql
    68    volumeClaimTemplates:
    69    - metadata:
    70        name: wordpress-persistent-storage
    71      spec:
    72        accessModes: [ "ReadWriteOnce" ]
    73        resources:
    74          requests:
    75            storage: 1Gi