From 396402cdd65c3f1a5b1fe2ab7fc0dd62f9dc35bd Mon Sep 17 00:00:00 2001 From: Michael O'Brien Date: Mon, 23 Jul 2018 10:07:49 -0400 Subject: add filebeat to k8s log demo Change-Id: I1c229a9e5f7c9379d8d9f9fdf724908f083925d9 Issue-ID: LOG-137 Signed-off-by: Michael O'Brien --- README.md | 9 +- .../logging-demo/src/main/resources/logback.xml | 130 +++++++++++++++++---- reference/logging-kubernetes/Makefile | 73 ++++++++++++ .../logging-kubernetes/log-mock-demo/Chart.yaml | 4 - .../log-mock-demo/templates/all-services.yaml | 14 --- .../templates/log-mock-demo-deployment.yaml | 43 ------- .../logging-kubernetes/log-mock-demo/values.yaml | 7 -- reference/logging-kubernetes/logdemo/Chart.yaml | 4 - .../logdemo/templates/all-services.yaml | 14 --- .../templates/log-mock-service-deployment.yaml | 43 ------- reference/logging-kubernetes/logdemo/values.yaml | 7 -- .../logging-kubernetes/logdemonode/.helmignore | 22 ++++ .../logging-kubernetes/logdemonode/Chart.yaml | 18 +++ reference/logging-kubernetes/logdemonode/README.md | 43 +++++++ .../logdemonode/charts/logdemonode/Chart.yaml | 18 +++ .../charts/logdemonode/requirements.yaml | 18 +++ .../resources/config/log/filebeat/filebeat.yml | 41 +++++++ .../logdemonode/resources/config/logback.xml | 118 +++++++++++++++++++ .../charts/logdemonode/templates/configmap.yaml | 30 +++++ .../charts/logdemonode/templates/deployment.yaml | 118 +++++++++++++++++++ .../charts/logdemonode/templates/service.yaml | 53 +++++++++ .../logdemonode/charts/logdemonode/values.yaml | 100 ++++++++++++++++ .../logdemonode/requirements.yaml | 18 +++ .../logdemonode/resources/config/README.txt | 10 ++ .../resources/config/application.properties | 1 + .../logging-kubernetes/logdemonode/values.yaml | 44 +++++++ .../logging-kubernetes/logdemoservice/Chart.yaml | 4 - .../logdemoservice/templates/all-services.yaml | 14 --- .../log-mock-demo-service-deployment.yaml | 57 --------- .../logging-kubernetes/logdemoservice/values.yaml | 7 -- 30 files changed, 840 insertions(+), 242 deletions(-) create mode 100644 reference/logging-kubernetes/Makefile delete mode 100644 reference/logging-kubernetes/log-mock-demo/Chart.yaml delete mode 100644 reference/logging-kubernetes/log-mock-demo/templates/all-services.yaml delete mode 100644 reference/logging-kubernetes/log-mock-demo/templates/log-mock-demo-deployment.yaml delete mode 100644 reference/logging-kubernetes/log-mock-demo/values.yaml delete mode 100644 reference/logging-kubernetes/logdemo/Chart.yaml delete mode 100644 reference/logging-kubernetes/logdemo/templates/all-services.yaml delete mode 100644 reference/logging-kubernetes/logdemo/templates/log-mock-service-deployment.yaml delete mode 100644 reference/logging-kubernetes/logdemo/values.yaml create mode 100644 reference/logging-kubernetes/logdemonode/.helmignore create mode 100644 reference/logging-kubernetes/logdemonode/Chart.yaml create mode 100644 reference/logging-kubernetes/logdemonode/README.md create mode 100644 reference/logging-kubernetes/logdemonode/charts/logdemonode/Chart.yaml create mode 100644 reference/logging-kubernetes/logdemonode/charts/logdemonode/requirements.yaml create mode 100644 reference/logging-kubernetes/logdemonode/charts/logdemonode/resources/config/log/filebeat/filebeat.yml create mode 100644 reference/logging-kubernetes/logdemonode/charts/logdemonode/resources/config/logback.xml create mode 100644 reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/configmap.yaml create mode 100644 reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/deployment.yaml create mode 100644 reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/service.yaml create mode 100644 reference/logging-kubernetes/logdemonode/charts/logdemonode/values.yaml create mode 100644 reference/logging-kubernetes/logdemonode/requirements.yaml create mode 100644 reference/logging-kubernetes/logdemonode/resources/config/README.txt create mode 100644 reference/logging-kubernetes/logdemonode/resources/config/application.properties create mode 100644 reference/logging-kubernetes/logdemonode/values.yaml delete mode 100644 reference/logging-kubernetes/logdemoservice/Chart.yaml delete mode 100644 reference/logging-kubernetes/logdemoservice/templates/all-services.yaml delete mode 100644 reference/logging-kubernetes/logdemoservice/templates/log-mock-demo-service-deployment.yaml delete mode 100644 reference/logging-kubernetes/logdemoservice/values.yaml diff --git a/README.md b/README.md index b4cf1c3..7a96efd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -This project contains reference configurations for ONAP logging providers and an Elastic Stack pipeline consisting of Filebeat, Logstash, Elastic Search and Kibana Discover. -The project also contains several reference logging library abstractions. +This project contains the reference configurations for ONAP logging providers and an Elastic Stack pipeline consisting of Filebeat, Logstash, Elasticsearch and Kibana. +The project also contains several reference logging library abstractions for Java and Python. See the OOM project for automated deployment of the Elastic Stack pipeline and application of provider configuration as part of bringing up ONAP on kubernetes. +There is a reference slf4j library in https://git.onap.org/logging-analytics/tree/reference/logging-slf4j To deploy the kubernetes undercloud and provision OOM refer to the deploy subfolder in this project. + +Running the logdemonode pod: +see the README.md in the reference/logging-kubernetes/logdemonode directory + diff --git a/reference/logging-demo/src/main/resources/logback.xml b/reference/logging-demo/src/main/resources/logback.xml index 71d41e4..eddb4a8 100644 --- a/reference/logging-demo/src/main/resources/logback.xml +++ b/reference/logging-demo/src/main/resources/logback.xml @@ -1,4 +1,4 @@ - + @@ -8,25 +8,111 @@ - - - ${pattern} - - - - - output.log - - ${pattern} - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + ${logDirectory}/${auditLogName}.log + + ${logDirectory}/${auditLogName}.log.%d + + + ${auditPattern} + + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + ${logDirectory}/${metricsLogName}.log.%d + + + ${metricPattern} + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + ${logDirectory}/${errorLogName}.log.%d + + + INFO + + + ${errorPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}.log + + ${debugLogDirectory}/${debugLogName}.log.%d + + + ${debugPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + diff --git a/reference/logging-kubernetes/Makefile b/reference/logging-kubernetes/Makefile new file mode 100644 index 0000000..0b725bf --- /dev/null +++ b/reference/logging-kubernetes/Makefile @@ -0,0 +1,73 @@ +# Copyright © 2018 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. +# copy of oom/kubernetes/Makefile +# usage +# sudo helm make all +# sudo helm make logdemonode + +PARENT_CHART := logdemonode +COMMON_CHARTS_DIR := common +# FIXME OOM-765 +ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) +OUTPUT_DIR := $(ROOT_DIR)/dist +PACKAGE_DIR := $(OUTPUT_DIR)/packages +SECRET_DIR := $(OUTPUT_DIR)/secrets + +EXCLUDES := config oneclick readiness test dist helm $(PARENT_CHART) dcae +HELM_CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) $(PARENT_CHART) + +.PHONY: $(EXCLUDES) $(HELM_CHARTS) + +all: $(COMMON_CHARTS_DIR) $(HELM_CHARTS) + +$(COMMON_CHARTS): + @echo "\n[$@]" + @make package-$@ + +$(HELM_CHARTS): + @echo "\n[$@]" + @make package-$@ + +make-%: + @if [ -f $*/Makefile ]; then make -C $*; fi + +dep-%: make-% + @if [ -f $*/requirements.yaml ]; then helm dep up $*; fi + +lint-%: dep-% + @if [ -f $*/Chart.yaml ]; then helm lint $*; fi + +package-%: lint-% + @mkdir -p $(PACKAGE_DIR) + @if [ -f $*/Chart.yaml ]; then helm package -d $(PACKAGE_DIR) $*; fi + @helm repo index $(PACKAGE_DIR) + +clean: + @rm -f */requirements.lock + @find . -type f -name '*.tgz' -delete + @rm -rf $(PACKAGE_DIR)/* + +# start up a local helm repo to serve up helm chart packages +repo: + @mkdir -p $(PACKAGE_DIR) + @helm serve --repo-path $(PACKAGE_DIR) & + @helm repo index $(PACKAGE_DIR) + @helm repo add local http://127.0.0.1:8879 + +# stop local helm repo +repo-stop: + @pkill helm + @helm repo remove local +%: + @: diff --git a/reference/logging-kubernetes/log-mock-demo/Chart.yaml b/reference/logging-kubernetes/log-mock-demo/Chart.yaml deleted file mode 100644 index 9c45fce..0000000 --- a/reference/logging-kubernetes/log-mock-demo/Chart.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -description: A Helm chart for Kubernetes -name: logdemo -version: 0.1.0 diff --git a/reference/logging-kubernetes/log-mock-demo/templates/all-services.yaml b/reference/logging-kubernetes/log-mock-demo/templates/all-services.yaml deleted file mode 100644 index 9e4f694..0000000 --- a/reference/logging-kubernetes/log-mock-demo/templates/all-services.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app: logdemo - name: logdemo - namespace: "{{ .Values.nsPrefix }}-logdemo" -spec: - ports: - - port: 8080 - nodePort: {{ .Values.nodePortPrefix }}99 - selector: - app: logdemo - type: NodePort diff --git a/reference/logging-kubernetes/log-mock-demo/templates/log-mock-demo-deployment.yaml b/reference/logging-kubernetes/log-mock-demo/templates/log-mock-demo-deployment.yaml deleted file mode 100644 index afd513e..0000000 --- a/reference/logging-kubernetes/log-mock-demo/templates/log-mock-demo-deployment.yaml +++ /dev/null @@ -1,43 +0,0 @@ -#{{ if not .Values.disableLogdemoLogdemo }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: logdemo - namespace: "{{ .Values.nsPrefix }}-logdemo" -spec: - selector: - matchLabels: - app: logdemo - template: - metadata: - labels: - app: logdemo - name: logdemo - spec: - containers: - - image: {{ .Values.image.logdemo }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: logdemo - volumeMounts: - - name: localtime - mountPath: /etc/localtime - readOnly: true - - name: logdemo-eteshare - mountPath: /share - ports: - - containerPort: 8080 - readinessProbe: - tcpSocket: - port: 8080 - initialDelaySeconds: 5 - periodSeconds: 10 - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: logdemo-eteshare - hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/logdemo/eteshare - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/reference/logging-kubernetes/log-mock-demo/values.yaml b/reference/logging-kubernetes/log-mock-demo/values.yaml deleted file mode 100644 index 6d1adf7..0000000 --- a/reference/logging-kubernetes/log-mock-demo/values.yaml +++ /dev/null @@ -1,7 +0,0 @@ -nsPrefix: onap -pullPolicy: Always -nodePortPrefix: 302 -image: - readiness: oomk8s/readiness-check:1.0.0 - logdemo: obrienlabs/logging-demo-nbi:0.0.1 - filebeat: docker.elastic.co/beats/filebeat:5.5.0 diff --git a/reference/logging-kubernetes/logdemo/Chart.yaml b/reference/logging-kubernetes/logdemo/Chart.yaml deleted file mode 100644 index 9c45fce..0000000 --- a/reference/logging-kubernetes/logdemo/Chart.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -description: A Helm chart for Kubernetes -name: logdemo -version: 0.1.0 diff --git a/reference/logging-kubernetes/logdemo/templates/all-services.yaml b/reference/logging-kubernetes/logdemo/templates/all-services.yaml deleted file mode 100644 index dc57183..0000000 --- a/reference/logging-kubernetes/logdemo/templates/all-services.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app: logservice - name: logservice - namespace: "{{ .Values.nsPrefix }}-logservice" -spec: - ports: - - port: 8080 - nodePort: {{ .Values.nodePortPrefix }}98 - selector: - app: logservice - type: NodePort diff --git a/reference/logging-kubernetes/logdemo/templates/log-mock-service-deployment.yaml b/reference/logging-kubernetes/logdemo/templates/log-mock-service-deployment.yaml deleted file mode 100644 index 92bcbe8..0000000 --- a/reference/logging-kubernetes/logdemo/templates/log-mock-service-deployment.yaml +++ /dev/null @@ -1,43 +0,0 @@ -#{{ if not .Values.disableLogserviceLogservice }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: logservice - namespace: "{{ .Values.nsPrefix }}-logservice" -spec: - selector: - matchLabels: - app: logservice - template: - metadata: - labels: - app: logservice - name: logservice - spec: - containers: - - image: {{ .Values.image.logservice }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: logservice - volumeMounts: - - name: localtime - mountPath: /etc/localtime - readOnly: true - - name: logservice-eteshare - mountPath: /share - ports: - - containerPort: 8080 - readinessProbe: - tcpSocket: - port: 8080 - initialDelaySeconds: 5 - periodSeconds: 10 - volumes: - - name: localtime - hostPath: - path: /etc/localtime - - name: logservice-eteshare - hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/logservice/eteshare - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/reference/logging-kubernetes/logdemo/values.yaml b/reference/logging-kubernetes/logdemo/values.yaml deleted file mode 100644 index a13dbe3..0000000 --- a/reference/logging-kubernetes/logdemo/values.yaml +++ /dev/null @@ -1,7 +0,0 @@ -nsPrefix: onap -pullPolicy: Always -nodePortPrefix: 302 -image: - readiness: oomk8s/readiness-check:1.0.0 - logdemo: oomk8s/logging-demo-nbi:0.0.2 - filebeat: docker.elastic.co/beats/filebeat:5.5.0 diff --git a/reference/logging-kubernetes/logdemonode/.helmignore b/reference/logging-kubernetes/logdemonode/.helmignore new file mode 100644 index 0000000..06e1663 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/.helmignore @@ -0,0 +1,22 @@ +# 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/reference/logging-kubernetes/logdemonode/Chart.yaml b/reference/logging-kubernetes/logdemonode/Chart.yaml new file mode 100644 index 0000000..a8cbcf9 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/Chart.yaml @@ -0,0 +1,18 @@ +# Copyright © 2018 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: Logging reference demo node container - use with demo master +name: logdemonode +version: 2.0.0 diff --git a/reference/logging-kubernetes/logdemonode/README.md b/reference/logging-kubernetes/logdemonode/README.md new file mode 100644 index 0000000..3b3de15 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/README.md @@ -0,0 +1,43 @@ +Running the logdemonode pod: +- oom and logging-analytics cloned +sudo git clone https://gerrit.onap.org/r/oom +sudo git clone https://gerrit.onap.org/r/logging-analytics + +install onap log: +cd oom/kubernetes +/oom/kubernetes$ sudo helm delete --purge onap +/oom/kubernetes$ sudo make all +/oom/kubernetes$ sudo helm install local/onap -n onap --namespace onap -f onap/resources/environments/disable-allcharts.yaml --set log.enabled=false +/oom/kubernetes$ sudo helm upgrade -i onap local/onap --namespace onap -f onap/resources/environments/disable-allcharts.yaml --set log.enabled=true + +install logdemo: +cd logging-analytics/reference/logging-kubernetes +/logging-analytics/reference/logging-kubernetes$ sudo helm delete --purge logdemonode +/logging-analytics/reference/logging-kubernetes$ sudo make all +/logging-analytics/reference/logging-kubernetes$ sudo helm install local/logdemonode -n logdemonode --namespace onap --set logdemonode.enabled=true + +results: +kubectl get pods --all-namespaces +onap logdemonode-logdemonode-5c8bffb468-rx2br 2/2 Running 0 1m +onap onap-log-elasticsearch-7557486bc4-9h7gf 1/1 Running 0 40m +onap onap-log-kibana-fc88b6b79-rkpzx 1/1 Running 0 40m +onap onap-log-logstash-fpzc5 1/1 Running 0 40m + +kubectl get services --all-namespaces +onap log-es NodePort 10.43.17.89 9200:30254/TCP 39m +onap log-es-tcp ClusterIP 10.43.120.133 9300/TCP 39m +onap log-kibana NodePort 10.43.73.68 5601:30253/TCP 39m +onap log-ls NodePort 10.43.107.55 5044:30255/TCP 39m +onap log-ls-http ClusterIP 10.43.48.177 9600/TCP 39m +onap logdemonode NodePort 10.43.0.35 8080:30258/TCP 55s + +Invoke a rest call that generates logs (ENTRY, in-method, EXIT) +curl http://localhost:30258/logging-demo/rest/health/health +true + +check records in elasticsearch + +curl http://localhost:30254/_search?q=* +{"took":3,"timed_out":false,"_shards":{"total":21,"successful":21,"failed":0},"hits":{"total":2385953....... + + diff --git a/reference/logging-kubernetes/logdemonode/charts/logdemonode/Chart.yaml b/reference/logging-kubernetes/logdemonode/charts/logdemonode/Chart.yaml new file mode 100644 index 0000000..a8cbcf9 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/charts/logdemonode/Chart.yaml @@ -0,0 +1,18 @@ +# Copyright © 2018 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: Logging reference demo node container - use with demo master +name: logdemonode +version: 2.0.0 diff --git a/reference/logging-kubernetes/logdemonode/charts/logdemonode/requirements.yaml b/reference/logging-kubernetes/logdemonode/charts/logdemonode/requirements.yaml new file mode 100644 index 0000000..97971aa --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/charts/logdemonode/requirements.yaml @@ -0,0 +1,18 @@ +# Copyright © 2018 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. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' \ No newline at end of file diff --git a/reference/logging-kubernetes/logdemonode/charts/logdemonode/resources/config/log/filebeat/filebeat.yml b/reference/logging-kubernetes/logdemonode/charts/logdemonode/resources/config/log/filebeat/filebeat.yml new file mode 100644 index 0000000..b0d4690 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/charts/logdemonode/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: ["{{.Values.config.logstashServiceName}}.{{.Release.Namespace}}:{{.Values.config.logstashPort}}"] + #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/reference/logging-kubernetes/logdemonode/charts/logdemonode/resources/config/logback.xml b/reference/logging-kubernetes/logdemonode/charts/logdemonode/resources/config/logback.xml new file mode 100644 index 0000000..eddb4a8 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/charts/logdemonode/resources/config/logback.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${logDirectory}/${auditLogName}.log + + ${logDirectory}/${auditLogName}.log.%d + + + ${auditPattern} + + + + + 256 + + + + + ${logDirectory}/${metricsLogName}.log + + ${logDirectory}/${metricsLogName}.log.%d + + + ${metricPattern} + + + + + 256 + + + + + ${logDirectory}/${errorLogName}.log + + ${logDirectory}/${errorLogName}.log.%d + + + INFO + + + ${errorPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}.log + + ${debugLogDirectory}/${debugLogName}.log.%d + + + ${debugPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + diff --git a/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/configmap.yaml b/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/configmap.yaml new file mode 100644 index 0000000..3f60531 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/configmap.yaml @@ -0,0 +1,30 @@ +# Copyright © 2018 Amdocs +# +# 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" . }}-logback-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/logback.xml").AsConfig . | indent 2 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.fullname" . }}-filebeat-configmap + namespace: {{ include "common.namespace" . }} +data: +{{ tpl (.Files.Glob "resources/config/log/filebeat/filebeat.yml").AsConfig . | indent 2 }} + diff --git a/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/deployment.yaml b/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/deployment.yaml new file mode 100644 index 0000000..58ce5f7 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/deployment.yaml @@ -0,0 +1,118 @@ +# 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: + initContainers: +#Example init container for dependency checking + containers: + # side car container + - name: {{ include "common.name" . }}-filebeat-onap + image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + volumeMounts: + - name: {{ include "common.fullname" . }}-filebeat-conf + mountPath: /usr/share/filebeat/filebeat.yml + subPath: filebeat.yml + - name: {{ include "common.fullname" . }}-data-filebeat + mountPath: /usr/share/filebeat/data + - name: {{ include "common.fullname" . }}-logs + mountPath: /var/log/onap + + - name: {{ include "common.name" . }} + image: "{{ include "common.repository" . }}/{{ .Values.image }}" + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} +# args: +# - "-Dcom.att.eelf.logging.file=file:/opt/logdemonode/logback.xml" +# - "" + ports: + - containerPort: {{ .Values.service.internalPort }} + # disable liveness probe when breakpoints set in debugger + # so K8s doesn't restart unresponsive container + {{ if .Values.liveness.enabled }} + 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: +#Example environment variable passed to container +# - name: DEBUG_FLAG +# value: {{ .Values.global.debugEnabled | default .Values.debugEnabled | quote }} + volumeMounts: + - name: {{ include "common.fullname" . }}-logs + mountPath: /var/log/onap + - name: {{ include "common.fullname" . }}-logs-config + mountPath: /opt/logback.xml + subPath: logback.xml + - mountPath: /etc/localtime + name: localtime + readOnly: true +#Example config file mount into container +# - mountPath: /opt/app/application.properties +# name: {{ include "common.name" . }}-config +# subPath: application.properties + 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: localtime + hostPath: + path: /etc/localtime +#Example config file mount into container + - name: {{ include "common.fullname" . }}-logs-config + configMap: + name: {{ include "common.fullname" . }}-logback-configmap + items: + - key: logback.xml + path: logback.xml + - name: {{ include "common.fullname" . }}-filebeat-conf + configMap: + name: {{ include "common.fullname" . }}-filebeat-configmap + - name: {{ include "common.fullname" . }}-data-filebeat + emptyDir: {} + - name: {{ include "common.fullname" . }}-logs + emptyDir: {} + imagePullSecrets: + - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/service.yaml b/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/service.yaml new file mode 100644 index 0000000..e77f3b3 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/charts/logdemonode/templates/service.yaml @@ -0,0 +1,53 @@ +# 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 }} + annotations: +# Example MSB registration annotation +# msb.onap.org/service-info: '[ +# { +# "serviceName": "so", +# "version": "v1", +# "url": "/ecomp/mso/infra", +# "protocol": "REST" +# "port": "8080", +# "visualRange":"1" +# } +# ]' +spec: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.externalPort }} + #Example internal target port if required + #targetPort: {{ .Values.service.internalPort }} + nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }} + name: {{ .Values.service.portName | default "http" }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.portName | default "http" }} + {{- end}} + selector: + app: {{ include "common.name" . }} + release: {{ .Release.Name }} diff --git a/reference/logging-kubernetes/logdemonode/charts/logdemonode/values.yaml b/reference/logging-kubernetes/logdemonode/charts/logdemonode/values.yaml new file mode 100644 index 0000000..8772954 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/charts/logdemonode/values.yaml @@ -0,0 +1,100 @@ +# Copyright © 2018 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. + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + #repository: nexus3.onap.org:10001 + repository: oomk8s +# readinessRepository: oomk8s +# readinessImage: readiness-check:2.0.0 +# loggingRepository: docker.elastic.co +# loggingImage: beats/filebeat:5.5.0 + +################################################################# +# Application configuration defaults. +################################################################# +# application image +#repository: nexus3.onap.org:10001 +repository: oomk8s +image: logging-demo-nbi:0.0.3 +pullPolicy: Always + +# flag to enable debugging - application support required +debugEnabled: false + +# application configuration +# Example: +config: + logstashServiceName: log-ls + logstashPort: 5044 + +# 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 + +#Example service definition with external, internal and node ports. +service: + # The default service name (exposed in the service.yaml) will be the same + # name as the chart. If the service name needs to be overriden (such as + # when a subchart is shared), uncomment the value below. + #name: + + #Services may use any combination of ports depending on the 'type' of + #service being defined. + type: NodePort + externalPort: 8080 + internalPort: 8080 + nodePort: 58 + # optional port name override - default can be defined in service.yaml + #portName: http + +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/reference/logging-kubernetes/logdemonode/requirements.yaml b/reference/logging-kubernetes/logdemonode/requirements.yaml new file mode 100644 index 0000000..97971aa --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/requirements.yaml @@ -0,0 +1,18 @@ +# Copyright © 2018 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. + +dependencies: + - name: common + version: ~2.0.0 + repository: '@local' \ No newline at end of file diff --git a/reference/logging-kubernetes/logdemonode/resources/config/README.txt b/reference/logging-kubernetes/logdemonode/resources/config/README.txt new file mode 100644 index 0000000..5cc0149 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/resources/config/README.txt @@ -0,0 +1,10 @@ +This directory contains all external configuration files that +need to be mounted into an application container. + +See the configmap.yaml in the templates directory for an example +of how to load (ie map) config files from this directory, into +Kubernetes, for distribution within the k8s cluster. + +See deployment.yaml in the templates directory for an example +of how the 'config mapped' files are then mounted into the +containers. diff --git a/reference/logging-kubernetes/logdemonode/resources/config/application.properties b/reference/logging-kubernetes/logdemonode/resources/config/application.properties new file mode 100644 index 0000000..496a15a --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/resources/config/application.properties @@ -0,0 +1 @@ +sampleConfigKey=sampleConfigValue \ No newline at end of file diff --git a/reference/logging-kubernetes/logdemonode/values.yaml b/reference/logging-kubernetes/logdemonode/values.yaml new file mode 100644 index 0000000..ea74553 --- /dev/null +++ b/reference/logging-kubernetes/logdemonode/values.yaml @@ -0,0 +1,44 @@ +# Copyright © 2018 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. + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefix: 302 + #repository: nexus3.onap.org:10001 + repository: oomk8s + readinessRepository: oomk8s + readinessImage: readiness-check:2.0.0 + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + +#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/reference/logging-kubernetes/logdemoservice/Chart.yaml b/reference/logging-kubernetes/logdemoservice/Chart.yaml deleted file mode 100644 index b9eed13..0000000 --- a/reference/logging-kubernetes/logdemoservice/Chart.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -description: A Helm chart for Kubernetes -name: logdemoservice -version: 0.1.0 diff --git a/reference/logging-kubernetes/logdemoservice/templates/all-services.yaml b/reference/logging-kubernetes/logdemoservice/templates/all-services.yaml deleted file mode 100644 index 10b7109..0000000 --- a/reference/logging-kubernetes/logdemoservice/templates/all-services.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - labels: - app: logdemoservice - name: logdemoservice - namespace: "{{ .Values.nsPrefix }}-logdemoservice" -spec: - ports: - - port: 8080 - nodePort: {{ .Values.nodePortPrefix }}98 - selector: - app: logdemoservice - type: NodePort diff --git a/reference/logging-kubernetes/logdemoservice/templates/log-mock-demo-service-deployment.yaml b/reference/logging-kubernetes/logdemoservice/templates/log-mock-demo-service-deployment.yaml deleted file mode 100644 index f40da2f..0000000 --- a/reference/logging-kubernetes/logdemoservice/templates/log-mock-demo-service-deployment.yaml +++ /dev/null @@ -1,57 +0,0 @@ -#{{ if not .Values.disableLogdemoserviceLogdemoservice }} -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: logdemoservice - namespace: "{{ .Values.nsPrefix }}-logdemoservice" -spec: - selector: - matchLabels: - app: logdemoservice - template: - metadata: - labels: - app: logdemoservice - name: logdemoservice - spec: - containers: - - image: {{ .Values.image.logdemoservice }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: logdemoservice - volumeMounts: - - mountPath: /var/log/onap - name: log-mock-demo-service-logs - ports: - - containerPort: 8080 - readinessProbe: - tcpSocket: - port: 8080 - initialDelaySeconds: 5 - periodSeconds: 10 - - image: {{ .Values.image.filebeat }} - imagePullPolicy: {{ .Values.pullPolicy }} - name: filebeat-onap - volumeMounts: - - mountPath: /usr/share/filebeat/filebeat.yml - name: filebeat-conf - - mountPath: /var/log/onap - name: log-mock-demo-service-logs - - mountPath: /usr/share/filebeat/data - name: log-mock-demo-service-data-filebeat - volumes: - - name: filebeat-conf - hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/log/filebeat/logback/filebeat.yml - - name: log-mock-demo-service-logs - emptyDir: {} - - name: log-mock-demo-service-data-filebeat - emptyDir: {} - - name: localtime - hostPath: - path: /etc/localtime - - name: logdemoservice-eteshare - hostPath: - path: /dockerdata-nfs/{{ .Values.nsPrefix }}/logdemoservice/eteshare - imagePullSecrets: - - name: "{{ .Values.nsPrefix }}-docker-registry-key" -#{{ end }} diff --git a/reference/logging-kubernetes/logdemoservice/values.yaml b/reference/logging-kubernetes/logdemoservice/values.yaml deleted file mode 100644 index 3b89a4b..0000000 --- a/reference/logging-kubernetes/logdemoservice/values.yaml +++ /dev/null @@ -1,7 +0,0 @@ -nsPrefix: onap -pullPolicy: Always -nodePortPrefix: 302 -image: - readiness: oomk8s/readiness-check:1.0.0 - logdemoservice: oomk8s/logging-demo-service:0.0.1 - filebeat: docker.elastic.co/beats/filebeat:5.5.0 -- cgit 1.2.3-korg