diff options
Diffstat (limited to 'archive/holmes/components/holmes-engine-mgmt')
11 files changed, 556 insertions, 0 deletions
diff --git a/archive/holmes/components/holmes-engine-mgmt/.helmignore b/archive/holmes/components/holmes-engine-mgmt/.helmignore new file mode 100644 index 0000000000..50af031725 --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/.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 +.vscode/ diff --git a/archive/holmes/components/holmes-engine-mgmt/Chart.yaml b/archive/holmes/components/holmes-engine-mgmt/Chart.yaml new file mode 100644 index 0000000000..df7f2c0c72 --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/Chart.yaml @@ -0,0 +1,35 @@ +# Modifications Copyright © 2021 ZTE +# Modifications Copyright © 2021 Orange +# Modifications Copyright © 2021 Nordix Foundation +# +# 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: v2 +appVersion: "2.0" +description: Holmes Engine Management +name: holmes-engine-mgmt +version: 13.0.0 + +dependencies: + - name: common + version: ~13.x-0 + repository: '@local' + - name: repositoryGenerator + version: ~13.x-0 + repository: '@local' + - name: readinessCheck + version: ~13.x-0 + repository: '@local' + - name: serviceAccount + version: ~13.x-0 + repository: '@local'
\ No newline at end of file diff --git a/archive/holmes/components/holmes-engine-mgmt/resources/config/application.yaml b/archive/holmes/components/holmes-engine-mgmt/resources/config/application.yaml new file mode 100644 index 0000000000..34c4024059 --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/resources/config/application.yaml @@ -0,0 +1,18 @@ +server: + port: 9102 + servlet: + context-path: /api/holmes-engine-mgmt/v1 + +logging: + config: classpath:logback-spring.xml + +spring: + application: + name: Holmes Engine Management + datasource: + dirver-class-name: org.postgresql.Driver + url: jdbc:postgresql://${URL_JDBC}:${DB_PORT}/${DB_NAME} + username: ${JDBC_USERNAME} + password: ${JDBC_PASSWORD} + mvc: + throw-exception-if-no-handler-found: true
\ No newline at end of file diff --git a/archive/holmes/components/holmes-engine-mgmt/resources/config/cfy.json b/archive/holmes/components/holmes-engine-mgmt/resources/config/cfy.json new file mode 100644 index 0000000000..dfa58b098f --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/resources/config/cfy.json @@ -0,0 +1,19 @@ +{ + "services_calls": {}, + "streams_publishes": { + "dcae_cl_out": { + "dmaap_info": { + "topic_url": "http://message-router.onap:3904/events/unauthenticated.DCAE_CL_OUTPUT" + }, + "type": "message_router" + } + }, + "streams_subscribes": { + "ves_fault": { + "dmaap_info": { + "topic_url": "http://message-router.onap:3904/events/unauthenticated.SEC_FAULT_OUTPUT" + }, + "type": "message_router" + } + } +} diff --git a/archive/holmes/components/holmes-engine-mgmt/resources/config/engine-d.yml b/archive/holmes/components/holmes-engine-mgmt/resources/config/engine-d.yml new file mode 100644 index 0000000000..9a16390856 --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/resources/config/engine-d.yml @@ -0,0 +1,72 @@ +# +# Copyright 2017 ZTE Corporation. +# +# 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. +# +server: + type: simple + rootPath: '/api/holmes-engine-mgmt/v1/*' + applicationContextPath: / + adminContextPath: /admin + connector: + type: http + port: 9102 + validateCerts: false + validatePeers: false + + +# Logging settings. +logging: + + # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL. + level: INFO + + # Logger-specific levels. + loggers: + + # Sets the level for 'com.example.app' to DEBUG. + org.onap.holmes.engine: ALL + + appenders: + - type: console + threshold: INFO + timeZone: UTC + logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] invocationID:{InvocationID} - %m%n" + - type: file + threshold: ERROR + logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] invocationID:{InvocationID} - %m%n" + currentLogFilename: /var/log/ONAP/holmes/engine-d-error.log + archivedLogFilenamePattern: /var/log/ONAP/holmes/zip/engine-d-error-%d{yyyy-MM-dd}.log.gz + archivedFileCount: 7 + - type: file + threshold: INFO + logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] invocationID:{InvocationID} - %m%n" + currentLogFilename: /var/log/ONAP/holmes/engine-d-debug.log + archivedLogFilenamePattern: /var/log/ONAP/holmes/zip/engine-d-debug-%d{yyyy-MM-dd}.log.gz + archivedFileCount: 7 + + +database: + driverClass: org.postgresql.Driver + user: ${JDBC_USERNAME} + password: ${JDBC_PASSWORD} + url: jdbc:postgresql://${URL_JDBC}:${DB_PORT}/${DB_NAME} + properties: + charSet: UTF-8 + maxWaitForConnection: 1s + validationQuery: "/* MyService Health Check */ SELECT 1" + minSize: 8 + maxSize: 100 + checkConnectionWhileIdle: false + evictionInterval: 10s + minIdleTime: 1s diff --git a/archive/holmes/components/holmes-engine-mgmt/resources/config/onap-holmes_engine-createobj.sql b/archive/holmes/components/holmes-engine-mgmt/resources/config/onap-holmes_engine-createobj.sql new file mode 100644 index 0000000000..e5eecb1a5a --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/resources/config/onap-holmes_engine-createobj.sql @@ -0,0 +1,50 @@ +-- +-- Copyright 2017 ZTE Corporation. +-- +-- 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. +-- +\c postgres + +/******************CREATE NEW DATABASE AND USER***************************/ +CREATE DATABASE ${DB_NAME}; + +CREATE ROLE ${JDBC_USERNAME} with PASSWORD '${JDBC_PASSWORD}' LOGIN; + +\encoding UTF8; + +/******************CREATE NEW TABLE***************************/ +\c ${DB_NAME}; + +CREATE TABLE IF NOT EXISTS ALARM_INFO ( + EVENTID VARCHAR(150) NOT NULL, + EVENTNAME VARCHAR(150) NOT NULL, + ALARMISCLEARED SMALLINT NOT NULL, + ROOTFLAG SMALLINT NOT NULL, + STARTEPOCHMICROSEC BIGINT NOT NULL, + LASTEPOCHMICROSEC BIGINT NOT NULL, + SOURCEID VARCHAR(150) NOT NULL, + SOURCENAME VARCHAR(150) NOT NULL, + SEQUENCE SMALLINT NOT NULL, + PRIMARY KEY (EVENTID, SEQUENCE, SOURCENAME) +); + +CREATE TABLE IF NOT EXISTS ENGINE_ENTITY ( + ID VARCHAR(150) NOT NULL, + IP VARCHAR(128) NOT NULL, + PORT SMALLINT NOT NULL, + LASTMODIFIED BIGINT NOT NULL, + PRIMARY KEY (ID) +); + +GRANT ALL PRIVILEGES ON ALARM_INFO TO ${JDBC_USERNAME}; +GRANT ALL PRIVILEGES ON ENGINE_ENTITY TO ${JDBC_USERNAME}; diff --git a/archive/holmes/components/holmes-engine-mgmt/templates/configmap.yaml b/archive/holmes/components/holmes-engine-mgmt/templates/configmap.yaml new file mode 100644 index 0000000000..76b339faea --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/templates/configmap.yaml @@ -0,0 +1,21 @@ +{{/* +# Copyright © 2017 Amdocs, Bell Canada +# Modifications Copyright © 2019 AT&T +# +# 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: {{- include "common.resourceMetadata" . | nindent 2 }} +data: {{ tpl (.Files.Glob "resources/config/*").AsConfig . | nindent 2 }} diff --git a/archive/holmes/components/holmes-engine-mgmt/templates/deployment.yaml b/archive/holmes/components/holmes-engine-mgmt/templates/deployment.yaml new file mode 100644 index 0000000000..641f032ce4 --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/templates/deployment.yaml @@ -0,0 +1,145 @@ +{{/* +#============LICENSE_START======================================================== +# ================================================================================ +# Copyright (c) 2021 ZTE 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========================================================= +*/}} + +apiVersion: apps/v1 +kind: Deployment +metadata: {{- include "common.resourceMetadata" . | nindent 2 }} +{{- $sum := "" }} +{{- range $path, $bytes := .Files.Glob "resources/config/*.json"}} +{{- $sum = $.Files.Get $path | sha256sum | print $sum }} +{{- end }} + annotations: + checksum/config: {{ $sum | sha256sum }} + +spec: + replicas: 1 + selector: {{- include "common.selectors" . | nindent 4 }} + template: + metadata: {{- include "common.templateMetadata" . | nindent 6 }} + spec: + initContainers: + {{- if .Values.global.postgres.localCluster }} + {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_local ) | indent 6 | trim }} + {{ else }} + {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_global ) | indent 6 | trim }} + {{- end }} + - name: {{ include "common.name" . }}-env-config + image: {{ include "repositoryGenerator.image.envsubst" . }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + command: + - sh + args: + - -c + - "cd /hemconfig && for PFILE in `find . -type f -not -name '*.json'`; do envsubst < ${PFILE} > /config/${PFILE##*/}; done" + env: + - name: JDBC_USERNAME + {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }} + - name: JDBC_PASSWORD + {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} + - name: DB_NAME + value: {{ .Values.config.pgConfig.dbName }} + - name: URL_JDBC + value: {{ .Values.config.pgConfig.dbHost }} + - name: DB_PORT + value: "{{ .Values.config.pgConfig.dbPort }}" + - name: AAI_ADDR + value: aai + - name: AAI_PORT + value: "{{ .Values.config.aai.aaiPort }}" + - name: AAI_USERNAME + value: {{ .Values.config.aai.username }} + - name: AAI_PASSWORD + value: {{ .Values.config.aai.password }} + - name: NAMESPACE + value: {{ include "common.namespace" . }} + volumeMounts: + - mountPath: /hemconfig + name: {{ include "common.fullname" . }}-config + - mountPath: /config + name: {{ include "common.fullname" . }}-env-config + containers: + - name: {{ include "common.name" . }} + image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} + imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} + resources: {{ include "common.resources" . | nindent 10 }} + ports: {{ include "common.containerPorts" . | nindent 10 }} + volumeMounts: + - name: {{ include "common.fullname" . }}-env-config + mountPath: /opt/hemconfig + - name: {{ include "common.fullname" . }}-config + mountPath: /opt/hemtopics + # disable liveness probe when breakpoints set in debugger + # so K8s doesn't restart unresponsive container + {{- if eq .Values.liveness.enabled true }} + livenessProbe: + httpGet: + path: {{ .Values.liveness.path }} + port: {{ .Values.liveness.port }} + scheme: {{ .Values.liveness.scheme }} + initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.liveness.periodSeconds }} + {{- end }} + readinessProbe: + httpGet: + path: {{ .Values.readiness.path }} + port: {{ .Values.readiness.port }} + scheme: {{ .Values.readiness.scheme }} + initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.readiness.periodSeconds }} + failureThreshold: 1 + successThreshold: 1 + timeoutSeconds: 1 + env: + - name: CONSUL_HOST + value: consul-server.{{ include "common.namespace" . }} + - name: CONFIG_BINDING_SERVICE + value: config-binding-service + - name: MSB_IAG_SERVICE_PROTOCOL + value: {{ .Values.global.msbProtocol }} + - name: MSB_IAG_SERVICE_HOST + value: {{ .Values.global.msbServiceName }}.{{ include "common.namespace" . }} + - name: MSB_IAG_SERVICE_PORT + value: {{ .Values.global.msbPort | quote }} + - name: POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + - name: PGPASSWORD + {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} + - name: JDBC_USERNAME + {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "login") | indent 10 }} + - name: JDBC_PASSWORD + {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "pg-user-creds" "key" "password") | indent 10 }} + - name: DB_NAME + value: {{ .Values.config.pgConfig.dbName }} + - name: URL_JDBC + value: {{ .Values.config.pgConfig.dbHost }} + - name: DB_PORT + value: "{{ .Values.config.pgConfig.dbPort }}" + serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} + volumes: + - name: {{ include "common.fullname" . }}-config + configMap: + defaultMode: 422 + name: {{ include "common.fullname" . }} + - name: {{ include "common.fullname" . }}-env-config + emptyDir: + medium: Memory + {{- include "common.imagePullSecrets" . | nindent 6 }} diff --git a/archive/holmes/components/holmes-engine-mgmt/templates/secret.yaml b/archive/holmes/components/holmes-engine-mgmt/templates/secret.yaml new file mode 100644 index 0000000000..34932b713d --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/templates/secret.yaml @@ -0,0 +1,17 @@ +{{/* +# Copyright © 2020 Samsung Electronics +# +# 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. +*/}} + +{{ include "common.secretFast" . }} diff --git a/archive/holmes/components/holmes-engine-mgmt/templates/service.yaml b/archive/holmes/components/holmes-engine-mgmt/templates/service.yaml new file mode 100644 index 0000000000..70abf763e0 --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/templates/service.yaml @@ -0,0 +1,20 @@ +{{/* +#============LICENSE_START======================================================== +# ================================================================================ +# Copyright (c) 2019 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========================================================= +*/}} + +{{ include "common.service" . }} diff --git a/archive/holmes/components/holmes-engine-mgmt/values.yaml b/archive/holmes/components/holmes-engine-mgmt/values.yaml new file mode 100644 index 0000000000..bd06bcd1ee --- /dev/null +++ b/archive/holmes/components/holmes-engine-mgmt/values.yaml @@ -0,0 +1,137 @@ +#============LICENSE_START======================================================== +# ================================================================================ +# Copyright (c) 2021 ZTE Corporation 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========================================================= + +################################################################# +# Global configuration defaults. +################################################################# +global: + nodePortPrefixExt: 302 + msbProtocol: http + msbServiceName: msb-iag + msbPort: 80 + postgres: + localCluster: false + +################################################################# +# Application configuration defaults. +################################################################# +# application image +image: onap/holmes/engine-management:12.0.1 +consulLoaderImage: onap/org.onap.dcaegen2.deployments.consul-loader-container:1.0.0 + +################################################################# +# Secrets metaconfig +################################################################# +secrets: +- uid: pg-user-creds + type: basicAuth + externalSecret: '{{ tpl (default "" .Values.config.pgConfig.dbUserCredsExternalSecret) . }}' + login: '{{ .Values.config.pgConfig.dbUser }}' + password: '{{ .Values.config.pgConfig.dbUserPassword }}' + +# application configuration +config: + logstashServiceName: log-ls + logstashPort: 5044 + # Addresses of other ONAP entities + address: + consul: + host: consul-server + port: 8500 + pgConfig: + dbName: defaultName + dbHost: defaultHost + dbPort: 1234 + dbUser: admin + dbUserPassword: admin + # dbUserCredsExternalSecret + msb: + serviceName: msb-iag + port: 80 + aai: + aaiPort: 80 + username: AAI + password: AAI + +service: + type: ClusterIP + name: holmes-engine-mgmt + ports: + - name: http-rest + port: &svc_port 9102 + annotations: + msb.onap.org/service-info: | + {{ if .Values.global.msbEnabled -}}[ + { + "serviceName": "holmes-engine-mgmt", + "version": "v1", + "url": "/api/holmes-engine-mgmt/v1", + "path":"/api/holmes-engine-mgmt/v1", + "protocol": "REST", + "visualRange":"0|1", + "port": "9102", + "enable_ssl": false + } + ]{{ end }} + +# probe configuration parameters +liveness: + initialDelaySeconds: 10 + periodSeconds: 10 + path: /api/holmes-engine-mgmt/v1/healthcheck + scheme: HTTP + port: *svc_port + enabled: true + +readiness: + initialDelaySeconds: 30 + periodSeconds: 30 + path: /api/holmes-engine-mgmt/v1/healthcheck + scheme: HTTP + port: *svc_port + +# Segregation for Different environment (Small and Large) +resources: + small: + limits: + cpu: "1" + memory: "1Gi" + requests: + cpu: "0.5" + memory: "1Gi" + large: + limits: + cpu: "2" + memory: "2Gi" + requests: + cpu: "1" + memory: "2Gi" + unlimited: {} + +readinessCheck: + wait_for_global: + jobs: + - '{{ include "common.release" . }}-holmes-postgres-init-config-job' + wait_for_local: + services: + - '{{ .Values.global.postgres.service.name2 }}' + +#Pods Service Account +serviceAccount: + nameOverride: holmes-engine-mgmt + roles: + - read |