LoginSignup
1
0

More than 3 years have passed since last update.

openshift4.3でtemplateの内容を確認する(CodeReady Containers 1.7.0)

Posted at

はじめに

前回のCodeReady Containersのアップデートで消し飛んだPHP+MariaDB
やっぱりYAMLで管理しGitに保存しとこうと思い標準のテンプレートを参考に組み上げようと思います。

ocコマンドを利用する

ocコマンドを利用しますが、まずはPATHを通す必要があります。

[tak@minishift4 ~]$ crc oc-env
export PATH="/home/tak/.crc/bin:$PATH"
# Run this command to configure your shell:
# eval $(crc oc-env)

[tak@minishift4 ~]$ eval $(crc oc-env)

CodeReady Containersにログインする(oc login)

次にoc loginしてプロジェクトを参照できるようにします。
crc startで表示されるkubeadminのパスフレーズを入力しoc loginします。

[tak@minishift4 ~]$ oc login -u kubeadmin -p db9Dr-J2csc-8oP78-9sbmf https://api.crc.testing:6443
The server uses a certificate signed by an unknown authority.
You can bypass the certificate check, but any data you send to the server could be intercepted by others.
Use insecure connections? (y/n): y

Login successful.

You have access to 54 projects, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".
Welcome! See 'oc help' to get started.

templateを確認する(oc get templates)

openshiftプロジェクトに存在するtemplate(=カタログのテンプレート)を確認します。

