blob: 03c8d5d87f8e8633eb34b8db2ebeafaf7857fd73 [file] [log] [blame]
almagiacdd20ae2024-12-13 09:45:45 +01001#!/bin/bash
2#######################################################################################
3# Copyright ETSI Contributors and Others.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14# implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#######################################################################################
18# Default values for osm.
19# This is a YAML-formatted file.
20# Declare variables to be passed into your templates.
21
22dirname="podlabels-"$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13)
23
24mkdir /tmp/$dirname && cd /tmp/$dirname
25
garciadeblas19adba12024-12-20 14:37:22 +010026cp /usr/lib/python3/dist-packages/osm_lcm/n2vc/post-renderer-scripts/podLabels/kustomization.yaml .
almagiacdd20ae2024-12-13 09:45:45 +010027
28cat <&0 > all.yaml
29
30IFS=' ' read -r -a labels <<< "$1"
31content="commonLabels:"
32for label in "${labels[@]}"; do
33 key=$(echo "$label" | cut -d':' -f1)
34 value=$(echo "$label" | cut -d':' -f2)
35 content="$content
36 $key: $value"
37done
38
39# Add content to the file
40echo -e "\n$content" >> kustomization.yaml
41
42kubectl kustomize && cd .. && rm -r /tmp/$dirname