Advertisement
Guest User

Untitled

a guest
Feb 1st, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 7.32 KB | None | 0 0
  1. {
  2.   "kind": "Template",
  3.   "apiVersion": "v1",
  4.   "metadata": {
  5.     "name": "mariadb-easy",
  6.     "annotations": {
  7.       "openshift.io/display-name": "MariaDB (EasyRedmine)",
  8.       "description": "MariaDB database service, with persistent storage configured for easyredmine. NOTE: Scaling to more than one replica is not supported. You must have persistent volumes available in your cluster to use this template.",
  9.       "iconClass": "icon-mariadb",
  10.       "tags": "database,mariadb"
  11.     }
  12.   },
  13.   "message": "The following service(s) have been created in your project: ${DATABASE_SERVICE_NAME}.\n\n       Username: ${MYSQL_USER}\n       Password: ${MYSQL_PASSWORD}\n  Database Name: ${MYSQL_DATABASE}\n Connection URL: mysql://${DATABASE_SERVICE_NAME}:3306/\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/mariadb-container/blob/master/10.1/README.md.",
  14.   "labels": {
  15.     "template": "mariadb-easy-template"
  16.   },
  17.   "objects": [
  18.     {
  19.       "kind": "Secret",
  20.       "apiVersion": "v1",
  21.       "metadata": {
  22.         "name": "${DATABASE_SERVICE_NAME}"
  23.       },
  24.       "stringData" : {
  25.         "database-user" : "${MYSQL_USER}",
  26.         "database-password" : "${MYSQL_PASSWORD}",
  27.         "database-root-password" : "${MYSQL_ROOT_PASSWORD}"
  28.       }
  29.     },
  30.     {
  31.       "kind": "Service",
  32.       "apiVersion": "v1",
  33.       "metadata": {
  34.         "name": "${DATABASE_SERVICE_NAME}"
  35.       },
  36.       "spec": {
  37.         "ports": [
  38.           {
  39.             "name": "mariadb",
  40.             "port": 3306
  41.           }
  42.         ],
  43.         "selector": {
  44.           "name": "${DATABASE_SERVICE_NAME}"
  45.         }
  46.       }
  47.     },
  48.     {
  49.       "kind": "PersistentVolumeClaim",
  50.       "apiVersion": "v1",
  51.       "metadata": {
  52.         "name": "${DATABASE_SERVICE_NAME}"
  53.       },
  54.       "spec": {
  55.         "accessModes": [
  56.           "ReadWriteOnce"
  57.         ],
  58.         "resources": {
  59.           "requests": {
  60.             "storage": "${VOLUME_CAPACITY}"
  61.           }
  62.         }
  63.       }
  64.     },
  65.     {
  66.       "kind": "ReplicationController",
  67.       "apiVersion": "v1",
  68.       "metadata": {
  69.         "name": "${DATABASE_SERVICE_NAME}"
  70.       },
  71.       "spec": {
  72.         "replicas": 1,
  73.         "selector": {
  74.           "name": "${DATABASE_SERVICE_NAME}"
  75.         },
  76.         "template": {
  77.           "metadata": {
  78.             "labels": {
  79.               "name": "${DATABASE_SERVICE_NAME}"
  80.             }
  81.           },
  82.           "spec": {
  83.             "containers": [
  84.               {
  85.                 "name": "mariadb",
  86.                 "image": "mariadb:10.1",
  87.                 "args": [ "--binlog_format=row","--log-warnings=2","--log-error=error.log","--min-examined-row-limit=100","--character_set_server=utf8","--collation_server=utf8_unicode_ci","--query_cache_limit=512K","--query_cache_size=512M","--sort_buffer_size=5M","--tmp_table_size=512M","--max_heap_table_size=512M","--read_buffer_size=1M","--join_buffer_size=1M","--bulk_insert_buffer_size=64M","--innodb_autoinc_lock_mode=2","--innodb_buffer_pool_size=60M","--innodb-flush-log-at-trx-commit=2" ],
  88.                 "ports": [
  89.                   {
  90.                     "containerPort": 3306
  91.                   }
  92.                 ],
  93.                 "readinessProbe": {
  94.                   "timeoutSeconds": 1,
  95.                   "initialDelaySeconds": 5,
  96.                   "exec": {
  97.                     "command": [ "/bin/sh", "-i", "-c",
  98.                       "MYSQL_PWD=\"$MYSQL_PASSWORD\" mysql -h 127.0.0.1 -u $MYSQL_USER -D $MYSQL_DATABASE -e 'SELECT 1'"]
  99.                   }
  100.                 },
  101.                 "livenessProbe": {
  102.                   "timeoutSeconds": 1,
  103.                   "initialDelaySeconds": 30,
  104.                   "tcpSocket": {
  105.                     "port": 3306
  106.                   }
  107.                 },
  108.                 "env": [
  109.                   {
  110.                     "name": "MYSQL_USER",
  111.                     "valueFrom": {
  112.                       "secretKeyRef" : {
  113.                         "name" : "${DATABASE_SERVICE_NAME}",
  114.                         "key" : "database-user"
  115.                       }
  116.                     }
  117.                   },
  118.                   {
  119.                     "name": "MYSQL_PASSWORD",
  120.                     "valueFrom": {
  121.                       "secretKeyRef" : {
  122.                         "name" : "${DATABASE_SERVICE_NAME}",
  123.                         "key" : "database-password"
  124.                       }
  125.                     }
  126.                   },
  127.                   {
  128.                     "name": "MYSQL_ROOT_PASSWORD",
  129.                     "valueFrom": {
  130.                       "secretKeyRef" : {
  131.                         "name" : "${DATABASE_SERVICE_NAME}",
  132.                         "key" : "database-root-password"
  133.                       }
  134.                     }
  135.                   },
  136.                   {
  137.                     "name": "MYSQL_DATABASE",
  138.                     "value": "${MYSQL_DATABASE}"
  139.                   }
  140.                 ],
  141.                 "resources": {
  142.                   "limits": {
  143.                     "memory": "${MEMORY_LIMIT}"
  144.                   }
  145.                 },
  146.                 "volumeMounts": [
  147.                   {
  148.                     "name": "${DATABASE_SERVICE_NAME}-data",
  149.                     "mountPath": "/var/lib/mysql"
  150.                   }
  151.                 ],
  152.                 "imagePullPolicy": "IfNotPresent"
  153.               }
  154.             ],
  155.             "volumes": [
  156.               {
  157.                 "name": "${DATABASE_SERVICE_NAME}-data",
  158.                 "persistentVolumeClaim": {
  159.                   "claimName": "${DATABASE_SERVICE_NAME}"
  160.                 }
  161.               }
  162.             ]
  163.           }
  164.         }
  165.       }
  166.     }
  167.   ],
  168.   "parameters": [
  169.     {
  170.       "name": "MEMORY_LIMIT",
  171.       "displayName": "Memory Limit",
  172.       "description": "Maximum amount of memory the container can use.",
  173.       "value": "1Gi",
  174.       "required": true
  175.     },
  176.     {
  177.       "name": "DATABASE_SERVICE_NAME",
  178.       "displayName": "Database Service Name",
  179.       "description": "The name of the OpenShift Service exposed for the database.",
  180.       "value": "mariadb",
  181.       "required": true
  182.     },
  183.     {
  184.       "name": "MYSQL_USER",
  185.       "displayName": "MariaDB Connection Username",
  186.       "description": "Username for MariaDB user that will be used for accessing the database.",
  187.       "generate": "expression",
  188.       "from": "user[A-Z0-9]{3}",
  189.       "required": true
  190.     },
  191.     {
  192.       "name": "MYSQL_PASSWORD",
  193.       "displayName": "MariaDB Connection Password",
  194.       "description": "Password for the MariaDB connection user.",
  195.       "generate": "expression",
  196.       "from": "[a-zA-Z0-9]{16}",
  197.       "required": true
  198.     },
  199.     {
  200.       "name": "MYSQL_ROOT_PASSWORD",
  201.       "displayName": "MariaDB root Password",
  202.       "description": "Password for the MariaDB root user.",
  203.       "generate": "expression",
  204.       "from": "[a-zA-Z0-9]{16}",
  205.       "required": true
  206.     },
  207.     {
  208.       "name": "MYSQL_DATABASE",
  209.       "displayName": "MariaDB Database Name",
  210.       "description": "Name of the MariaDB database accessed.",
  211.       "value": "sampledb",
  212.       "required": true
  213.     },
  214.     {
  215.       "name": "VOLUME_CAPACITY",
  216.       "displayName": "Volume Capacity",
  217.       "description": "Volume space available for data, e.g. 512Mi, 2Gi.",
  218.       "value": "1Gi",
  219.       "required": true
  220.     }
  221.   ]
  222. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement