2019-11-11 08:09:33 +00:00
|
|
|
#!/bin/bash
|
2018-12-03 13:34:58 +00:00
|
|
|
|
2018-12-04 08:49:27 +00:00
|
|
|
NS=$1
|
|
|
|
|
2018-12-04 09:38:48 +00:00
|
|
|
if [ -z "$NS" ]; then
|
2018-12-03 13:49:06 +00:00
|
|
|
echo "Specify a namespace argument"
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-12-03 13:34:58 +00:00
|
|
|
|
2018-12-04 09:38:48 +00:00
|
|
|
if [ -z "$2" ]; then
|
2018-12-04 09:25:48 +00:00
|
|
|
echo "No enterprise license set"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-11-11 08:09:33 +00:00
|
|
|
case $(uname) in
|
|
|
|
Darwin)
|
|
|
|
LICENSE=$(echo -n "$2" | base64 -b 0)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
LICENSE=$(echo -n "$2" | base64 -w 0)
|
|
|
|
;;
|
|
|
|
esac
|
2018-12-04 09:25:48 +00:00
|
|
|
|
2018-12-03 13:34:58 +00:00
|
|
|
kubectl apply -f - <<EOF
|
|
|
|
apiVersion: v1
|
|
|
|
data:
|
|
|
|
token: ${LICENSE}
|
|
|
|
kind: Secret
|
|
|
|
metadata:
|
|
|
|
name: arangodb-jenkins-license-key
|
2018-12-03 13:49:06 +00:00
|
|
|
namespace: ${NS}
|
2018-12-03 13:34:58 +00:00
|
|
|
type: Opaque
|
|
|
|
EOF
|