[tak@minishift4 ~]$  oc get -n openshift templates
NAME                                            DESCRIPTION                                                                        PARAMETERS        OBJECTS
3scale-gateway                                  3scale's APIcast is an NGINX based API gateway used to integrate your interna...   17 (8 blank)      3
amq63-basic                                     Application template for JBoss A-MQ brokers. These can be deployed as standal...   11 (4 blank)      6
amq63-persistent                                An example JBoss A-MQ application. For more information about using this temp...   13 (4 blank)      8
amq63-persistent-ssl                            An example JBoss A-MQ application. For more information about using this temp...   18 (6 blank)      12
amq63-ssl                                       An example JBoss A-MQ application. For more information about using this temp...   16 (6 blank)      10
apicurito                                       Design beautiful, functional APIs with zero coding, using a visual designer f...   7 (1 blank)       7
cache-service                                   Red Hat Data Grid is an in-memory, distributed key/value store.                    8 (1 blank)       4
cakephp-mysql-example                           An example CakePHP application with a MySQL database. For more information ab...   19 (4 blank)      8
cakephp-mysql-persistent                        An example CakePHP application with a MySQL database. For more information ab...   20 (4 blank)      9
dancer-mysql-example                            An example Dancer application with a MySQL database. For more information abo...   16 (5 blank)      8
dancer-mysql-persistent                         An example Dancer application with a MySQL database. For more information abo...   17 (5 blank)      9
datagrid-service                                Red Hat Data Grid is an in-memory, distributed key/value store.                    7 (1 blank)       4
datavirt64-basic-s2i                            Application template for JBoss Data Virtualization 6.4 services built using S2I.   20 (6 blank)      6
datavirt64-extensions-support-s2i               An example JBoss Data Virtualization application. For more information about...    35 (9 blank)      10
datavirt64-ldap-s2i                             Application template for JBoss Data Virtualization 6.4 services that configur...   21 (6 blank)      6
datavirt64-secure-s2i                           An example JBoss Data Virtualization application. For more information about...    51 (22 blank)     8
decisionserver64-amq-s2i                        An example BRMS decision server A-MQ application. For more information about...    30 (5 blank)      10
decisionserver64-basic-s2i                      Application template for Red Hat JBoss BRMS 6.4 decision server applications...    17 (5 blank)      5
django-psql-example                             An example Django application with a PostgreSQL database. For more informatio...   19 (5 blank)      8
django-psql-persistent                          An example Django application with a PostgreSQL database. For more informatio...   20 (5 blank)      9
dotnet-example                                  An example .NET Core application.                                                  19 (9 blank)      5
dotnet-pgsql-persistent                         An example .NET Core application with a PostgreSQL database. For more informa...   24 (7 blank)      9
eap-cd-basic-s2i                                An example JBoss Enterprise Application Platform continuous delivery applicat...   16 (4 blank)      6
eap-cd-starter-s2i                              An example JBoss Enterprise Application Platform continuous delivery applicat...   12 (2 blank)      5
eap72-basic-s2i                                 An example Red Hat JBoss EAP 7 application. For more information about using...    16 (4 blank)      6
eap72-https-s2i                                 An example Red Hat JBoss EAP 7 application configured with secure communicati...   26 (10 blank)     8
eap72-mongodb-persistent-s2i                    An example Red Hat JBoss EAP 7 application with a MongoDB database. For more...    39 (18 blank)     11
eap72-mongodb-s2i                               An example Red Hat JBoss EAP 7 application with a MongoDB database. For more...    38 (18 blank)     10
eap72-mysql-persistent-s2i                      An example Red Hat JBoss EAP 7.2 application with a persistent MySQL database...   40 (19 blank)     11
eap72-mysql-s2i                                 An example Red Hat JBoss EAP 7 application with a MySQL database. For more in...   39 (19 blank)     10
eap72-postgresql-persistent-s2i                 An example Red Hat JBoss EAP 7 application with a persistent PostgreSQL datab...   37 (16 blank)     11
eap72-postgresql-s2i                            An example Red Hat JBoss EAP 7 application with an PostgreSQL database config...   36 (16 blank)     10
eap72-sso-s2i                                   An example Red Hat JBoss EAP 7 application Single Sign-On application. For mo...   44 (19 blank)     8
eap72-third-party-db-s2i                        An example Red Hat JBoss EAP 7 application. For more information about using...    30 (7 blank)      8
fuse74-console                                  The Red Hat Fuse Console eases the discovery and management of Fuse applicati...   8 (1 blank)       5
httpd-example                                   An example Apache HTTP Server (httpd) application that serves static content....   9 (3 blank)       5
jenkins-ephemeral                               Jenkins service, without persistent storage....                                    8 (all set)       6
jenkins-ephemeral-monitored                     Jenkins service, without persistent storage....                                    9 (all set)       7
jenkins-persistent                              Jenkins service, with persistent storage....                                       10 (all set)      7
jenkins-persistent-monitored                    Jenkins service, with persistent storage....                                       11 (all set)      8
jws31-tomcat7-basic-s2i                         Application template for JWS applications built using S2I.                         12 (3 blank)      5
jws31-tomcat7-https-s2i                         An example JBoss Web Server application configured for use with https. For mo...   17 (5 blank)      7
jws31-tomcat7-mongodb-persistent-s2i            An example JBoss Web Server application with a MongoDB database. For more inf...   30 (12 blank)     10
jws31-tomcat7-mongodb-s2i                       Application template for JWS MongoDB applications built using S2I.                 29 (12 blank)     9
jws31-tomcat7-mysql-persistent-s2i              An example JBoss Web Server application with a MySQL database. For more infor...   31 (13 blank)     10
jws31-tomcat7-mysql-s2i                         Application template for JWS MySQL applications built using S2I.                   30 (13 blank)     9
jws31-tomcat7-postgresql-persistent-s2i         An example JBoss Web Server application with a PostgreSQL database. For more...    28 (10 blank)     10
jws31-tomcat7-postgresql-s2i                    Application template for JWS PostgreSQL applications built using S2I.              27 (10 blank)     9
jws31-tomcat8-basic-s2i                         An example JBoss Web Server application. For more information about using thi...   12 (3 blank)      5
jws31-tomcat8-https-s2i                         An example JBoss Web Server application. For more information about using thi...   17 (5 blank)      7
jws31-tomcat8-mongodb-persistent-s2i            An example JBoss Web Server application with a MongoDB database. For more inf...   30 (12 blank)     10
jws31-tomcat8-mongodb-s2i                       Application template for JWS MongoDB applications built using S2I.                 29 (12 blank)     9
jws31-tomcat8-mysql-persistent-s2i              An example JBoss Web Server application with a MySQL database. For more infor...   31 (13 blank)     10
jws31-tomcat8-mysql-s2i                         Application template for JWS MySQL applications built using S2I.                   30 (13 blank)     9
jws31-tomcat8-postgresql-persistent-s2i         Application template for JWS PostgreSQL applications with persistent storage...    28 (10 blank)     10
jws50-tomcat9-basic-s2i                         An example JBoss Web Server application. For more information about using thi...   12 (3 blank)      5
jws50-tomcat9-https-s2i                         An example JBoss Web Server application. For more information about using thi...   17 (5 blank)      7
jws50-tomcat9-mongodb-persistent-s2i            An example JBoss Web Server application with a MongoDB database. For more inf...   30 (12 blank)     10
jws50-tomcat9-mongodb-s2i                       Application template for JWS MongoDB applications built using S2I.                 29 (12 blank)     9
jws50-tomcat9-mysql-persistent-s2i              An example JBoss Web Server application with a MySQL database. For more infor...   31 (13 blank)     10
jws50-tomcat9-mysql-s2i                         Application template for JWS MySQL applications built using S2I.                   30 (13 blank)     9
jws50-tomcat9-postgresql-persistent-s2i         Application template for JWS PostgreSQL applications with persistent storage...    28 (10 blank)     10
mariadb-ephemeral                               MariaDB database service, without persistent storage. For more information ab...   8 (3 generated)   3
mariadb-persistent                              MariaDB database service, with persistent storage. For more information about...   9 (3 generated)   4
mongodb-ephemeral                               MongoDB database service, without persistent storage. For more information ab...   8 (3 generated)   3
mongodb-persistent                              MongoDB database service, with persistent storage. For more information about...   9 (3 generated)   4
mysql-ephemeral                                 MySQL database service, without persistent storage. For more information abou...   8 (3 generated)   3
mysql-persistent                                MySQL database service, with persistent storage. For more information about u...   9 (3 generated)   4
nginx-example                                   An example Nginx HTTP server and a reverse proxy (nginx) application that ser...   10 (3 blank)      5
nodejs-mongo-persistent                         An example Node.js application with a MongoDB database. For more information...    19 (4 blank)      9
nodejs-mongodb-example                          An example Node.js application with a MongoDB database. For more information...    18 (4 blank)      8
openjdk-web-basic-s2i                           An example Java application using OpenJDK. For more information about using t...   9 (1 blank)       5
postgresql-ephemeral                            PostgreSQL database service, without persistent storage. For more information...   7 (2 generated)   3
postgresql-persistent                           PostgreSQL database service, with persistent storage. For more information ab...   8 (2 generated)   4
processserver64-amq-mysql-persistent-s2i        An example BPM Suite application with A-MQ and a MySQL database. For more inf...   49 (13 blank)     14
processserver64-amq-mysql-s2i                   An example BPM Suite application with A-MQ and a MySQL database. For more inf...   47 (13 blank)     12
processserver64-amq-postgresql-persistent-s2i   An example BPM Suite application with A-MQ and a PostgreSQL database. For mor...   46 (10 blank)     14
processserver64-amq-postgresql-s2i              An example BPM Suite application with A-MQ and a PostgreSQL database. For mor...   44 (10 blank)     12
processserver64-basic-s2i                       An example BPM Suite application. For more information about using this templ...   17 (5 blank)      5
processserver64-externaldb-s2i                  An example BPM Suite application with a external database. For more informati...   47 (22 blank)     7
processserver64-mysql-persistent-s2i            An example BPM Suite application with a MySQL database. For more information...    40 (14 blank)     10
processserver64-mysql-s2i                       An example BPM Suite application with a MySQL database. For more information...    39 (14 blank)     9
processserver64-postgresql-persistent-s2i       An example BPM Suite application with a PostgreSQL database. For more informa...   37 (11 blank)     10
rails-pgsql-persistent                          An example Rails application with a PostgreSQL database. For more information...   21 (4 blank)      9
rails-postgresql-example                        An example Rails application with a PostgreSQL database. For more information...   20 (4 blank)      8
react-web-app-example                           Build a basic React Web Application                                                9 (1 generated)   5
redis-ephemeral                                 Redis in-memory data structure store, without persistent storage. For more in...   5 (1 generated)   3
redis-persistent                                Redis in-memory data structure store, with persistent storage. For more infor...   6 (1 generated)   4
rhdm74-authoring                                Application template for a non-HA persistent authoring environment, for Red H...   76 (44 blank)     11
rhdm74-authoring-ha                             Application template for a HA persistent authoring environment, for Red Hat D...   90 (45 blank)     25
rhdm74-kieserver                                Application template for a managed KIE Server, for Red Hat Decision Manager 7.4    62 (42 blank)     7
rhdm74-optaweb-employee-rostering               Application template for a Optaweb Employee Rostering with a PostgreSQL datab...   23 (5 blank)      10
rhdm74-prod-immutable-kieserver                 Application template for an immutable KIE server in a production environment,...   67 (45 blank)     9
rhdm74-prod-immutable-kieserver-amq             Application template for an immutable KIE server in a production environment...    81 (54 blank)     22
rhdm74-trial-ephemeral                          Application template for an ephemeral authoring and testing environment, for...    65 (39 blank)     8
rhpam74-authoring                               Application template for a non-HA persistent authoring environment, for Red H...   80 (44 blank)     12
rhpam74-authoring-ha                            Application template for a HA persistent authoring environment, for Red Hat P...   99 (45 blank)     28
rhpam74-kieserver-externaldb                    Application template for a managed KIE Server with an external database, for...    84 (59 blank)     9
rhpam74-kieserver-mysql                         Application template for a managed KIE Server with a MySQL database, for Red...    71 (42 blank)     10
rhpam74-kieserver-postgresql                    Application template for a managed KIE Server with a PostgreSQL database, for...   72 (42 blank)     10
rhpam74-managed                                 Application template for a managed HA production runtime environment, for Red...   87 (46 blank)     16
rhpam74-prod                                    Application template for a managed HA production runtime environment, for Red...   102 (55 blank)    31
rhpam74-prod-immutable-kieserver                Application template for an immutable KIE server in a production environment,...   77 (45 blank)     12
rhpam74-prod-immutable-kieserver-amq            Application template for an immultable KIE server in a production environment...   98 (58 blank)     25
rhpam74-prod-immutable-monitor                  Application template for a router and monitoring console in a production envi...   69 (44 blank)     15
rhpam74-trial-ephemeral                         Application template for an ephemeral authoring and testing environment, for...    65 (39 blank)     8
s2i-fuse74-spring-boot-camel                    Spring Boot and Camel QuickStart. This example demonstrates how you can use A...   16 (2 blank)      3
s2i-fuse74-spring-boot-camel-rest-3scale        Spring Boot, Camel REST DSL and 3Scale QuickStart. This example demonstrates...    17 (2 blank)      5
s2i-fuse74-spring-boot-camel-xml                Spring Boot and Camel Xml QuickStart. This example demonstrates how you can u...   16 (2 blank)      3
sso72-https                                     An example RH-SSO 7 application. For more information about using this templa...   26 (15 blank)     6
sso72-mysql                                     An example RH-SSO 7 application with a MySQL database. For more information a...   36 (20 blank)     8
sso72-mysql-persistent                          An example RH-SSO 7 application with a MySQL database. For more information a...   37 (20 blank)     9
sso72-postgresql                                An example RH-SSO 7 application with a PostgreSQL database. For more informat...   33 (17 blank)     8
sso72-postgresql-persistent                     An example RH-SSO 7 application with a PostgreSQL database. For more informat...   34 (17 blank)     9
sso72-x509-https                                An example RH-SSO 7 application. For more information about using this templa...   12 (6 blank)      4
sso73-https                                     An example application based on RH-SSO 7.3 image. For more information about...    27 (16 blank)     6
sso73-mysql                                     An example application based on RH-SSO 7.3 image. For more information about...    37 (21 blank)     8
sso73-mysql-persistent                          An example application based on RH-SSO 7.3 image. For more information about...    38 (21 blank)     9
sso73-postgresql                                An example application based on RH-SSO 7.3 image. For more information about...    34 (18 blank)     8
sso73-postgresql-persistent                     An example application based on RH-SSO 7.3 image. For more information about...    35 (18 blank)     9
sso73-x509-https                                An example application based on RH-SSO 7.3 image. For more information about...    13 (7 blank)      4
sso73-x509-mysql-persistent                     An example application based on RH-SSO 7.3 image. For more information about...    24 (12 blank)     7
sso73-x509-postgresql-persistent                An example application based on RH-SSO 7.3 image. For more information about...    21 (9 blank)      7

