From: Li Zi
Date: Fri, 31 Aug 2018 02:01:53 +0000 (+0000)
Subject: Fix the issue fetch log of esr in kibana
X-Git-Tag: 3.0.0-ONAP~286^2
X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F27%2F63927%2F4;p=oom.git
Fix the issue fetch log of esr in kibana
Issue-ID: AAI-756
Change-Id: I6c09dfcfc3c8a0ac5a509a08a84397eca5a53673
Signed-off-by: Li Zi
---
diff --git a/kubernetes/esr/charts/esr-gui/templates/service.yaml b/kubernetes/esr/charts/esr-gui/templates/service.yaml
index f197aa1bea..a847eba66c 100644
--- a/kubernetes/esr/charts/esr-gui/templates/service.yaml
+++ b/kubernetes/esr/charts/esr-gui/templates/service.yaml
@@ -16,7 +16,7 @@
apiVersion: v1
kind: Service
metadata:
- name: {{ .Values.service.name }}
+ name: {{ include "common.servicename" . }}
namespace: {{ include "common.namespace" . }}
labels:
app: {{ include "common.name" . }}
diff --git a/kubernetes/esr/charts/esr-server/Chart.yaml b/kubernetes/esr/charts/esr-server/Chart.yaml
new file mode 100644
index 0000000000..455e341ff9
--- /dev/null
+++ b/kubernetes/esr/charts/esr-server/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: ONAP External System Register GUI
+name: esr-server
+version: 2.0.0
diff --git a/kubernetes/esr/charts/esr-server/requirements.yaml b/kubernetes/esr/charts/esr-server/requirements.yaml
new file mode 100644
index 0000000000..03da823ee4
--- /dev/null
+++ b/kubernetes/esr/charts/esr-server/requirements.yaml
@@ -0,0 +1,21 @@
+# 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
+ # local reference to common chart, as it is
+ # a part of this chart's package and will not
+ # be published independently to a repo (at this point)
+ repository: '@local'
\ No newline at end of file
diff --git a/kubernetes/esr/resources/config/log/filebeat/filebeat.yml b/kubernetes/esr/charts/esr-server/resources/config/log/filebeat/filebeat.yml
similarity index 95%
rename from kubernetes/esr/resources/config/log/filebeat/filebeat.yml
rename to kubernetes/esr/charts/esr-server/resources/config/log/filebeat/filebeat.yml
index d099a4270b..1e6b5cd860 100644
--- a/kubernetes/esr/resources/config/log/filebeat/filebeat.yml
+++ b/kubernetes/esr/charts/esr-server/resources/config/log/filebeat/filebeat.yml
@@ -16,10 +16,9 @@ filebeat.prospectors:
- input_type: log
#This is the canolical path as mentioned in logback.xml, *.* means it will monitor all files in the directory.
paths:
- - /home/esr/works/logs/*.log
-# - /var/log/onap/*/*/*/*.log
-# - /var/log/onap/*/*/*.log
-# - /var/log/onap/*/*.log
+ - /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
diff --git a/kubernetes/esr/charts/esr-server/resources/config/logback.xml b/kubernetes/esr/charts/esr-server/resources/config/logback.xml
new file mode 100644
index 0000000000..c647f3d1e1
--- /dev/null
+++ b/kubernetes/esr/charts/esr-server/resources/config/logback.xml
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${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/kubernetes/esr/templates/NOTES.txt b/kubernetes/esr/charts/esr-server/templates/NOTES.txt
similarity index 79%
rename from kubernetes/esr/templates/NOTES.txt
rename to kubernetes/esr/charts/esr-server/templates/NOTES.txt
index d7c50a9e20..5da4ade3a5 100644
--- a/kubernetes/esr/templates/NOTES.txt
+++ b/kubernetes/esr/charts/esr-server/templates/NOTES.txt
@@ -1,4 +1,4 @@
-# Copyright © 2018 AT&T, Amdocs, Bell Canada Intellectual Property. All rights reserved.
+# 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.
@@ -11,11 +11,15 @@
# 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.
+
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
http://{{ . }}
{{- end }}
+ export NODE_PORT=$(kubectl get --namespace {{ include "common.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "common.name" . }})
+ export NODE_IP=$(kubectl get nodes --namespace {{ include "common.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
+ echo http://$NODE_IP:$NODE_PORT
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ include "common.name" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.namespace" . }} {{ include "common.name" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
diff --git a/kubernetes/esr/templates/configmap.yaml b/kubernetes/esr/charts/esr-server/templates/configmap.yaml
similarity index 82%
rename from kubernetes/esr/templates/configmap.yaml
rename to kubernetes/esr/charts/esr-server/templates/configmap.yaml
index 18a4f84773..10a7a4390a 100644
--- a/kubernetes/esr/templates/configmap.yaml
+++ b/kubernetes/esr/charts/esr-server/templates/configmap.yaml
@@ -16,7 +16,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
- name: {{ include "common.fullname" . }}-esr-filebeat
+ name: {{ include "common.fullname" . }}-log
namespace: {{ include "common.namespace" . }}
labels:
app: {{ include "common.name" . }}
@@ -24,12 +24,12 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
-{{ tpl (.Files.Glob "resources/config/log/filebeat/*").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/logback.xml").AsConfig . | indent 2 }}
---
apiVersion: v1
kind: ConfigMap
metadata:
- name: {{ include "common.fullname" . }}-esr-esrserver-log
+ name: {{ include "common.fullname" . }}-esr-filebeat-configmap
namespace: {{ include "common.namespace" . }}
labels:
app: {{ include "common.name" . }}
@@ -37,4 +37,4 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
-{{ tpl (.Files.Glob "resources/config/log/esrserver/logback.xml").AsConfig . | indent 2 }}
+{{ tpl (.Files.Glob "resources/config/log/filebeat/filebeat.yml").AsConfig . | indent 2 }}
diff --git a/kubernetes/esr/templates/deployment.yaml b/kubernetes/esr/charts/esr-server/templates/deployment.yaml
similarity index 77%
rename from kubernetes/esr/templates/deployment.yaml
rename to kubernetes/esr/charts/esr-server/templates/deployment.yaml
index 3cb568a499..486d67b0f5 100644
--- a/kubernetes/esr/templates/deployment.yaml
+++ b/kubernetes/esr/charts/esr-server/templates/deployment.yaml
@@ -59,7 +59,7 @@ spec:
name: localtime
readOnly: true
- mountPath: /home/esr/works/logs
- name: esr-server-logs
+ name: {{ include "common.fullname" . }}-logs
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- if .Values.nodeSelector }}
@@ -70,31 +70,34 @@ spec:
affinity:
{{ toYaml .Values.affinity | indent 10 }}
{{- end }}
- # side car containers
- - name: filebeat-onap
+ # Filebeat sidecar container
+ - name: {{ include "common.name" . }}-filebeat-onap
image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
volumeMounts:
- - mountPath: /usr/share/filebeat/filebeat.yml
- name: filebeat-conf
+ - name: {{ include "common.fullname" . }}-filebeat-conf
+ mountPath: /usr/share/filebeat/filebeat.yml
subPath: filebeat.yml
- - mountPath: /home/esr/works/logs
- name: esr-server-logs
- - mountPath: /usr/share/filebeat/data
- name: esr-server-filebeat
+ - name: {{ include "common.fullname" . }}-data-filebeat
+ mountPath: /usr/share/filebeat/data
+ - name: {{ include "common.fullname" . }}-logs
+ mountPath: /var/log/onap/esr/esr-server
+ - mountPath: /opt/ajsc/etc/config/logback.xml
+ name: {{ include "common.fullname" . }}-log-conf
+ subPath: logback.xml
volumes:
- name: localtime
hostPath:
path: /etc/localtime
- - name: filebeat-conf
+ - name: {{ include "common.fullname" . }}-log-conf
+ configMap:
+ name: {{ include "common.fullname" . }}-log
+ - name: {{ include "common.fullname" . }}-filebeat-conf
configMap:
- name: {{ include "common.fullname" . }}-esr-filebeat
- - name: esr-server-logs
+ name: {{ include "common.fullname" . }}-esr-filebeat-configmap
+ - name: {{ include "common.fullname" . }}-data-filebeat
emptyDir: {}
- - name: esr-server-filebeat
+ - name: {{ include "common.fullname" . }}-logs
emptyDir: {}
- - name: esrserver-log
- configMap:
- name: {{ include "common.fullname" . }}-esr-esrserver-log
imagePullSecrets:
- name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/esr/templates/service.yaml b/kubernetes/esr/charts/esr-server/templates/service.yaml
similarity index 68%
rename from kubernetes/esr/templates/service.yaml
rename to kubernetes/esr/charts/esr-server/templates/service.yaml
index dfa1ef0c67..d3198f46c3 100644
--- a/kubernetes/esr/templates/service.yaml
+++ b/kubernetes/esr/charts/esr-server/templates/service.yaml
@@ -16,7 +16,7 @@
apiVersion: v1
kind: Service
metadata:
- name: {{ .Values.service.name }}
+ name: {{ include "common.servicename" . }}
namespace: {{ include "common.namespace" . }}
labels:
app: {{ include "common.name" . }}
@@ -36,9 +36,18 @@ metadata:
}
]'
spec:
+ type: {{ .Values.service.type }}
ports:
- - port: {{ .Values.service.internalPort }}
- name: {{ .Values.service.name }}
+ {{if eq .Values.service.type "NodePort" -}}
+ - port: {{ .Values.service.externalPort }}
+ targetPort: {{ .Values.service.internalPort }}
+ nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodePort }}
+ name: {{ .Values.service.portName }}
+ {{- else -}}
+ - port: {{ .Values.service.externalPort }}
+ targetPort: {{ .Values.service.internalPort }}
+ name: {{ .Values.service.portName }}
+ {{- end}}
selector:
app: {{ include "common.name" . }}
- release: {{ .Release.Name }}
+ release: {{ .Release.Name }}
\ No newline at end of file
diff --git a/kubernetes/esr/charts/esr-server/values.yaml b/kubernetes/esr/charts/esr-server/values.yaml
new file mode 100644
index 0000000000..8f66148169
--- /dev/null
+++ b/kubernetes/esr/charts/esr-server/values.yaml
@@ -0,0 +1,85 @@
+# 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.
+
+#################################################################
+# Global configuration defaults.
+#################################################################
+global:
+ nodePortPrefix: 302
+ readinessRepository: oomk8s
+ readinessImage: readiness-check:2.0.0
+ loggingRepository: docker.elastic.co
+ loggingImage: beats/filebeat:5.5.0
+
+subChartsOnly:
+ enabled: true
+
+# application image
+repository: nexus3.onap.org:10001
+image: onap/aai/esr-server:1.1.0
+pullPolicy: Always
+msbaddr: msb-iag.{{ include "common.namespace" . }}:80
+
+# application configuration
+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
+
+service:
+ type: ClusterIP
+ name: esr-server
+ portName: esr-server
+ externalPort: 9518
+ internalPort: 9518
+
+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/esr/values.yaml b/kubernetes/esr/values.yaml
index 8f0ab5eba9..bd123583c6 100644
--- a/kubernetes/esr/values.yaml
+++ b/kubernetes/esr/values.yaml
@@ -17,67 +17,10 @@
# Global configuration defaults.
#################################################################
global:
- nodePortPrefix: 302
- readinessRepository: oomk8s
- readinessImage: readiness-check:2.0.0
loggingRepository: docker.elastic.co
loggingImage: beats/filebeat:5.5.0
-subChartsOnly:
- enabled: true
-
-# application image
-repository: nexus3.onap.org:10001
-image: onap/aai/esr-server:1.1.0
-pullPolicy: Always
-msbaddr: msb-iag.{{ include "common.namespace" . }}:80
-
# application configuration
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
-
-service:
- name: esr
- internalPort: 9518
-
-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
+ logstashPort: 5044
\ No newline at end of file