diff options
author | Sonsino, Ofir (os0695) <os0695@intl.att.com> | 2018-05-30 18:41:14 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-06-04 15:54:52 +0000 |
commit | 2dda01daf2e5c2053221bf4eac81e2585f2b2c7f (patch) | |
tree | 8d98d6b99e4bcdadedd150f51f6d1cb75fb6392b /kubernetes/vid/charts | |
parent | 5768008d908cb4868652746c6a2aa46437c8c1c2 (diff) |
VID Resiliency & Scalability
Change-Id: Ifc593e2e33c3430c74156b4b153263c11127bfa9
Issue-ID: VID-160
Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'kubernetes/vid/charts')
19 files changed, 318 insertions, 563 deletions
diff --git a/kubernetes/vid/charts/mariadb/.helmignore b/kubernetes/vid/charts/mariadb/.helmignore deleted file mode 100644 index f0c1319444..0000000000 --- a/kubernetes/vid/charts/mariadb/.helmignore +++ /dev/null @@ -1,21 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*~ -# Various IDEs -.project -.idea/ -*.tmproj diff --git a/kubernetes/vid/charts/mariadb/Chart.yaml b/kubernetes/vid/charts/mariadb/Chart.yaml deleted file mode 100644 index 1f7de32fdf..0000000000 --- a/kubernetes/vid/charts/mariadb/Chart.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed 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 -description: VID MariaDB Service -name: mariadb -version: 2.0.0 diff --git a/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-my.cnf b/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-my.cnf deleted file mode 100644 index 472bf4698e..0000000000 --- a/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-my.cnf +++ /dev/null @@ -1,192 +0,0 @@ -# MariaDB database server configuration file. -# -# You can copy this file to one of: -# - "/etc/mysql/my.cnf" to set global options, -# - "~/.my.cnf" to set user-specific options. -# -# One can use all long options that the program supports. -# Run program with --help to get a list of available options and with -# --print-defaults to see which it would actually understand and use. -# -# For explanations see -# http://dev.mysql.com/doc/mysql/en/server-system-variables.html - -# This will be passed to all mysql clients -# It has been reported that passwords should be enclosed with ticks/quotes -# escpecially if they contain "#" chars... -# Remember to edit /etc/mysql/debian.cnf when changing the socket location. -[client] -port = 3306 -socket = /var/run/mysqld/mysqld.sock - -# Here is entries for some specific programs -# The following values assume you have at least 32M ram - -# This was formally known as [safe_mysqld]. Both versions are currently parsed. -[mysqld_safe] -socket = /var/run/mysqld/mysqld.sock -nice = 0 - -[mysqld] -lower_case_table_names = 1 -skip-host-cache -skip-name-resolve -# -# * Basic Settings -# -#user = mysql -pid-file = /var/run/mysqld/mysqld.pid -socket = /var/run/mysqld/mysqld.sock -port = 3306 -basedir = /usr -datadir = /var/lib/mysql -tmpdir = /tmp -lc_messages_dir = /usr/share/mysql -lc_messages = en_US -skip-external-locking -# -# Instead of skip-networking the default is now to listen only on -# localhost which is more compatible and is not less secure. -#bind-address = 127.0.0.1 -# -# * Fine Tuning -# -max_connections = 100 -connect_timeout = 5 -wait_timeout = 600 -max_allowed_packet = 16M -thread_cache_size = 128 -sort_buffer_size = 4M -bulk_insert_buffer_size = 16M -tmp_table_size = 32M -max_heap_table_size = 32M -# -# * MyISAM -# -# This replaces the startup script and checks MyISAM tables if needed -# the first time they are touched. On error, make copy and try a repair. -myisam_recover_options = BACKUP -key_buffer_size = 128M -#open-files-limit = 2000 -table_open_cache = 400 -myisam_sort_buffer_size = 512M -concurrent_insert = 2 -read_buffer_size = 2M -read_rnd_buffer_size = 1M -# -# * Query Cache Configuration -# -# Cache only tiny result sets, so we can fit more in the query cache. -query_cache_limit = 128K -query_cache_size = 64M -# for more write intensive setups, set to DEMAND or OFF -#query_cache_type = DEMAND -# -# * Logging and Replication -# -# Both location gets rotated by the cronjob. -# Be aware that this log type is a performance killer. -# As of 5.1 you can enable the log at runtime! -#general_log_file = /var/log/mysql/mysql.log -#general_log = 1 -# -# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf. -# -# we do want to know about network errors and such -#log_warnings = 2 -# -# Enable the slow query log to see queries with especially long duration -#slow_query_log[={0|1}] -slow_query_log_file = /var/log/mysql/mariadb-slow.log -long_query_time = 10 -#log_slow_rate_limit = 1000 -#log_slow_verbosity = query_plan - -#log-queries-not-using-indexes -#log_slow_admin_statements -# -# The following can be used as easy to replay backup logs or for replication. -# note: if you are setting up a replication slave, see README.Debian about -# other settings you may need to change. -#server-id = 1 -#report_host = master1 -#auto_increment_increment = 2 -#auto_increment_offset = 1 -#log_bin = /var/log/mysql/mariadb-bin -#log_bin_index = /var/log/mysql/mariadb-bin.index -# not fab for performance, but safer -#sync_binlog = 1 -expire_logs_days = 10 -max_binlog_size = 100M -# slaves -#relay_log = /var/log/mysql/relay-bin -#relay_log_index = /var/log/mysql/relay-bin.index -#relay_log_info_file = /var/log/mysql/relay-bin.info -#log_slave_updates -#read_only -# -# If applications support it, this stricter sql_mode prevents some -# mistakes like inserting invalid dates etc. -#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL -# -# * InnoDB -# -# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. -# Read the manual for more InnoDB related options. There are many! -default_storage_engine = InnoDB -# you can't just change log file size, requires special procedure -#innodb_log_file_size = 50M -innodb_buffer_pool_size = 256M -innodb_log_buffer_size = 8M -innodb_file_per_table = 1 -innodb_open_files = 400 -innodb_io_capacity = 400 -innodb_flush_method = O_DIRECT -# -# * Security Features -# -# Read the manual, too, if you want chroot! -# chroot = /var/lib/mysql/ -# -# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". -# -# ssl-ca=/etc/mysql/cacert.pem -# ssl-cert=/etc/mysql/server-cert.pem -# ssl-key=/etc/mysql/server-key.pem - -# -# * Galera-related settings -# -[galera] -# Mandatory settings -#wsrep_on=ON -#wsrep_provider= -#wsrep_cluster_address= -#binlog_format=row -#default_storage_engine=InnoDB -#innodb_autoinc_lock_mode=2 -# -# Allow server to accept connections on all interfaces. -# -#bind-address=0.0.0.0 -# -# Optional setting -#wsrep_slave_threads=1 -#innodb_flush_log_at_trx_commit=0 - -[mysqldump] -quick -quote-names -max_allowed_packet = 16M - -[mysql] -#no-auto-rehash # faster start of mysql but no tab completion - -[isamchk] -key_buffer = 16M - -# -# * IMPORTANT: Additional settings that can override those from this file! -# The files must end with '.cnf', otherwise they'll be ignored. -# -!includedir /etc/mysql/conf.d/ diff --git a/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-pre-init.sql b/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-pre-init.sql deleted file mode 100644 index 8323a4ae86..0000000000 --- a/kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-pre-init.sql +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright © 2017 AT&T, Amdocs, Bell Canada -* -* Licensed 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. -*/ - -CREATE TABLE IF NOT EXISTS `vid_openecomp_epsdk`.`schema_info` ( - `SCHEMA_ID` VARCHAR(25) NOT NULL, - `SCHEMA_DESC` VARCHAR(75) NOT NULL, - `DATASOURCE_TYPE` VARCHAR(100) NULL DEFAULT NULL, - `CONNECTION_URL` VARCHAR(200) NOT NULL, - `USER_NAME` VARCHAR(45) NOT NULL, - `PASSWORD` VARCHAR(45) NULL DEFAULT NULL, - `DRIVER_CLASS` VARCHAR(100) NOT NULL, - `MIN_POOL_SIZE` INT(11) NOT NULL, - `MAX_POOL_SIZE` INT(11) NOT NULL, - `IDLE_CONNECTION_TEST_PERIOD` INT(11) NOT NULL) - ENGINE = InnoDB - DEFAULT CHARACTER SET = utf8; diff --git a/kubernetes/vid/charts/mariadb/templates/NOTES.txt b/kubernetes/vid/charts/mariadb/templates/NOTES.txt deleted file mode 100644 index 75f0a7a6b3..0000000000 --- a/kubernetes/vid/charts/mariadb/templates/NOTES.txt +++ /dev/null @@ -1,11 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} - http://{{ . }} -{{- end }} - export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.name" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') - echo http://$SERVICE_IP:{{ .Values.service.externalPort }} - export POD_NAME=$(kubectl get pods --namespace {{ include "common.namespace" . }} -l "app={{ .Chart.Name }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl port-forward $POD_NAME 8080:{{ .Values.service.internalPort }} -{{- end }} diff --git a/kubernetes/vid/charts/mariadb/templates/configmap.yaml b/kubernetes/vid/charts/mariadb/templates/configmap.yaml deleted file mode 100644 index 8a35df3f30..0000000000 --- a/kubernetes/vid/charts/mariadb/templates/configmap.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed 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: ConfigMap -metadata: - name: {{ include "common.fullname" . }}-lfconfig - namespace: {{ include "common.namespace" . }} -data: -{{ tpl (.Files.Glob "resources/config/lf_config/*").AsConfig . | indent 2 }} diff --git a/kubernetes/vid/charts/mariadb/templates/deployment.yaml b/kubernetes/vid/charts/mariadb/templates/deployment.yaml deleted file mode 100644 index 0560f60d8f..0000000000 --- a/kubernetes/vid/charts/mariadb/templates/deployment.yaml +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed 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: extensions/v1beta1 -kind: Deployment -metadata: - name: {{ include "common.fullname" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - replicas: {{ .Values.replicaCount }} - template: - metadata: - labels: - app: {{ include "common.name" . }} - release: {{ .Release.Name }} - spec: - containers: - - name: {{ include "common.name" . }} - image: "{{ include "common.repository" . }}/{{ .Values.image }}" - imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} - ports: - - containerPort: {{ .Values.service.internalPort }} - {{- if eq .Values.liveness.enabled true }} - livenessProbe: - tcpSocket: - port: {{ .Values.service.internalPort }} - initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} - periodSeconds: {{ .Values.liveness.periodSeconds }} - {{ end -}} - readinessProbe: - tcpSocket: - port: {{ .Values.service.internalPort }} - initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} - periodSeconds: {{ .Values.readiness.periodSeconds }} - env: - - name: MYSQL_DATABASE - value: "{{ .Values.config.mysqldb }}" - - name: MYSQL_USER - value: "{{ .Values.config.mysqluser }}" - - name: MYSQL_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "common.fullname" . }} - key: db-password - - name: MYSQL_ROOT_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "common.fullname" . }} - key: db-root-password - volumeMounts: - - mountPath: /etc/localtime - name: localtime - readOnly: true - - mountPath: /var/lib/mysql - name: mariadb-data - - mountPath: /docker-entrypoint-initdb.d/vid-pre-init.sql - name: lfconfig - subPath: vid-pre-init.sql - - mountPath: /etc/mysql/my.cnf - name: lfconfig - subPath: my.cnf - resources: -{{ toYaml .Values.resources | indent 12 }} - {{- if .Values.nodeSelector }} - nodeSelector: -{{ toYaml .Values.nodeSelector | indent 10 }} - {{- end -}} - {{- if .Values.affinity }} - affinity: -{{ toYaml .Values.affinity | indent 10 }} - {{- end }} - volumes: - - name: mariadb-data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ include "common.fullname" . }} - {{- else }} - emptyDir: {} - {{- end }} - - name: localtime - hostPath: - path: /etc/localtime - - name: lfconfig - configMap: - name: {{ include "common.fullname" . }}-lfconfig - defaultMode: 0755 - items: - - key: vid-my.cnf - path: my.cnf - - key: vid-pre-init.sql - path: vid-pre-init.sql - imagePullSecrets: - - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/vid/charts/mariadb/templates/secrets.yaml b/kubernetes/vid/charts/mariadb/templates/secrets.yaml deleted file mode 100644 index 36096925f5..0000000000 --- a/kubernetes/vid/charts/mariadb/templates/secrets.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed 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: Secret -metadata: - name: {{ include "common.fullname" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -type: Opaque -data: - db-root-password: {{ .Values.config.mariadbRootPassword | b64enc | quote }} - db-password: {{ .Values.config.mariadbPassword | b64enc | quote }} diff --git a/kubernetes/vid/charts/mariadb/templates/service.yaml b/kubernetes/vid/charts/mariadb/templates/service.yaml deleted file mode 100644 index 35333c441e..0000000000 --- a/kubernetes/vid/charts/mariadb/templates/service.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed 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: {{ include "common.servicename" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -spec: - ports: - - port: {{ .Values.service.internalPort }} - name: {{ .Values.service.portName }} - selector: - app: {{ include "common.name" . }} - release: {{ .Release.Name }} diff --git a/kubernetes/vid/charts/mariadb/values.yaml b/kubernetes/vid/charts/mariadb/values.yaml deleted file mode 100644 index c23d8bebfa..0000000000 --- a/kubernetes/vid/charts/mariadb/values.yaml +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright © 2017 Amdocs, Bell Canada -# -# Licensed 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. - -# Default values for mariadb. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. -global: # global defaults - nodePortPrefix: 302 - persistence: {} - - -# application image -repository: nexus3.onap.org:10001 -image: library/mariadb:10 -pullPolicy: Always - -# application configuration -config: - mysqldb: vid_openecomp_epsdk - mysqluser: vidadmin - mariadbRootPassword: LF+tp_1WqgSY - mariadbPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U - -# default number of instances -replicaCount: 1 - -nodeSelector: {} - -affinity: {} - -# probe configuration parameters -liveness: - initialDelaySeconds: 10 - periodSeconds: 10 - # necessary to disable liveness probe when setting breakpoints - # in debugger so K8s doesn't restart unresponsive container - enabled: true - -readiness: - initialDelaySeconds: 10 - periodSeconds: 10 - -## Persist data to a persitent volume -persistence: - enabled: true - - ## A manually managed Persistent Volume and Claim - ## Requires persistence.enabled: true - ## If defined, PVC must be created manually before volume will be bound - # existingClaim: - volumeReclaimPolicy: Retain - - ## database data Persistent Volume Storage Class - ## If defined, storageClassName: <storageClass> - ## If set to "-", storageClassName: "", which disables dynamic provisioning - ## If undefined (the default) or set to null, no storageClassName spec is - ## set, choosing the default provisioner. (gp2 on AWS, standard on - ## GKE, AWS & OpenStack) - ## - # storageClass: "-" - accessMode: ReadWriteMany - size: 2Gi - mountPath: /dockerdata-nfs - mountSubPath: vid/mariadb/data - -service: - name: vid-mariadb - portName: vid-mariadb - internalPort: 3306 - -ingress: - enabled: false - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # - # Example: - # Configure resource requests and limits - # ref: http://kubernetes.io/docs/user-guide/compute-resources/ - # Minimum memory for development is 2 CPU cores and 4GB memory - # Minimum memory for production is 4 CPU cores and 8GB memory -#resources: -# limits: -# cpu: 2 -# memory: 4Gi -# requests: -# cpu: 2 -# memory: 4Gi diff --git a/kubernetes/vid/charts/vid-galera/Chart.yaml b/kubernetes/vid/charts/vid-galera/Chart.yaml new file mode 100644 index 0000000000..85f36dc6fb --- /dev/null +++ b/kubernetes/vid/charts/vid-galera/Chart.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +description: Chart for MariaDB Galera cluster +name: mariadb-galera +version: 2.0.0 +keywords: + - mariadb + - mysql + - database + - sql + - galera + - cluster
\ No newline at end of file diff --git a/kubernetes/vid/charts/vid-galera/templates/NOTES.txt b/kubernetes/vid/charts/vid-galera/templates/NOTES.txt new file mode 100644 index 0000000000..3dd25ac4b7 --- /dev/null +++ b/kubernetes/vid/charts/vid-galera/templates/NOTES.txt @@ -0,0 +1,12 @@ +MariaDB-Galera service can be accessed via port 3306 on the following DNS name from within your cluster: +{{ include "common.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local + +To connect to your database: + +1. Run a pod that you can use as a client: + + kubectl run {{ include "common.fullname" . }}-client --rm --tty -i --image mariadb --command -- bash + +2. Connect using the mysql cli, then provide your password: + $ mysql -h {{ include "common.fullname" . }} {{- if .Values.mysqlRootPassword }} -p {{ .Values.mysqlRootPassword }}{{- end -}} + diff --git a/kubernetes/vid/charts/vid-galera/templates/configmap.yaml b/kubernetes/vid/charts/vid-galera/templates/configmap.yaml new file mode 100644 index 0000000000..ea90cd3e45 --- /dev/null +++ b/kubernetes/vid/charts/vid-galera/templates/configmap.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-confd + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/mariadb/conf.d/*").AsConfig . | indent 2 }} +--- +{{- if .Values.externalConfig }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-externalconfig + namespace: {{ include "common.namespace" . }} +data: + my_extra.cnf: |- + [mysqld] + lower_case_table_names = 1 + +#{{ toYaml .Values.externalConfig | indent 4 }} +#{{- end -}} diff --git a/kubernetes/vid/charts/mariadb/templates/pv.yaml b/kubernetes/vid/charts/vid-galera/templates/pv.yaml index 184728f8ad..f682196931 100644 --- a/kubernetes/vid/charts/mariadb/templates/pv.yaml +++ b/kubernetes/vid/charts/vid-galera/templates/pv.yaml @@ -1,5 +1,5 @@ {{/* -# Copyright © 2017 Amdocs, Bell Canada +# Copyright © 2017 Amdocs, Bell Canada # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kubernetes/vid/charts/mariadb/templates/pvc.yaml b/kubernetes/vid/charts/vid-galera/templates/pvc.yaml index e27c3311e9..c3de6e8150 100644 --- a/kubernetes/vid/charts/mariadb/templates/pvc.yaml +++ b/kubernetes/vid/charts/vid-galera/templates/pvc.yaml @@ -1,5 +1,5 @@ {{/* -# Copyright © 2017 Amdocs, Bell Canada +# Copyright © 2017 Amdocs, Bell Canada # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kubernetes/vid/charts/vid-galera/templates/secrets.yaml b/kubernetes/vid/charts/vid-galera/templates/secrets.yaml new file mode 100644 index 0000000000..101a7eba79 --- /dev/null +++ b/kubernetes/vid/charts/vid-galera/templates/secrets.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + db-root-password: {{ .Values.config.mariadbRootPassword | b64enc | quote }} + user-password: {{ default "" .Values.config.userPassword | b64enc | quote }}
\ No newline at end of file diff --git a/kubernetes/vid/charts/vid-galera/templates/service.yaml b/kubernetes/vid/charts/vid-galera/templates/service.yaml new file mode 100644 index 0000000000..348baa9ddc --- /dev/null +++ b/kubernetes/vid/charts/vid-galera/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + annotations: + service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" +# name: {{ include "common.servicename" . }} + name: {{ .Values.service.name }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + ports: + - name: {{ .Values.service.portName }} + port: {{ .Values.service.internalPort }} + clusterIP: None + selector: + app: {{ include "common.fullname" . }} diff --git a/kubernetes/vid/charts/vid-galera/templates/statefulset.yaml b/kubernetes/vid/charts/vid-galera/templates/statefulset.yaml new file mode 100644 index 0000000000..5470fdcc1c --- /dev/null +++ b/kubernetes/vid/charts/vid-galera/templates/statefulset.yaml @@ -0,0 +1,120 @@ +apiVersion: apps/v1beta1 +kind: StatefulSet +metadata: + name: {{ include "common.fullname" . }} + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: +# serviceName: {{ include "common.fullname" . }} + serviceName: {{ .Values.service.name }} + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ include "common.fullname" . }} + annotations: + pod.alpha.kubernetes.io/initialized: "true" + spec: + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} + volumes: + {{- if .Values.externalConfig }} + - name: config + configMap: + name: {{ include "common.fullname" . }}-externalconfig + {{- end}} + - name: localtime + hostPath: + path: /etc/localtime + imagePullSecrets: + - name: {{ include "common.namespace" . }}-docker-registry-key + containers: + - name: {{ include "common.fullname" . }} + image: "{{ include "common.repository" . }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}} + env: + - name: POD_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + - name: MYSQL_USER + value: {{ default "" .Values.config.userName | quote }} + - name: MYSQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: user-password + - name: MYSQL_DATABASE + value: {{ default "" .Values.config.mysqlDatabase | quote }} + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "common.fullname" . }} + key: db-root-password + ports: + - containerPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.name }} + - containerPort: {{ .Values.service.sstPort }} + name: {{ .Values.service.sstName }} + - containerPort: {{ .Values.service.replicationPort }} + name: {{ .Values.service.replicationName }} + - containerPort: {{ .Values.service.istPort }} + name: {{ .Values.service.istName }} + readinessProbe: + exec: + command: + - /usr/share/container-scripts/mysql/readiness-probe.sh + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + {{- if eq .Values.liveness.enabled true }} + livenessProbe: + exec: + command: ["mysqladmin", "ping"] + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + timeoutSeconds: {{ .Values.liveness.timeoutSeconds }} + {{- end }} + resources: +{{ toYaml .Values.resources | indent 12 }} + volumeMounts: + {{- if .Values.externalConfig }} + - mountPath: /etc/config + name: config + {{- end}} + - mountPath: /etc/localtime + name: localtime + readOnly: true +{{- if .Values.persistence.enabled }} + - mountPath: /var/lib/mysql + name: {{ include "common.fullname" . }}-data + subPath: data + initContainers: + - name: mariadb-galera-prepare + image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}" + command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"] + volumeMounts: + - name: {{ include "common.fullname" . }}-data + mountPath: /var/lib/mysql + volumeClaimTemplates: + - metadata: + name: {{ include "common.fullname" . }}-data + annotations: + {{- if .Values.persistence.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} + spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end }} diff --git a/kubernetes/vid/charts/vid-galera/values.yaml b/kubernetes/vid/charts/vid-galera/values.yaml new file mode 100644 index 0000000000..31955753df --- /dev/null +++ b/kubernetes/vid/charts/vid-galera/values.yaml @@ -0,0 +1,118 @@ +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + persistence: {} + repository: nexus3.onap.org:10001 + + +################################################################# +# Application configuration defaults. +################################################################# + +#repository: mysql +repository: nexus3.onap.org:10001 +image: adfinissygroup/k8s-mariadb-galera-centos:v002 +imageInit: busybox +pullPolicy: IfNotPresent + +# application configuration +config: + mariadbRootPassword: secretpassword +# userName: my-user +# userPassword: my-password +# mysqlDatabase: my-database + userName: vidadmin + userPassword: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + mysqlDatabase: vid_openecomp_epsdk + + +# default number of instances in the StatefulSet +# keep in mind that if the number is increased you need to update vid-galera-config-job.yaml so that the job will know to wait for all pods. +replicaCount: 1 + +nodeSelector: {} + +affinity: {} + +# probe configuration parameters +liveness: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + # necessary to disable liveness probe when setting breakpoints + # in debugger so K8s doesn't restart unresponsive container + enabled: false + +readiness: + initialDelaySeconds: 15 + periodSeconds: 10 + +## Persist data to a persitent volume +persistence: + enabled: false + + ## A manually managed Persistent Volume and Claim + ## Requires persistence.enabled: true + ## If defined, PVC must be created manually before volume will be bound + # existingClaim: + volumeReclaimPolicy: Retain + + ## database data Persistent Volume Storage Class + ## If defined, storageClassName: <storageClass> + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + accessMode: ReadWriteOnce + size: 2Gi + + +service: + internalPort: 3306 + name: vid-galera + portName: vid-galera + sstPort: 4444 + sstName: sst + replicationPort: 4567 + replicationName: replication + istPort: 4568 + istName: ist + +ingress: + enabled: false + + +## Configure MariaDB-Galera with a custom my.cnf file +## ref: https://mariadb.com/kb/en/mariadb/configuring-mariadb-with-mycnf/#example-of-configuration-file +## +#externalConfig: {} +externalConfig: |- + lower_case_table_names = 1 +#resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # + # Example: + # Configure resource requests and limits + # ref: http://kubernetes.io/docs/user-guide/compute-resources/ + # Minimum memory for development is 2 CPU cores and 4GB memory + # Minimum memory for production is 4 CPU cores and 8GB memory +resources: + limits: + cpu: 2 + memory: 4Gi + requests: + cpu: 2 + memory: 4Gi + +# Name for mariadb-galera cluster - should be unique accross all projects or other clusters +nameOverride: vid-galera + +# DNS name for mariadb-galera cluster - should be unique accross all projects other clusters +#dnsnameOverride: mariadb-galera |