Skip to content

Commit

Permalink
fix(deploy): only use replace on configmaps
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Sep 26, 2018
1 parent 06c4f05 commit b9dc537
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
20 changes: 11 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
- export KUBECONFIG=./kubeconfig
- charttmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'charttmpdir'`;mkdir -p ${charttmpdir};helm template -n olm --set namespace=operator-lifecycle-manager deploy/chart --set alm.image.ref=quay.io/coreos/olm:${CI_COMMIT_REF_SLUG}-${SHA8}
--set catalog.image.ref=quay.io/coreos/catalog:${CI_COMMIT_REF_SLUG}-${SHA8} --set catalog_namespace=operator-lifecycle-manager --set namespace=operator-lifecycle-manager --set package.image.ref=quay.io/coreos/package-server:${CI_COMMIT_REF_SLUG}-${SHA8}
--set watchedNamespaces= --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do kubectl replace --force -f ${f};done;
--set watchedNamespaces= --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do if [[ $f == *.configmap.yaml ]];then
kubectl replace --force -f ${f};else kubectl apply -f ${f};fi;done;
- kubectl create secret docker-registry coreos-pull-secret --docker-server quay.io --docker-username $DOCKER_USER --docker-password $DOCKER_PASS --docker-email [email protected] --namespace=operator-lifecycle-manager
|| true
- kubectl rollout status -w deployment/olm-operator --namespace=operator-lifecycle-manager
Expand Down Expand Up @@ -115,7 +116,8 @@ deploy-openshift:
- export KUBECONFIG=./kubeconfig
- charttmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'charttmpdir'`;mkdir -p ${charttmpdir};helm template -n olm --set namespace=operator-lifecycle-manager deploy/chart --set alm.image.ref=quay.io/coreos/olm:${CI_COMMIT_REF_SLUG}-${SHA8}
--set catalog.image.ref=quay.io/coreos/catalog:${CI_COMMIT_REF_SLUG}-${SHA8} --set catalog_namespace=operator-lifecycle-manager --set namespace=operator-lifecycle-manager --set package.image.ref=quay.io/coreos/package-server:${CI_COMMIT_REF_SLUG}-${SHA8}
--set watchedNamespaces= --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do kubectl replace --force -f ${f};done;
--set watchedNamespaces= --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do if [[ $f == *.configmap.yaml ]];then
kubectl replace --force -f ${f};else kubectl apply -f ${f};fi;done;
- kubectl create secret docker-registry coreos-pull-secret --docker-server quay.io --docker-username $DOCKER_USER --docker-password $DOCKER_PASS --docker-email [email protected] --namespace=operator-lifecycle-manager
|| true
- kubectl rollout status -w deployment/olm-operator --namespace=operator-lifecycle-manager
Expand Down Expand Up @@ -150,8 +152,8 @@ deploy-preview:
- export KUBECONFIG=./kubeconfig
- charttmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'charttmpdir'`;mkdir -p ${charttmpdir};helm template -n olm --set namespace=ci-alm-${CI_COMMIT_REF_SLUG} deploy/chart --set alm.image.ref=quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}-pre
--set catalog.image.ref=quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG}-pre --set catalog_namespace=operator-lifecycle-manager --set namespace=ci-alm-${CI_COMMIT_REF_SLUG} --set package.image.ref=quay.io/coreos/package-server-ci:${CI_COMMIT_REF_SLUG}-pre
--set watchedNamespaces=ci-alm-${CI_COMMIT_REF_SLUG} --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do kubectl
replace --force -f ${f};done;
--set watchedNamespaces=ci-alm-${CI_COMMIT_REF_SLUG} --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do if [[ $f
== *.configmap.yaml ]];then kubectl replace --force -f ${f};else kubectl apply -f ${f};fi;done;
- kubectl create secret docker-registry coreos-pull-secret --docker-server quay.io --docker-username $DOCKER_USER --docker-password $DOCKER_PASS --docker-email [email protected] --namespace=ci-alm-${CI_COMMIT_REF_SLUG}
|| true
- kubectl rollout status -w deployment/olm-operator --namespace=ci-alm-${CI_COMMIT_REF_SLUG}
Expand Down Expand Up @@ -181,8 +183,8 @@ deploy-staging:
- export KUBECONFIG=./kubeconfig
- charttmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'charttmpdir'`;mkdir -p ${charttmpdir};helm template -n olm --set namespace=ci-alm-staging deploy/chart --set alm.image.ref=quay.io/coreos/olm:${CI_COMMIT_REF_SLUG}-${SHA8}
--set catalog.image.ref=quay.io/coreos/catalog:${CI_COMMIT_REF_SLUG}-${SHA8} --set catalog_namespace=operator-lifecycle-manager --set namespace=ci-alm-staging --set package.image.ref=quay.io/coreos/package-server:${CI_COMMIT_REF_SLUG}-${SHA8}
--set watchedNamespaces=ci-alm-staging --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do kubectl replace --force
-f ${f};done;
--set watchedNamespaces=ci-alm-staging --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do if [[ $f == *.configmap.yaml
]];then kubectl replace --force -f ${f};else kubectl apply -f ${f};fi;done;
- kubectl create secret docker-registry coreos-pull-secret --docker-server quay.io --docker-username $DOCKER_USER --docker-password $DOCKER_PASS --docker-email [email protected] --namespace=ci-alm-staging
|| true
- kubectl rollout status -w deployment/olm-operator --namespace=ci-alm-staging
Expand Down Expand Up @@ -210,8 +212,8 @@ e2e-setup:
- export KUBECONFIG=./kubeconfig
- charttmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'charttmpdir'`;mkdir -p ${charttmpdir};helm template -n olm --set namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} deploy/chart --set alm.image.ref=quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}-pre
--set catalog.image.ref=quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG}-pre --set catalog_namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} --set namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} --set package.image.ref=quay.io/coreos/package-server-ci:${CI_COMMIT_REF_SLUG}-pre
--set watchedNamespaces=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do kubectl
replace --force -f ${f};done;
--set watchedNamespaces=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/olm/templates/*.yaml);echo ${chartfilenames};for f in ${chartfilenames};do if
[[ $f == *.configmap.yaml ]];then kubectl replace --force -f ${f};else kubectl apply -f ${f};fi;done;
- kubectl create secret docker-registry coreos-pull-secret --docker-server quay.io --docker-username $DOCKER_USER --docker-password $DOCKER_PASS --docker-email [email protected] --namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
|| true
- kubectl rollout status -w deployment/olm-operator --namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
Expand Down Expand Up @@ -254,7 +256,7 @@ e2e_tests:
|| true
- charttmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'charttmpdir'`;mkdir -p ${charttmpdir};helm template -n alm-e2e --set namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} test/e2e/chart --set e2e.image.ref=quay.io/coreos/alm-e2e:${CI_COMMIT_REF_SLUG}-${SHA8}
--set job_name=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} --set namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} --output-dir ${charttmpdir};chartfilenames=$(ls ${charttmpdir}/alm-e2e/templates/*.yaml);echo ${chartfilenames};for
f in ${chartfilenames};do kubectl replace --force -f ${f};done;
f in ${chartfilenames};do if [[ $f == *.configmap.yaml ]];then kubectl replace --force -f ${f};else kubectl apply -f ${f};fi;done;
- until kubectl -n e2e-${CI_COMMIT_REF_SLUG}-${SHA8} logs job/e2e-${CI_COMMIT_REF_SLUG}-${SHA8} | grep -v 'ContainerCreating'; do echo 'waiting for job to run' && sleep 1; done
- kubectl -n e2e-${CI_COMMIT_REF_SLUG}-${SHA8} logs job/e2e-${CI_COMMIT_REF_SLUG}-${SHA8} -f
- kubectl -n e2e-${CI_COMMIT_REF_SLUG}-${SHA8} logs job/e2e-${CI_COMMIT_REF_SLUG}-${SHA8} > e2e.log
Expand Down
5 changes: 4 additions & 1 deletion .gitlab-ci/utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@
"echo ${chartfilenames};" +
"for f in ${chartfilenames};" +
"do "+
"kubectl replace --force -f ${f};" +
"if [[ $f == *.configmap.yaml ]];" +
"then kubectl replace --force -f ${f};" +
"else kubectl apply -f ${f};" +
"fi;" +
"done;"
]),
],
Expand Down
10 changes: 6 additions & 4 deletions scripts/install_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ fi
namespace=$1
chart=$2

# create OLM NS
kubectl create ns ${namespace} || { echo 'ns exists'; }

# create OLM
for f in ${chart}/*.yaml
do
kubectl replace --force -f ${f}
if [[ $f == *.configmap.yaml ]]
then
kubectl replace --force -f ${f};
else
kubectl apply -f ${f};
fi
done

# wait for deployments to be ready
Expand Down

0 comments on commit b9dc537

Please sign in to comment.