blob: 03c8d5d87f8e8633eb34b8db2ebeafaf7857fd73 [file] [log] [blame]
#!/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 /usr/lib/python3/dist-packages/osm_lcm/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