Skip to content

Commit

Permalink
Fix installer script
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha committed Jan 27, 2018
1 parent 2c9166f commit 4403d50
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
12 changes: 6 additions & 6 deletions hack/deploy/admission/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: stash-operator
namespace: $STASH_OPERATOR
namespace: $STASH_NAMESPACE
labels:
app: stash
initializers:
Expand All @@ -20,7 +20,7 @@ spec:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
serviceAccountName: $STASH_SERVICE_ACCOUNT
imagePullSecrets: ["$STASH_IMAGE_PULL_SECRET"]
imagePullSecrets: [$STASH_IMAGE_PULL_SECRET]
containers:
- name: operator
args:
Expand Down Expand Up @@ -84,7 +84,7 @@ apiVersion: v1
kind: Secret
metadata:
name: stash-admission-webhook-cert
namespace: $STASH_OPERATOR
namespace: $STASH_NAMESPACE
labels:
app: stash
type: kubernetes.io/tls
Expand All @@ -97,7 +97,7 @@ apiVersion: v1
kind: Service
metadata:
name: stash-operator
namespace: $STASH_OPERATOR
namespace: $STASH_NAMESPACE
labels:
app: stash
spec:
Expand All @@ -118,7 +118,7 @@ spec:
apiVersion: apiregistration.k8s.io/v1beta1
kind: APIService
metadata:
name: v1beta1.admission.stash.appscode.com
name: v1alpha1.admission.stash.appscode.com
labels:
app: stash
spec:
Expand All @@ -128,7 +128,7 @@ spec:
versionPriority: 15
service:
name: stash-operator
namespace: $STASH_OPERATOR
namespace: $STASH_NAMESPACE
version: v1alpha1
---
# register to intercept namespace creates
Expand Down
6 changes: 3 additions & 3 deletions hack/deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: stash-operator
namespace: $STASH_OPERATOR
namespace: $STASH_NAMESPACE
labels:
app: stash
initializers:
Expand All @@ -20,7 +20,7 @@ spec:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
serviceAccountName: $STASH_SERVICE_ACCOUNT
imagePullSecrets: ["$STASH_IMAGE_PULL_SECRET"]
imagePullSecrets: [$STASH_IMAGE_PULL_SECRET]
containers:
- name: operator
args:
Expand Down Expand Up @@ -60,7 +60,7 @@ apiVersion: v1
kind: Service
metadata:
name: stash-operator
namespace: $STASH_OPERATOR
namespace: $STASH_NAMESPACE
labels:
app: stash
spec:
Expand Down
8 changes: 5 additions & 3 deletions hack/deploy/stash.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -eou pipefail

# ref: https://stackoverflow.com/a/7069755/244009
# ref: https://jonalmeida.com/posts/2013/05/26/different-ways-to-implement-flags-in-bash/
Expand Down Expand Up @@ -55,7 +56,7 @@ while test $# -gt 0; do
;;
--image-pull-secret*)
secret=`echo $1 | sed -e 's/^[^=]*=//g'`
export STASH_IMAGE_PULL_SECRET="name: secret"
export STASH_IMAGE_PULL_SECRET="name: '$secret'"
shift
;;
--enable-admission-webhook)
Expand Down Expand Up @@ -85,7 +86,9 @@ done
env | sort | grep STASH*
echo ""

echo "checking kubeconfig context"
kubectl config current-context || { echo "Set a context (kubectl use-context <context>) out of the following:"; echo; kubectl config get-contexts; exit 1; }
echo ""

if [ "$STASH_ENABLE_ADMISSION_WEBHOOK" = true ]; then
# ref: https://stackoverflow.com/a/27776822/244009
Expand All @@ -107,7 +110,6 @@ if [ "$STASH_ENABLE_ADMISSION_WEBHOOK" = true ]; then
chmod +x onessl.exe
export ONESSL=./onessl.exe
;;
;;
*)
echo 'other OS'
;;
Expand All @@ -122,7 +124,7 @@ if [ "$STASH_ENABLE_ADMISSION_WEBHOOK" = true ]; then
export TLS_SERVING_CERT=$(cat server.crt | $ONESSL base64)
export TLS_SERVING_KEY=$(cat server.key | $ONESSL base64)
export KUBE_CA=$($ONESSL get kube-ca | $ONESSL base64)
rm -rf ca.crt ca.key server.crt server.key
rm -rf $ONESSL ca.crt ca.key server.crt server.key

curl -fsSL https://raw.githubusercontent.com/appscode/stash/0.7.0-alpha.0/hack/deploy/admission/operator.yaml | envsubst | kubectl apply -f -
else
Expand Down

0 comments on commit 4403d50

Please sign in to comment.