Feature 10991: Gather information relating to the KNF being deployed and inject it as labels in the Kubernetes objects

Change-Id: I5d78de8f369bd893a4a05287763909d2fe360b06
Signed-off-by: Pedro Pereira <pedrocjdpereira@av.it.pt>
diff --git a/n2vc/post-renderer-scripts/podLabels/kustomization.yaml b/n2vc/post-renderer-scripts/podLabels/kustomization.yaml
new file mode 100644
index 0000000..358978b
--- /dev/null
+++ b/n2vc/post-renderer-scripts/podLabels/kustomization.yaml
@@ -0,0 +1,23 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# 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.
+#######################################################################################
+# Default values for osm.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+resources:
+- all.yaml
\ No newline at end of file
diff --git a/n2vc/post-renderer-scripts/podLabels/podLabels b/n2vc/post-renderer-scripts/podLabels/podLabels
new file mode 100755
index 0000000..0eb2a64
--- /dev/null
+++ b/n2vc/post-renderer-scripts/podLabels/podLabels
@@ -0,0 +1,42 @@
+#!/bin/bash
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# 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.
+#######################################################################################
+# Default values for osm.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+
+dirname="podlabels-"$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13)
+
+mkdir /tmp/$dirname && cd /tmp/$dirname
+
+cp /app/N2VC/n2vc/post-renderer-scripts/podLabels/kustomization.yaml .
+
+cat <&0 > all.yaml
+
+IFS=' ' read -r -a labels <<< "$1"
+content="commonLabels:"
+for label in "${labels[@]}"; do
+    key=$(echo "$label" | cut -d':' -f1)
+    value=$(echo "$label" | cut -d':' -f2)
+    content="$content
+  $key: $value"
+done
+
+# Add content to the file
+echo -e "\n$content" >> kustomization.yaml
+
+kubectl kustomize && cd .. && rm -r /tmp/$dirname
\ No newline at end of file