Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generates files before applying config with kubectl #43

Merged
merged 1 commit into from
May 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions kube/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ else
base64="base64"
fi

kubectl apply --namespace=$namespace -f - <<- EOSECRETS
kuberes='./kube/kube-resources'
mkdir $kuberes

echo "Generating Kubernetes ressources"

cat << EOSECRETS > $kuberes/openvpn-pki.yaml
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -47,9 +52,7 @@ data:
---
EOSECRETS

kubectl create configmap --namespace=$namespace openvpn-crl --from-file=crl.pem=$PWD/pki/crl.pem

kubectl apply --namespace=$namespace -f - <<- EOCONFIGMAP
cat << EOCONFIGMAP > $kuberes/openvpn-settings.yaml
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -61,11 +64,7 @@ data:
---
EOCONFIGMAP

kubectl apply --namespace=$namespace -f ./kube/configmaps-example.yaml

sed "s/\${OVPN_CN}/${OVPN_CN}/g;" kube/deployment.yaml | kubectl create --namespace=$namespace -f -

kubectl apply --namespace=$namespace -f - <<- EOSERVICE
cat << EOSERVICE > $kuberes/openvpn-svc.yaml
---
apiVersion: v1
kind: Service
Expand All @@ -83,3 +82,11 @@ spec:
openvpn: ${OVPN_CN}
---
EOSERVICE

echo "Creating and applying Kubernetes ressources"
kubectl create configmap --namespace=$namespace openvpn-crl --from-file=crl.pem=$PWD/pki/crl.pem
kubectl apply --namespace=$namespace -f ./kube/configmaps-example.yaml
kubectl apply --namespace=$namespace -f $kuberes/openvpn-pki.yaml
kubectl apply --namespace=$namespace -f $kuberes/openvpn-settings.yaml
kubectl apply --namespace=$namespace -f $kuberes/openvpn-svc.yaml
sed "s/\${OVPN_CN}/${OVPN_CN}/g;" kube/deployment.yaml | kubectl create --namespace=$namespace -f -