From 46bec904421416cf78a6907d23e4ce40fcff51e5 Mon Sep 17 00:00:00 2001 From: Pramod Date: Wed, 17 Jan 2018 12:36:06 +0000 Subject: config seg vid deployment Issue-ID: OOM-559 Change-Id: I215f471b6711c8491d9381257c1b91ca3d21b8ed Signed-off-by: Pramod --- .../vid/resources/config/lf_config/vid-my.cnf | 192 +++++++++++++ .../resources/config/lf_config/vid-pre-init.sql | 32 +++ .../vid/resources/config/log/filebeat/filebeat.yml | 41 +++ .../vid/resources/config/log/vid/logback.xml | 299 +++++++++++++++++++++ .../vid/templates/vid-lfconfig-configmap.yaml | 9 + kubernetes/vid/templates/vid-log-configmap.yaml | 17 ++ .../vid/templates/vid-mariadb-deployment.yaml | 23 +- .../vid/templates/vid-server-deployment.yaml | 12 +- 8 files changed, 611 insertions(+), 14 deletions(-) create mode 100755 kubernetes/vid/resources/config/lf_config/vid-my.cnf create mode 100755 kubernetes/vid/resources/config/lf_config/vid-pre-init.sql create mode 100644 kubernetes/vid/resources/config/log/filebeat/filebeat.yml create mode 100644 kubernetes/vid/resources/config/log/vid/logback.xml create mode 100644 kubernetes/vid/templates/vid-lfconfig-configmap.yaml create mode 100644 kubernetes/vid/templates/vid-log-configmap.yaml (limited to 'kubernetes/vid') diff --git a/kubernetes/vid/resources/config/lf_config/vid-my.cnf b/kubernetes/vid/resources/config/lf_config/vid-my.cnf new file mode 100755 index 0000000000..472bf4698e --- /dev/null +++ b/kubernetes/vid/resources/config/lf_config/vid-my.cnf @@ -0,0 +1,192 @@ +# 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/resources/config/lf_config/vid-pre-init.sql b/kubernetes/vid/resources/config/lf_config/vid-pre-init.sql new file mode 100755 index 0000000000..57b797d03c --- /dev/null +++ b/kubernetes/vid/resources/config/lf_config/vid-pre-init.sql @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ +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/resources/config/log/filebeat/filebeat.yml b/kubernetes/vid/resources/config/log/filebeat/filebeat.yml new file mode 100644 index 0000000000..f316b866af --- /dev/null +++ b/kubernetes/vid/resources/config/log/filebeat/filebeat.yml @@ -0,0 +1,41 @@ +filebeat.prospectors: +#it is mandatory, in our case it's log +- input_type: log + #This is the canolical path as mentioned in logback.xml, *.* means it will monitor all files in the directory. + paths: + - /var/log/onap/*/*/*/*.log + - /var/log/onap/*/*/*.log + - /var/log/onap/*/*.log + #Files older than this should be ignored.In our case it will be 48 hours i.e. 2 days. It is a helping flag for clean_inactive + ignore_older: 48h + # Remove the registry entry for a file that is more than the specified time. In our case it will be 96 hours, i.e. 4 days. It will help to keep registry records with in limit + clean_inactive: 96h + + +# Name of the registry file. If a relative path is used, it is considered relative to the +# data path. Else full qualified file name. +#filebeat.registry_file: ${path.data}/registry + + +output.logstash: + #List of logstash server ip addresses with port number. + #But, in our case, this will be the loadbalancer IP address. + #For the below property to work the loadbalancer or logstash should expose 5044 port to listen the filebeat events or port in the property should be changed appropriately. + hosts: ["logstash.onap-log:5044"] + #If enable will do load balancing among availabe Logstash, automatically. + loadbalance: true + + #The list of root certificates for server verifications. + #If certificate_authorities is empty or not set, the trusted + #certificate authorities of the host system are used. + #ssl.certificate_authorities: $ssl.certificate_authorities + + #The path to the certificate for SSL client authentication. If the certificate is not specified, + #client authentication is not available. + #ssl.certificate: $ssl.certificate + + #The client certificate key used for client authentication. + #ssl.key: $ssl.key + + #The passphrase used to decrypt an encrypted key stored in the configured key file + #ssl.key_passphrase: $ssl.key_passphrase diff --git a/kubernetes/vid/resources/config/log/vid/logback.xml b/kubernetes/vid/resources/config/log/vid/logback.xml new file mode 100644 index 0000000000..49db781b3e --- /dev/null +++ b/kubernetes/vid/resources/config/log/vid/logback.xml @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + + + ${pattern} + + + + + + + + ${logDirectory}/${generalLogName}.log + + ${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.%i.log + + ${maxFileSize} + + ${maxHistory} + ${totalSizeCap} + + + ${pattern} + + + + + ${queueSize} + true + + + + + + + + + + + + + ${logDirectory}/${auditLogName}.log + + ${logDirectory}/${auditLogName}.%d{yyyy-MM-dd}.%i.log + + ${maxFileSize} + + ${maxHistory} + ${totalSizeCap} + + + ${pattern} + + + + ${queueSize} + + + + ${logDirectory}/${metricsLogName}.log + + ${logDirectory}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log + + ${maxFileSize} + + ${maxHistory} + ${totalSizeCap} + + + ${pattern} + + + + ${queueSize} + + + + ${logDirectory}/${errorLogName}.log + + ${logDirectory}/${errorLogName}.%d{yyyy-MM-dd}.%i.log + + ${maxFileSize} + + ${maxHistory} + ${totalSizeCap} + + + ${pattern} + + + + ${queueSize} + + + + ${logDirectory}/${debugLogName}.log + + ${logDirectory}/${debugLogName}.%d{yyyy-MM-dd}.%i.log + + ${maxFileSize} + + ${maxHistory} + ${totalSizeCap} + + + ${pattern} + + + + ${queueSize} + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kubernetes/vid/templates/vid-lfconfig-configmap.yaml b/kubernetes/vid/templates/vid-lfconfig-configmap.yaml new file mode 100644 index 0000000000..1cc3f218b9 --- /dev/null +++ b/kubernetes/vid/templates/vid-lfconfig-configmap.yaml @@ -0,0 +1,9 @@ +#{{ if not .Values.disableVidVidMariadb }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: vid-lfconfig-configmap + namespace: {{ .Values.nsPrefix }}-vid +data: +{{ tpl (.Files.Glob "resources/config/lf_config/*").AsConfig . | indent 2 }} +#{{ end }} diff --git a/kubernetes/vid/templates/vid-log-configmap.yaml b/kubernetes/vid/templates/vid-log-configmap.yaml new file mode 100644 index 0000000000..00481d259e --- /dev/null +++ b/kubernetes/vid/templates/vid-log-configmap.yaml @@ -0,0 +1,17 @@ +#{{ if not .Values.disableVidVidServer }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: vid-log-configmap + namespace: {{ .Values.nsPrefix }}-vid +data: +{{ tpl (.Files.Glob "resources/config/log/vid/*").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vid-filebeat-configmap + namespace: {{ .Values.nsPrefix }}-vid +data: +{{ tpl (.Files.Glob "resources/config/log/filebeat/*").AsConfig . | indent 2 }} +#{{ end }} diff --git a/kubernetes/vid/templates/vid-mariadb-deployment.yaml b/kubernetes/vid/templates/vid-mariadb-deployment.yaml index 55ef5da872..758ee578f0 100644 --- a/kubernetes/vid/templates/vid-mariadb-deployment.yaml +++ b/kubernetes/vid/templates/vid-mariadb-deployment.yaml @@ -36,9 +36,11 @@ spec: - mountPath: /var/lib/mysql name: vid-mariadb-data - mountPath: /docker-entrypoint-initdb.d/vid-pre-init.sql - name: vid-pre-init + name: vid-lfconfig + subPath: vid-pre-init.sql - mountPath: /etc/mysql/my.cnf - name: my-cnf + name: vid-lfconfig + subPath: my.cnf ports: - containerPort: 3306 readinessProbe: @@ -53,12 +55,15 @@ spec: - name: vid-mariadb-data persistentVolumeClaim: claimName: vid-db - - name: vid-pre-init - hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/vid/vid/lf_config/vid-pre-init.sql - - name: my-cnf - hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/vid/vid/lf_config/vid-my.cnf + - name: vid-lfconfig + configMap: + name: vid-lfconfig-configmap + defaultMode: 0755 + items: + - key: vid-my.cnf + path: my.cnf + - key: vid-pre-init.sql + path: vid-pre-init.sql imagePullSecrets: - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} \ No newline at end of file +#{{ end }} diff --git a/kubernetes/vid/templates/vid-server-deployment.yaml b/kubernetes/vid/templates/vid-server-deployment.yaml index 832fdeb93c..c979845fe1 100644 --- a/kubernetes/vid/templates/vid-server-deployment.yaml +++ b/kubernetes/vid/templates/vid-server-deployment.yaml @@ -73,7 +73,7 @@ spec: value: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U - name: VID_MYSQL_MAXCONNECTIONS value: "5" - image: {{ .Values.image.vid }} + image: {{ .Values.image.vid }} imagePullPolicy: {{ .Values.pullPolicy }} name: vid-server lifecycle: @@ -90,6 +90,7 @@ spec: name: vid-logs - mountPath: /tmp/logback.xml name: vid-logback + subPath: logback.xml readinessProbe: tcpSocket: port: 8080 @@ -101,6 +102,7 @@ spec: volumeMounts: - mountPath: /usr/share/filebeat/filebeat.yml name: filebeat-conf + subPath: filebeat.yml - mountPath: /var/log/onap name: vid-logs - mountPath: /usr/share/filebeat/data @@ -110,15 +112,15 @@ spec: hostPath: path: /etc/localtime - name: filebeat-conf - hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/filebeat/logback/filebeat.yml + configMap: + name: vid-filebeat-configmap - name: vid-logs emptyDir: {} - name: vid-data-filebeat emptyDir: {} - name: vid-logback - hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/vid/logback.xml + configMap: + name: vid-log-configmap imagePullSecrets: - name: "{{ .Values.nsPrefix }}-docker-registry-key" #{{ end }} -- cgit 1.2.3-korg