Skip to content

Instantly share code, notes, and snippets.

@nilesh93
Last active June 19, 2020 17:11
Show Gist options
  • Select an option

  • Save nilesh93/3d720d05a62561c6277f824a0d2f881d to your computer and use it in GitHub Desktop.

Select an option

Save nilesh93/3d720d05a62561c6277f824a0d2f881d to your computer and use it in GitHub Desktop.
#!/bin/sh
api="$1"
namespace="$2"
insecure="$3"
dir="$4"
output="$(kubectl get api $api -n $namespace -o json | jq '.metadata.name' -r)"
echo "$output"
pwd
ls -ll
echo "creating missing dirs"
mkdir -p $dir/Interceptors
mkdir -p $dir/libs
echo "print folder contents"
ls -ll $dir/
if [ "$output" = "$api" ]; then
echo "API exists in the system. Hence updaing the API"
apictl update api -n $api -f $dir $insecure --namespace $namespace
apictl import-api -f $dir -e k8s $insecure --update
else
echo "Adding API to the Kuberenetes"
apictl add api -n $api $dir $insecure
apictl import-api -f $dir -e k8s $insecure
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment