Files
inji-wallet/deploy/uitestrig/copy_cm_func.sh
Abhishek S ff9ee7184f [MOSIP-43100] Added Injiwallet uitestrigs (#2143)
* [MOSIP-43100] Added Injiwallet uitestrigs

Signed-off-by: Abhi <abhishek.shankarcs@gmail.com>

* [MOSIP-43100] Added Injiwallet uitestrigs

Signed-off-by: Abhi <abhishek.shankarcs@gmail.com>

* [MOSIP-43100] Added Injiwallet uitestrigs

Signed-off-by: Abhi <abhishek.shankarcs@gmail.com>

* [MOSIP-43100] Added Injiwallet uitestrigs

Signed-off-by: Abhi <abhishek.shankarcs@gmail.com>

* [MOSIP-43100] Added Injiwallet uitestrigs

Signed-off-by: Abhi <abhishek.shankarcs@gmail.com>

---------

Signed-off-by: Abhi <abhishek.shankarcs@gmail.com>
2025-11-27 11:53:17 +05:30

29 lines
912 B
Bash
Executable File

#!/bin/bash
# Copy configmap and secret from one namespace to another.
# ./copy_cm_func.sh <resource> <configmap_name> <source_namespace> <destination_namespace> [name]
# Parameters:
# resource: configmap|secret
# name: Optional new name of the configmap or secret in destination namespace. This may be needed if there is
# clash of names
if [ $1 = "configmap" ]
then
RESOURCE=configmap
elif [ $1 = "secret" ]
then
RESOURCE=secret
else
echo "Incorrect resource $1. Exiting.."
exit 1
fi
if [ $# -ge 5 ]
then
kubectl -n $4 delete --ignore-not-found=true $RESOURCE $5
kubectl -n $3 get $RESOURCE $2 -o yaml | sed "s/namespace: $3/namespace: $4/g" | sed "s/name: $2/name: $5/g" | kubectl -n $4 create -f -
else
kubectl -n $4 delete --ignore-not-found=true $RESOURCE $2
kubectl -n $3 get $RESOURCE $2 -o yaml | sed "s/namespace: $3/namespace: $4/g" | kubectl -n $4 create -f -
fi