あれ、欲しい「PHP」だけのテンプレートが無いですね…"(-""-)"

[tak@minishift4 ~]$ oc get -n openshift templates | grep PHP
cakephp-mysql-example                           An example CakePHP application with a MySQL database. For more information ab...   19 (4 blank)      8
cakephp-mysql-persistent                        An example CakePHP application with a MySQL database. For more information ab...   20 (4 blank)      9

とりあえずcakephp-mysql-persistenmariadb-presistentだけでも抽出しておきましょうか。

templateをyamlで出力する(oc process -o yaml [template])

[tak@minishift4 ~]$ oc process -o yaml openshift//cakephp-mysql-persistent > ~/cakephp-mysql-persistent.yaml
[tak@minishift4 ~]$ oc process -o yaml openshift//mariadb-persistent > ~/mariadb-persistent.yaml
[tak@minishift4 ~]$ ls -l *.yaml
-rw-rw-r--. 1 tak tak 7610  3月 15 05:10 cakephp-mysql-persistent.yaml
-rw-rw-r--. 1 tak tak 3386  3月 15 05:05 mariadb-persistent.yaml

cakephp-mysql-persistenのtemplate

出力したcakephp-mysql-persistenのtemplateを確認します。

cakephp-mysql-persisten.yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: Secret
  metadata:
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: cakephp-mysql-persistent
  stringData:
    cakephp-secret-token: w46zjXoUft2hrh5d6lURr1h3iM7z0jb6ZtJyXkTo7xDauNwiou
    cakephp-security-salt: BUG4j51gxb34ncbCnOc4jy7ah4LmJyGlxm3LLUj6
    database-password: aFBmmJJCRNlTECUu
    database-user: cakephp
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      description: Exposes and load balances the application pods
      service.alpha.openshift.io/dependencies: '[{"name": "mysql", "kind": "Service"}]'
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: cakephp-mysql-persistent
  spec:
    ports:
    - name: web
      port: 8080
      targetPort: 8080
    selector:
      name: cakephp-mysql-persistent
- apiVersion: route.openshift.io/v1
  kind: Route
  metadata:
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: cakephp-mysql-persistent
  spec:
    host: ""
    to:
      kind: Service
      name: cakephp-mysql-persistent
- apiVersion: image.openshift.io/v1
  kind: ImageStream
  metadata:
    annotations:
      description: Keeps track of changes in the application image
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: cakephp-mysql-persistent
- apiVersion: build.openshift.io/v1
  kind: BuildConfig
  metadata:
    annotations:
      description: Defines how to build the application
      template.alpha.openshift.io/wait-for-ready: "true"
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: cakephp-mysql-persistent
  spec:
    output:
      to:
        kind: ImageStreamTag
        name: cakephp-mysql-persistent:latest
    postCommit:
      script: ./vendor/bin/phpunit
    source:
      contextDir: ""
      git:
        ref: ""
        uri: https://github.com/sclorg/cakephp-ex.git
      type: Git
    strategy:
      sourceStrategy:
        env:
        - name: COMPOSER_MIRROR
          value: ""
        from:
          kind: ImageStreamTag
          name: php:7.1
          namespace: openshift
      type: Source
    triggers:
    - type: ImageChange
    - type: ConfigChange
    - github:
        secret: 8OkTtAsuKiYfh6RuYroha5aq4fVsRiR3K5NQXCje
      type: GitHub
