aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/vid
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/vid')
-rw-r--r--kubernetes/vid/charts/mariadb/.helmignore21
-rw-r--r--kubernetes/vid/charts/mariadb/Chart.yaml18
-rw-r--r--kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-my.cnf192
-rw-r--r--kubernetes/vid/charts/mariadb/resources/config/lf_config/vid-pre-init.sql28
-rw-r--r--kubernetes/vid/charts/mariadb/templates/NOTES.txt11
-rw-r--r--kubernetes/vid/charts/mariadb/templates/configmap.yaml21
-rw-r--r--kubernetes/vid/charts/mariadb/templates/deployment.yaml109
-rw-r--r--kubernetes/vid/charts/mariadb/templates/secrets.yaml28
-rw-r--r--kubernetes/vid/charts/mariadb/templates/service.yaml31
-rw-r--r--kubernetes/vid/charts/mariadb/values.yaml102
-rw-r--r--kubernetes/vid/charts/vid-galera/Chart.yaml11
-rw-r--r--kubernetes/vid/charts/vid-galera/templates/NOTES.txt12
-rw-r--r--kubernetes/vid/charts/vid-galera/templates/configmap.yaml21
-rw-r--r--kubernetes/vid/charts/vid-galera/templates/pv.yaml (renamed from kubernetes/vid/charts/mariadb/templates/pv.yaml)2
-rw-r--r--kubernetes/vid/charts/vid-galera/templates/pvc.yaml (renamed from kubernetes/vid/charts/mariadb/templates/pvc.yaml)2
-rw-r--r--kubernetes/vid/charts/vid-galera/templates/secrets.yaml14
-rw-r--r--kubernetes/vid/charts/vid-galera/templates/service.yaml20
-rw-r--r--kubernetes/vid/charts/vid-galera/templates/statefulset.yaml120
-rw-r--r--kubernetes/vid/charts/vid-galera/values.yaml118
-rw-r--r--kubernetes/vid/templates/check-job-completion-configmap.yaml83
-rw-r--r--kubernetes/vid/templates/cluster-ready-configmap.yaml89
-rw-r--r--kubernetes/vid/templates/dbcmd-configmap.yaml11
-rw-r--r--kubernetes/vid/templates/deployment.yaml30
-rw-r--r--kubernetes/vid/templates/galera-sql-configmap.yaml21
-rw-r--r--kubernetes/vid/templates/vid-galera-config-job.yaml70
-rw-r--r--kubernetes/vid/values.yaml14
26 files changed, 621 insertions, 578 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
diff --git a/kubernetes/vid/templates/check-job-completion-configmap.yaml b/kubernetes/vid/templates/check-job-completion-configmap.yaml
new file mode 100644
index 0000000000..b9c4488338
--- /dev/null
+++ b/kubernetes/vid/templates/check-job-completion-configmap.yaml
@@ -0,0 +1,83 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "common.fullname" . }}-check-job-completion
+ namespace: {{ include "common.namespace" . }}
+data:
+ vid_check_job_completion.py: |
+ #!/usr/bin/python
+ from __future__ import print_function
+ import time, argparse, logging, sys, os
+ import kubernetes.client
+ from kubernetes import client, config
+ from pprint import pprint
+
+ #extract env variables.
+ namespace = os.environ['NAMESPACE']
+ cert = os.environ['CERT']
+ host = os.environ['KUBERNETES_SERVICE_HOST']
+ token_path = os.environ['TOKEN']
+
+ with open(token_path, 'r') as token_file:
+ token = token_file.read().replace('\n', '')
+
+ client.configuration.api_key['authorization'] = token
+ client.configuration.api_key_prefix['authorization'] = 'Bearer'
+ client.configuration.host = "https://" + str(host)
+ client.configuration.ssl_ca_cert = cert
+
+ api_instance = client.BatchV1Api()
+
+ #setup logging
+ log = logging.getLogger(__name__)
+ handler = logging.StreamHandler(sys.stdout)
+ handler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s'))
+ handler.setLevel(logging.INFO)
+ log.addHandler(handler)
+ log.setLevel(logging.INFO)
+
+
+ def is_ready(job_name):
+ log.info( "[INFO] Checking if " + job_name + " is completed")
+ pretty = True
+ job_status = False
+
+ try:
+ api_response = api_instance.read_namespaced_job_status(job_name, namespace, pretty=pretty)
+ except Exception as e:
+ print("Exception when calling BatchV1Api->read_namespaced_job_status: %s\n" % e)
+
+ pprint(api_response)
+ if api_response.status.succeeded == 1:
+ job_status_type = api_response.status.conditions[0].type
+ if job_status_type == "Complete":
+ job_status = True
+
+ print("[DBG] jobStatus: " + unicode(job_status))
+ return job_status
+
+
+ def main(args):
+ for job_name in args:
+ timeout = time.time() + 60 * 10
+ while True:
+ ready = is_ready(job_name)
+ if ready is True :
+ break
+ elif time.time() > timeout:
+ log.warning( "timed out waiting for '" + job_name + "' to be ready")
+ exit(1)
+ else:
+ time.sleep(5)
+
+
+ if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description='Process some names.')
+ parser.add_argument('--job-name', action='append', required=True, help='A container name')
+ args = parser.parse_args()
+ arg_dict = vars(args)
+
+ for arg in arg_dict.itervalues():
+ main(arg)
+
+
diff --git a/kubernetes/vid/templates/cluster-ready-configmap.yaml b/kubernetes/vid/templates/cluster-ready-configmap.yaml
new file mode 100644
index 0000000000..296db335a7
--- /dev/null
+++ b/kubernetes/vid/templates/cluster-ready-configmap.yaml
@@ -0,0 +1,89 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "common.fullname" . }}-cluster-ready-configmap
+ namespace: {{ include "common.namespace" . }}
+data:
+ vid_ready.py : |-
+ #!/usr/bin/python
+ from kubernetes import client, config
+ import time, argparse, logging, sys, os
+
+ #extract env variables.
+ namespace = os.environ['NAMESPACE']
+ cert = os.environ['CERT']
+ host = os.environ['KUBERNETES_SERVICE_HOST']
+ token_path = os.environ['TOKEN']
+
+ with open(token_path, 'r') as token_file:
+ token = token_file.read().replace('\n', '')
+
+ client.configuration.host = "https://" + host
+ client.configuration.ssl_ca_cert = cert
+ client.configuration.api_key['authorization'] = token
+ client.configuration.api_key_prefix['authorization'] = 'Bearer'
+
+ #setup logging
+ log = logging.getLogger(__name__)
+ handler = logging.StreamHandler(sys.stdout)
+ handler.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s - %(message)s'))
+ handler.setLevel(logging.INFO)
+ log.addHandler(handler)
+ log.setLevel(logging.INFO)
+
+
+ def is_ready(container_name):
+ log.info( "Checking if " + container_name + " is ready")
+ # config.load_kube_config() # for local testing
+ # namespace='onap-sdc' # for local testing
+ v1 = client.CoreV1Api()
+
+ ready = False
+
+ try:
+ response = v1.list_namespaced_pod(namespace=namespace, watch=False)
+
+ for i in response.items:
+ #log.info(i.metadata.name)
+ for s in i.status.container_statuses:
+ #log.info(s.name)
+ if i.metadata.name == container_name:
+ ready = s.ready
+ if not ready:
+ log.info( container_name + " is not ready.")
+ else:
+ log.info( container_name + " is ready!")
+ else:
+ continue
+ return ready
+ except Exception as e:
+ log.error("Exception when calling list_namespaced_pod: %s\n" % e)
+
+
+ def main(args):
+ # args are a list of container names
+ for container_name in args:
+ # 5 min, TODO: make configurable
+ timeout = time.time() + 60 * 10
+ while True:
+ ready = is_ready(container_name)
+ if ready is True:
+ break
+ elif time.time() > timeout:
+ log.warning( "timed out waiting for '" + container_name + "' to be ready")
+ exit(1)
+ else:
+ time.sleep(5)
+
+
+ if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description='Process some names.')
+ parser.add_argument('--container-name', action='append', required=True, help='A container name')
+ args = parser.parse_args()
+ arg_dict = vars(args)
+
+ for arg in arg_dict.itervalues():
+ main(arg)
+
+
+
diff --git a/kubernetes/vid/templates/dbcmd-configmap.yaml b/kubernetes/vid/templates/dbcmd-configmap.yaml
new file mode 100644
index 0000000000..7c06e748f4
--- /dev/null
+++ b/kubernetes/vid/templates/dbcmd-configmap.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "common.fullname" . }}-dbcmd-configmap
+ namespace: {{ include "common.namespace" . }}
+data:
+ db_cmd.sh : |-
+ #!/bin/sh
+ #mysql -uroot -p${MYSQL_ROOT_PASSWORD} -h${MYSQL_HOST} -P3306 < /db-config/vid-pre-init.sql
+ mysql -uvidadmin -p${MYSQL_PASSWORD} -h${MYSQL_HOST} -P3306 < /db-config/vid-pre-init.sql
+
diff --git a/kubernetes/vid/templates/deployment.yaml b/kubernetes/vid/templates/deployment.yaml
index 6da8dd2e3f..8d490fbc4d 100644
--- a/kubernetes/vid/templates/deployment.yaml
+++ b/kubernetes/vid/templates/deployment.yaml
@@ -31,11 +31,18 @@ spec:
release: {{ .Release.Name }}
spec:
initContainers:
+#dd775k: This container checks if the job that wait for all db instances to be up and initializes the db had finished.
+# - command:
+# - /bin/sh
+# args:
+# - "-c"
+# - "sleep 1000000000m"
- command:
- - /root/ready.py
+ - python
args:
- - --container-name
- - {{ .Values.mariadb.nameOverride }}
+ - /tmp/vid-check-job-completion/vid_check_job_completion.py
+ - --job-name
+ - vid-config-galera
env:
- name: NAMESPACE
valueFrom:
@@ -45,6 +52,9 @@ spec:
image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
name: {{ include "common.name" . }}-readiness
+ volumeMounts:
+ - mountPath: /tmp/vid-check-job-completion
+ name: vid-check-job-completion
containers:
- name: {{ include "common.name" . }}
image: "{{ include "common.repository" . }}/{{ .Values.image }}"
@@ -83,7 +93,7 @@ spec:
- name: VID_ECOMP_SHARED_CONTEXT_REST_URL
value: http://portal-app.{{ include "common.namespace" . }}:{{ .Values.config.onapport }}/ONAPPORTAL/context
- name: VID_MSO_SERVER_URL
- value: http://so.{{ include "common.namespace" . }}:{{ .Values.config.msoport }}
+ value: http://mso.{{ include "common.namespace" . }}:{{ .Values.config.msoport }}
- name: VID_MSO_PASS
value: "{{ .Values.config.vidmsopass }}"
- name: MSO_DME2_SERVER_URL
@@ -107,10 +117,9 @@ spec:
- name: VID_MYSQL_USER
value: "{{ .Values.config.vidmysqluser }}"
- name: VID_MYSQL_PASS
- valueFrom:
- secretKeyRef:
- name: {{ template "common.fullname" . }}
- key: vid-password
+ value: "{{ .Values.config.vidmysqlpassword }}"
+ #valueFrom:
+ # secretKeyRef: {name: {{ include "common.fullname" . }}, key: vid-password}
- name: VID_MYSQL_MAXCONNECTIONS
value: "{{ .Values.config.vidmysqlmaxconnections }}"
volumeMounts:
@@ -158,5 +167,10 @@ spec:
- name: vid-logback
configMap:
name: {{ include "common.fullname" . }}-log-configmap
+ - name: vid-check-job-completion
+ configMap:
+ name: {{ include "common.fullname" . }}-check-job-completion
imagePullSecrets:
- name: "{{ include "common.namespace" . }}-docker-registry-key"
+
+
diff --git a/kubernetes/vid/templates/galera-sql-configmap.yaml b/kubernetes/vid/templates/galera-sql-configmap.yaml
new file mode 100644
index 0000000000..ccda497887
--- /dev/null
+++ b/kubernetes/vid/templates/galera-sql-configmap.yaml
@@ -0,0 +1,21 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "common.fullname" . }}-galera-sql-configmap
+ namespace: "{{ include "common.namespace" . }}"
+data:
+ vid-pre-init.sql: |-
+ 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/templates/vid-galera-config-job.yaml b/kubernetes/vid/templates/vid-galera-config-job.yaml
new file mode 100644
index 0000000000..b02d5b4913
--- /dev/null
+++ b/kubernetes/vid/templates/vid-galera-config-job.yaml
@@ -0,0 +1,70 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: vid-config-galera
+ namespace: {{ include "common.namespace" . }}
+ labels:
+ app: vid-config-galera
+ release: {{ .Release.Name }}
+spec:
+ template:
+ metadata:
+ name: vid-galera-init
+ spec:
+ initContainers:
+#dd775k: This container checks that all galera instances are up before initializing it.
+ - name: vid-init-galera-readiness
+ image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+ imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+# - /bin/sh
+# args:
+# - "-c"
+# - "sleep 1000000000m"
+ command:
+ - python
+ args:
+ - /root/vid_ready.py
+ - --container-name
+ - {{ include "common.fullname" . }}-mariadb-galera-0
+ env:
+ - name: NAMESPACE
+ value: {{ include "common.namespace" . }}
+ volumeMounts:
+ - name: init-config
+ mountPath: /root/
+ containers:
+ - name: vid-config-galeradb
+ image: {{ .Values.mariadb_image }}
+ imagePullPolicy: "{{ .Values.pullPolicy }}"
+ volumeMounts:
+ - name: vid-db-config
+ mountPath: /db-config
+ - name: dbcmd-config
+ mountPath: /dbcmd-config
+ command:
+ - /bin/sh
+ args:
+ - -x
+ - /dbcmd-config/db_cmd.sh
+ env:
+ - name: MYSQL_PASSWORD
+ value: "{{ .Values.config.vidmysqlpassword }}"
+# valueFrom:
+# secretKeyRef:
+# name: {{ template "common.fullname" . }}
+# key: vid-password
+ - name: MYSQL_HOST
+ value: "{{ .Values.config.vidmysqlhost }}"
+ volumes:
+ - name: vid-db-config
+ configMap:
+ name: {{ include "common.fullname" . }}-galera-sql-configmap
+ - name: dbcmd-config
+ configMap:
+ name: {{ include "common.fullname" . }}-dbcmd-configmap
+ - name: init-config
+ configMap:
+ name: {{ include "common.fullname" . }}-cluster-ready-configmap
+ restartPolicy: Never
+
+
diff --git a/kubernetes/vid/values.yaml b/kubernetes/vid/values.yaml
index e7fb378332..8487743177 100644
--- a/kubernetes/vid/values.yaml
+++ b/kubernetes/vid/values.yaml
@@ -17,8 +17,9 @@
# Declare variables to be passed into your templates.
global:
nodePortPrefix: 302
+ repositorySecret: eyJuZXh1czMub25hcC5vcmc6MTAwMDEiOnsidXNlcm5hbWUiOiJkb2NrZXIiLCJwYXNzd29yZCI6ImRvY2tlciIsImVtYWlsIjoiQCIsImF1dGgiOiJaRzlqYTJWeU9tUnZZMnRsY2c9PSJ9fQ==
readinessRepository: oomk8s
- readinessImage: readiness-check:2.0.0
+ readinessImage: readiness-check:1.0.0
loggingRepository: docker.elastic.co
loggingImage: beats/filebeat:5.5.0
@@ -30,8 +31,8 @@ repository: nexus3.onap.org:10001
image: onap/vid:2.0.0
pullPolicy: Always
-# flag to enable debugging - application support required
-debugEnabled: false
+# mariadb image for initializing
+mariadb_image: library/mariadb:10
# application configuration
config:
@@ -44,7 +45,7 @@ config:
vidmsopass: OBF:1ih71i271vny1yf41ymf1ylz1yf21vn41hzj1icz
msodme2serverurl: http://localhost:8081
vidcontactuslink: https://todo_contact_us_link.com
- vidmysqlhost: vid-mariadb
+ vidmysqlhost: vid-galera
vidmysqlport: "3306"
vidmysqldbname: vid_openecomp_epsdk
vidmysqluser: vidadmin
@@ -52,10 +53,9 @@ config:
logstashServiceName: log-ls
logstashPort: 5044
-
# subchart configuration
-mariadb:
- nameOverride: vid-mariadb
+mariadb-galera:
+ nameOverride: vid-mariadb-galera
# default number of instances
replicaCount: 1