Skip to content

Commit

Permalink
Merge pull request #43 from deimosfr/master
Browse files Browse the repository at this point in the history
Generates files on local disk before applying config with kubectl
  • Loading branch information
pieterlange authored May 12, 2017
2 parents 6534a21 + eb468ed commit 0392c3e
Showing 1 changed file with 16 additions and 9 deletions.
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 -

0 comments on commit 0392c3e

Please sign in to comment.