- apiVersion: apps.openshift.io/v1
  kind: DeploymentConfig
  metadata:
    annotations:
      description: Defines how to deploy the application server
      template.alpha.openshift.io/wait-for-ready: "true"
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: cakephp-mysql-persistent
  spec:
    replicas: 1
    selector:
      name: cakephp-mysql-persistent
    strategy:
      recreateParams:
        pre:
          execNewPod:
            command:
            - ./migrate-database.sh
            containerName: cakephp-mysql-persistent
          failurePolicy: Retry
      type: Recreate
    template:
      metadata:
        labels:
          name: cakephp-mysql-persistent
        name: cakephp-mysql-persistent
      spec:
        containers:
        - env:
          - name: DATABASE_SERVICE_NAME
            value: mysql
          - name: DATABASE_ENGINE
            value: mysql
          - name: DATABASE_NAME
            value: default
          - name: DATABASE_USER
            valueFrom:
              secretKeyRef:
                key: database-user
                name: cakephp-mysql-persistent
          - name: DATABASE_PASSWORD
            valueFrom:
              secretKeyRef:
                key: database-password
                name: cakephp-mysql-persistent
          - name: CAKEPHP_SECRET_TOKEN
            valueFrom:
              secretKeyRef:
                key: cakephp-secret-token
                name: cakephp-mysql-persistent
          - name: CAKEPHP_SECURITY_SALT
            valueFrom:
              secretKeyRef:
                key: cakephp-security-salt
                name: cakephp-mysql-persistent
          - name: OPCACHE_REVALIDATE_FREQ
            value: "2"
          image: ' '
          livenessProbe:
            httpGet:
              path: /health.php
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 60
            timeoutSeconds: 3
          name: cakephp-mysql-persistent
          ports:
          - containerPort: 8080
          readinessProbe:
            httpGet:
              path: /health.php
              port: 8080
            initialDelaySeconds: 3
            periodSeconds: 60
            timeoutSeconds: 3
          resources:
            limits:
              memory: 512Mi
    triggers:
    - imageChangeParams:
        automatic: true
        containerNames:
        - cakephp-mysql-persistent
        from:
          kind: ImageStreamTag
          name: cakephp-mysql-persistent:latest
      type: ImageChange
    - type: ConfigChange
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: mysql
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      description: Exposes the database server
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: mysql
  spec:
    ports:
    - name: mysql
      port: 3306
      targetPort: 3306
    selector:
      name: mysql
