forked from okteto/create-namespace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·45 lines (36 loc) · 1.07 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
namespace=$1
if [ -z $namespace ]; then
echo "Namespace name is required"
exit 1
fi
if [ ! -z "$OKTETO_CA_CERT" ]; then
echo "Custom certificate is provided"
echo "$OKTETO_CA_CERT" > /usr/local/share/ca-certificates/okteto_ca_cert.crt
update-ca-certificates
fi
members=$2
membersArg=""
IFS=","
for v in $members
do
verify=$(echo $v | egrep -c "[;:!#$%^&*() ]" )
if [ "$verify" -gt 0 ]; then
echo "the members parameters contains invalid characters"
exit 1
fi
membersArg="-m '$v' $membersArg"
done
log_level=$3
if [ ! -z "$log_level" ]; then
log_level="--log-level ${log_level}"
fi
# https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
if [ "${RUNNER_DEBUG}" = "1" ]; then
log_level="--log-level debug"
fi
echo running: okteto namespace create $namespace $membersArg $log_level
eval okteto namespace create $namespace $membersArg $log_level
echo running: okteto kubeconfig
eval okteto kubeconfig