Skip to content

Commit 7858bb7

Browse files
committed
Merge pull request #21 from arschles/outside-storage
feat(builder): add support for external object storage
2 parents af2ab12 + 78b9bef commit 7858bb7

2 files changed

Lines changed: 24 additions & 7 deletions

File tree

manifests/deis-builder-rc.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ spec:
2727
- name: minio-user
2828
mountPath: /var/run/secrets/object/store
2929
readOnly: true
30+
# not currently running minio with SSL support. see https://github.com/deis/minio/pull/22 for more detail
31+
# - name: minio-ssl
32+
# mountPath: /var/run/secrets/object/ssl
33+
# readOnly: true
3034
volumes:
3135
- name: minio-user
3236
secret:
3337
secretName: minio-user
38+
# not currently running minio with SSL support. see https://github.com/deis/minio/pull/22 for more detail
39+
# - name: minio-ssl
40+
# secret:
41+
# secretName: minio-ssl

rootfs/etc/confd/templates/builder

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ else
7474
PROCFILE="{}"
7575
fi
7676

77-
if [[ ! -f /var/run/secrets/object/store/access-key-id ]]; then
77+
if [[ ! -f /var/run/secrets/object/store/access-key-id ]]; then
7878
if $USING_DOCKERFILE ; then
7979
l1=`grep -n "object-store" /etc/deis-dockerbuilder.yaml | head -n1 |cut -d ":" -f1`
8080
l2=$(($l1+3))
@@ -97,29 +97,38 @@ fi
9797

9898
git archive --format=tar.gz ${GIT_SHA} > ${APP_NAME}.tar.gz
9999

100+
HTTP_PREFIX="http"
100101
# if minio is in the cluster, use it. otherwise use fetcher
101102
# TODO: figure out something for using S3 also
102103
if [[ -n "$DEIS_MINIO_SERVICE_HOST" && -n "$DEIS_MINIO_SERVICE_PORT" ]]; then
103104
S3EP=${DEIS_MINIO_SERVICE_HOST}:${DEIS_MINIO_SERVICE_PORT}
105+
elif [[ -n "$DEIS_OUTSIDE_STORAGE_HOST" && -n "$DEIS_OUTSIDE_STORAGE_HOST" ]]; then
106+
HTTP_PREFIX="https"
107+
S3EP=${DEIS_OUTSIDE_STORAGE_HOST}:${DEIS_OUTSIDE_STORAGE_HOST}
104108
elif [ -z "$S3EP" ]; then
105109
S3EP=${HOST}:3000
106110
fi
107111

108-
TAR_URL=http://$S3EP/git/home/${SLUG_NAME}/tar
109-
PUSH_URL=http://$S3EP/git/home/${SLUG_NAME}/push
112+
TAR_URL=$HTTP_PREFIX://$S3EP/git/home/${SLUG_NAME}/tar
113+
PUSH_URL=$HTTP_PREFIX://$S3EP/git/home/${SLUG_NAME}/push
110114

111115
sed -i -- "s#repo_name#$META_NAME#g" /etc/${SLUG_NAME}.yaml
112116
sed -i -- "s#puturl#$PUSH_URL#g" /etc/${SLUG_NAME}.yaml
113117
sed -i -- "s#tar-url#$TAR_URL#g" /etc/${SLUG_NAME}.yaml
114118

115119
ACCESS_KEY=`cat /var/run/secrets/object/store/access-key-id`
116120
ACCESS_SECRET=`cat /var/run/secrets/object/store/access-secret-key`
121+
# copy the self signed cert into the CA directory for alpine.
122+
# note: we're not running minio with SSL at all right now, so no need for this.
123+
# future SSL rollouts for in-cluster storage may not need it either if we set up an intermediate CA
124+
# CERT_FILE="/var/run/secrets/object/ssl/access-cert"
125+
# cp $CERT_FILE /etc/ssl/certs/deis-minio-self-signed-cert.crt
117126
mkdir -p /var/minio-conf
118127
CONFIG_DIR=/var/minio-conf
119-
echo "mc -C $CONFIG_DIR config host add "http://$S3EP" $ACCESS_KEY $ACCESS_SECRET"
120-
mc -C $CONFIG_DIR --quiet config host add "http://$S3EP" $ACCESS_KEY $ACCESS_SECRET
121-
mc -C $CONFIG_DIR --quiet mb "${S3EP}/git"
122-
mc -C $CONFIG_DIR --quiet cp ${APP_NAME}.tar.gz $TAR_URL
128+
MC_PREFIX="mc -C $CONFIG_DIR --quiet"
129+
$MC_PREFIX config host all "$HTTP_PREFIX://$S3EP" $ACCESS_KEY $ACCESS_SECRET
130+
$MC_PREFIX mb "$HTTP_PREFIX://${S3EP}/git"
131+
$MC_PREFIX cp ${APP_NAME}.tar.gz $TAR_URL
123132
echo "stored tarfile in $TAR_URL"
124133

125134
kubectl create -f /etc/${SLUG_NAME}.yaml

0 commit comments

Comments
 (0)