- apiVersion: apps.openshift.io/v1
  kind: DeploymentConfig
  metadata:
    annotations:
      description: Defines how to deploy the database
      template.alpha.openshift.io/wait-for-ready: "true"
    labels:
      app: cakephp-mysql-persistent
      template: cakephp-mysql-persistent
    name: mysql
  spec:
    replicas: 1
    selector:
      name: mysql
    strategy:
      type: Recreate
    template:
      metadata:
        labels:
          name: mysql
        name: mysql
      spec:
        containers:
        - env:
          - name: MYSQL_USER
            valueFrom:
              secretKeyRef:
                key: database-user
                name: cakephp-mysql-persistent
          - name: MYSQL_PASSWORD
            valueFrom:
              secretKeyRef:
                key: database-password
                name: cakephp-mysql-persistent
          - name: MYSQL_DATABASE
            value: default
          image: ' '
          livenessProbe:
            initialDelaySeconds: 30
            tcpSocket:
              port: 3306
            timeoutSeconds: 1
          name: mysql
          ports:
          - containerPort: 3306
          readinessProbe:
            exec:
              command:
              - /bin/sh
              - -i
              - -c
              - MYSQL_PWD='aFBmmJJCRNlTECUu' mysql -h 127.0.0.1 -u cakephp -D default
                -e 'SELECT 1'
            initialDelaySeconds: 5
            timeoutSeconds: 1
          resources:
            limits:
              memory: 512Mi
          volumeMounts:
          - mountPath: /var/lib/mysql/data
            name: mysql-data
        volumes:
        - name: mysql-data
          persistentVolumeClaim:
            claimName: mysql
    triggers:
    - imageChangeParams:
        automatic: true
        containerNames:
        - mysql
        from:
          kind: ImageStreamTag
          name: mysql:5.7
          namespace: openshift
      type: ImageChange
    - type: ConfigChange
