From 4403d50c91d60ebd35079d69ab7588afcf43689e Mon Sep 17 00:00:00 2001 From: tamal Date: Sat, 27 Jan 2018 05:36:07 -0800 Subject: [PATCH] Fix installer script --- hack/deploy/admission/operator.yaml | 12 ++++++------ hack/deploy/operator.yaml | 6 +++--- hack/deploy/stash.sh | 8 +++++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/hack/deploy/admission/operator.yaml b/hack/deploy/admission/operator.yaml index 563cc0422..53ee46ed8 100644 --- a/hack/deploy/admission/operator.yaml +++ b/hack/deploy/admission/operator.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: name: stash-operator - namespace: $STASH_OPERATOR + namespace: $STASH_NAMESPACE labels: app: stash initializers: @@ -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: @@ -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 @@ -97,7 +97,7 @@ apiVersion: v1 kind: Service metadata: name: stash-operator - namespace: $STASH_OPERATOR + namespace: $STASH_NAMESPACE labels: app: stash spec: @@ -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: @@ -128,7 +128,7 @@ spec: versionPriority: 15 service: name: stash-operator - namespace: $STASH_OPERATOR + namespace: $STASH_NAMESPACE version: v1alpha1 --- # register to intercept namespace creates diff --git a/hack/deploy/operator.yaml b/hack/deploy/operator.yaml index 1d9c9811f..c189ae8da 100644 --- a/hack/deploy/operator.yaml +++ b/hack/deploy/operator.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1beta1 kind: Deployment metadata: name: stash-operator - namespace: $STASH_OPERATOR + namespace: $STASH_NAMESPACE labels: app: stash initializers: @@ -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: @@ -60,7 +60,7 @@ apiVersion: v1 kind: Service metadata: name: stash-operator - namespace: $STASH_OPERATOR + namespace: $STASH_NAMESPACE labels: app: stash spec: diff --git a/hack/deploy/stash.sh b/hack/deploy/stash.sh index cab6a3d4c..db0f0b84c 100755 --- a/hack/deploy/stash.sh +++ b/hack/deploy/stash.sh @@ -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/ @@ -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) @@ -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 ) 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 @@ -107,7 +110,6 @@ if [ "$STASH_ENABLE_ADMISSION_WEBHOOK" = true ]; then chmod +x onessl.exe export ONESSL=./onessl.exe ;; - ;; *) echo 'other OS' ;; @@ -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