@@ -101,6 +101,24 @@ usage() {
101
101
variable in the yaml|yml|json template.
102
102
Available only in hiera
103
103
104
+ -d | --product <product> : The product will be checked from hiera. If no values are
105
+ found in hiera the variables will not be replaced.
106
+ NOT PART OF projects FILE STRUCTURE but can be added as
107
+ variable in the yaml|yml|json template.
108
+ Available only in hiera
109
+
110
+ -r | --role <role> : The role will be checked from hiera. If no values are
111
+ found in hiera the variables will not be replaced.
112
+ NOT PART OF projects FILE STRUCTURE but can be added as
113
+ variable in the yaml|yml|json template.
114
+ Available only in hiera
115
+
116
+ -n | --namespace <namespace> : The namespace will be checked from hiera. If no values are
117
+ found in hiera the variables will not be replaced.
118
+ NOT PART OF projects FILE STRUCTURE but can be added as
119
+ variable in the yaml|yml|json template.
120
+ Available only in hiera
121
+
104
122
-t | --template <template> : The templates folder can be configured on the k8comp.conf.
105
123
The base location is on the projects folder.
106
124
Can be used in conjunction with any of the main variables.
@@ -209,6 +227,30 @@ while [ $# -gt 0 ]; do
209
227
shift
210
228
fi
211
229
;;
230
+ -d|--product|product)
231
+ if [ -n " $2 " ]; then
232
+ product=$2
233
+ hrd=" product=${2} "
234
+ hrall+=" ${hrd} "
235
+ shift
236
+ fi
237
+ ;;
238
+ -r|--role|role)
239
+ if [ -n " $2 " ]; then
240
+ role=$2
241
+ hrr=" role=${2} "
242
+ hrall+=" ${hrr} "
243
+ shift
244
+ fi
245
+ ;;
246
+ -n|--namespace|namespace)
247
+ if [ -n " $2 " ]; then
248
+ namespace=$2
249
+ hrm=" namespace=${2} "
250
+ hrall+=" ${hrm} "
251
+ shift
252
+ fi
253
+ ;;
212
254
-l|--location|location)
213
255
if [ -n " $2 " ]; then
214
256
location=$2
@@ -342,6 +384,33 @@ kube_vars(){
342
384
evar=$find_var
343
385
h_environment=${evar##* =}
344
386
fi
387
+ elif [[ " ${i%% =* } " == " product" ]]
388
+ then
389
+ if [ -z $find_var ]
390
+ then
391
+ h_product=$product
392
+ else
393
+ evar=$find_var
394
+ h_product=${evar##* =}
395
+ fi
396
+ elif [[ " ${i%% =* } " == " role" ]]
397
+ then
398
+ if [ -z $find_var ]
399
+ then
400
+ h_role=$role
401
+ else
402
+ evar=$find_var
403
+ h_role=${evar##* =}
404
+ fi
405
+ elif [[ " ${i%% =* } " == " namespace" ]]
406
+ then
407
+ if [ -z $find_var ]
408
+ then
409
+ h_namespace=$namespace
410
+ else
411
+ evar=$find_var
412
+ h_namespace=${evar##* =}
413
+ fi
345
414
elif [[ " ${i%% =* } " == " location" ]]
346
415
then
347
416
if [ -z $find_var ]
@@ -440,6 +509,9 @@ replace_var() {
440
509
sed -i " s|%{project}|${h_project} |g" ${tmp_file}
441
510
sed -i " s|%{application}|${h_application} |g" ${tmp_file}
442
511
sed -i " s|%{environment}|${h_environment} |g" ${tmp_file}
512
+ sed -i " s|%{product}|${h_product} |g" ${tmp_file}
513
+ sed -i " s|%{role}|${h_role} |g" ${tmp_file}
514
+ sed -i " s|%{namespace}|${h_namespace} |g" ${tmp_file}
443
515
sed -i " s|%{location}|${h_location} |g" ${tmp_file}
444
516
}
445
517
0 commit comments