VES collector's init container patched to download additional files and update the schema-map accordingly.
Issue-ID: NONRTRIC-1020
Change-Id: I3e6fbd78e18e20898c0ba679c2b97d4f408e8dc3
Signed-off-by: aravind.est <aravindhan.a@est.tech>
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2025 OpenInfra Foundation Europe. 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============================================
+#
+
+# This will add additional configuration to ves-collector deployment.
+
+kubectl patch deployment onap-dcae-ves-collector -n onap --type=json \
+ -p='[{"op": "replace", "path": "/spec/template/spec/initContainers/0/command", "value": ["sh", "-c", "
+ cp -R /opt/app/VESCollector/etc/. /opt/app/VESCollector/etc_rw/;
+
+ REL_18_FOLDER=/opt/app/VESCollector/etc_rw/externalRepo/3gpp/rep/sa5/MnS/blob/Rel-18/OpenAPI;
+ mkdir -p $REL_18_FOLDER;
+ wget https://forge.3gpp.org/rep/sa5/MnS/-/archive/Rel-18/MnS-Rel-18.tar?path=OpenAPI -O $REL_18_FOLDER/MnS-Rel-18.tar;
+ tar -tf $REL_18_FOLDER/MnS-Rel-18.tar | grep '\.yaml$' | xargs tar -xf $REL_18_FOLDER/MnS-Rel-18.tar --strip-components 2 -C $REL_18_FOLDER/;
+ rm $REL_18_FOLDER/MnS-Rel-18.tar;
+
+ for file in $REL_18_FOLDER/*.yaml; do
+ filename=$(basename $file);
+ schemaElement=\'{\\"publicURL\\": \\"https://forge.3gpp.org/rep/sa5/MnS/blob/Rel-18/OpenAPI/\'$filename\'\\",\\"localURL\\": \\"3gpp/rep/sa5/MnS/blob/Rel-18/OpenAPI/\'$filename\'\\"}\';
+ if [ -z \\"$schemaElementStr\\" ]; then
+ schemaElementStr=\\"$schemaElement\\";
+ else
+ schemaElementStr=\\"$schemaElementStr,$schemaElement\\";
+ fi;
+ done;
+ echo \\"schemaElementStr=\\"$schemaElementStr\\"\\";
+
+ if [ -n \\"$schemaElementStr\\" ]; then
+ sed -i \\"$ s|]|,${schemaElementStr}]|\\" /opt/app/VESCollector/etc_rw/externalRepo/schema-map.json;
+ fi;
+"]}]'
+
+
--- /dev/null
+# ============LICENSE_START===============================================
+# Copyright (C) 2025 OpenInfra Foundation Europe. 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: v1
+kind: ConfigMap
+metadata:
+ name: vescollector-patch-config
+ annotations:
+ "helm.sh/hook": pre-install
+ "helm.sh/hook-weight": "2"
+data:
+{{ tpl (.Files.Glob "resources/patch-ves-collector.sh").AsConfig . | indent 2 }}
\ No newline at end of file
--- /dev/null
+# ============LICENSE_START===============================================
+# Copyright (C) 2025 OpenInfra Foundation Europe. 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: v1
+kind: ServiceAccount
+metadata:
+ name: vescollector-patch-sa
+ namespace: smo
+ annotations:
+ "helm.sh/hook": pre-install
+ "helm.sh/hook-weight": "1"
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ name: vescollector-patch-role
+ annotations:
+ "helm.sh/hook": pre-install
+ "helm.sh/hook-weight": "1"
+rules:
+ - apiGroups: ['kafka.strimzi.io']
+ resources: ['kafkausers']
+ verbs: ["get","list","watch","patch","update"]
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ name: vescollector-patch-rb
+ namespace: onap
+ annotations:
+ "helm.sh/hook": pre-install
+ "helm.sh/hook-weight": "1"
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: vescollector-patch-role
+subjects:
+- kind: ServiceAccount
+ name: vescollector-patch-sa
+ namespace: smo
\ No newline at end of file
--- /dev/null
+################################################################################
+# Copyright (C) 2025 OpenInfra Foundation Europe #
+# #
+# 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: batch/v1
+kind: Job
+metadata:
+ name: vescollector-patch
+ annotations:
+ "helm.sh/hook": pre-install
+ "helm.sh/hook-weight": "4"
+spec:
+ template:
+ spec:
+ serviceAccountName: vescollector-patch-sa
+ containers:
+ - name: vescollector-patch-container
+ image: bitnami/kubectl:1.32.2
+ command: ["bash","/scripts/patch-ves-collector.sh"]
+ securityContext:
+ allowPrivilegeEscalation: false
+ runAsUser: 0
+ volumeMounts:
+ - name: vescollector-patch-config-volume
+ mountPath: /scripts
+ volumes:
+ - name: vescollector-patch-config-volume
+ configMap:
+ name: vescollector-patch-config
+ defaultMode: 0755
+ restartPolicy: Never