kind: List
metadata: {}

mariadb-persistentのtemplate

出力したmariadb-persistent.yamlのtemplateを確認します。

mariadb-persistent.yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: Secret
  metadata:
    annotations:
      template.openshift.io/expose-database_name: '{.data[''database-name'']}'
      template.openshift.io/expose-password: '{.data[''database-password'']}'
      template.openshift.io/expose-root_password: '{.data[''database-root-password'']}'
      template.openshift.io/expose-username: '{.data[''database-user'']}'
    labels:
      template: mariadb-persistent-template
    name: mariadb
  stringData:
    database-name: sampledb
    database-password: IkTRq7TTKL40SfSI
    database-root-password: qy6pmJxENQuyCnCM
    database-user: userSKT
- apiVersion: v1
  kind: Service
  metadata:
    annotations:
      template.openshift.io/expose-uri: mysql://{.spec.clusterIP}:{.spec.ports[?(.name=="mariadb")].port}
    labels:
      template: mariadb-persistent-template
    name: mariadb
  spec:
    ports:
    - name: mariadb
      port: 3306
    selector:
      name: mariadb
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    labels:
      template: mariadb-persistent-template
    name: mariadb
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 1Gi
- apiVersion: apps.openshift.io/v1
  kind: DeploymentConfig
  metadata:
    annotations:
      template.alpha.openshift.io/wait-for-ready: "true"
    labels:
      template: mariadb-persistent-template
    name: mariadb
  spec:
    replicas: 1
    selector:
      name: mariadb
    strategy:
      type: Recreate
    template:
      metadata:
        labels:
          name: mariadb
      spec:
        containers:
        - env:
          - name: MYSQL_USER
            valueFrom:
              secretKeyRef:
                key: database-user
                name: mariadb
          - name: MYSQL_PASSWORD
            valueFrom:
              secretKeyRef:
                key: database-password
                name: mariadb
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                key: database-root-password
                name: mariadb
          - name: MYSQL_DATABASE
            valueFrom:
              secretKeyRef:
                key: database-name
                name: mariadb
          image: ' '
          imagePullPolicy: IfNotPresent
          livenessProbe:
            initialDelaySeconds: 30
            tcpSocket:
              port: 3306
            timeoutSeconds: 1
          name: mariadb
          ports:
          - containerPort: 3306
          readinessProbe:
            exec:
              command:
              - /bin/sh
              - -i
              - -c
              - MYSQL_PWD="$MYSQL_PASSWORD" mysql -h 127.0.0.1 -u $MYSQL_USER -D $MYSQL_DATABASE
                -e 'SELECT 1'
            initialDelaySeconds: 5
            timeoutSeconds: 1
          resources:
            limits:
              memory: 512Mi
          volumeMounts:
          - mountPath: /var/lib/mysql/data
            name: mariadb-data
        volumes:
        - name: mariadb-data
          persistentVolumeClaim:
            claimName: mariadb
    triggers:
    - imageChangeParams:
        automatic: true
        containerNames:
        - mariadb
        from:
          kind: ImageStreamTag
          name: mariadb:10.2
          namespace: openshift
      type: ImageChange
    - type: ConfigChange
kind: List
metadata: {}

欲しいphp-mariadb-persistentを作成します

基本的にcakephp-mysql-persistenのテンプレートのmysql部をmariadbにすればよいのかな?
と思っているのですが、難解そうです(笑)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0