Skip to content

Commit

Permalink
different config using defferent target
Browse files Browse the repository at this point in the history
  • Loading branch information
WakeupTsai committed Aug 16, 2018
1 parent 61b23d8 commit a1ff08b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ before_script:
# # Enable rbac.
- kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
# Launch apps (mongodb, prometheus)
- make CONFIG=testing apps.launch
- make apps.launch-testing
# Check if prometheus is ready
- until curl --connect-timeout 1 -sL -w "%{http_code}\\n" http://`kubectl get service -n vortex prometheus -o jsonpath="{.spec.clusterIP}"`:9090/api/v1/query?query=prometheus_build_info -o /dev/null | grep 200; do sleep 1; echo "wait the prometheus to be available"; kubectl get pods --all-namespaces; done
- until [ `kubectl -n vortex get --no-headers pods | awk '{c[$3]++}END{ print NR-c["Running"]}'` -eq 0 ]; do sleep 1; echo "wait all pod running"; kubectl -n vortex get pods; done
Expand Down
58 changes: 44 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,50 @@ apps.init-helm:
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

.PHONY: apps.launch
apps.launch:
yq -y .services deploy/helm/config/${CONFIG}.yaml | helm install --name vortex-services-${CONFIG} --debug --wait -f - deploy/helm/services
yq -y .apps deploy/helm/config/${CONFIG}.yaml | helm install --name vortex-apps-${CONFIG} --debug --wait -f - --set vortex-server.controller.apiserverImageTag=$(SERVER_VERSION) deploy/helm/apps

.PHONY: apps.upgrade
apps.upgrade:
yq -y .services deploy/helm/config/${CONFIG}.yaml | helm upgrade vortex-services-${CONFIG} --debug -f - deploy/helm/services
yq -y .apps deploy/helm/config/${CONFIG}.yaml | helm upgrade vortex-apps-${CONFIG} --debug -f - --set vortex-server.controller.apiserverImageTag=$(SERVER_VERSION) deploy/helm/apps

.PHONY: apps.teardown
apps.teardown:
helm delete --purge vortex-services-${CONFIG}
helm delete --purge vortex-apps-${CONFIG}
.PHONY: apps.launch-dev
apps.launch-dev:
yq -y .services deploy/helm/config/development.yaml | helm install --name vortex-services-dev --debug --wait -f - deploy/helm/services
yq -y .apps deploy/helm/config/development.yaml | helm install --name vortex-apps-dev --debug --wait -f - --set vortex-server.controller.apiserverImageTag=$(SERVER_VERSION) deploy/helm/apps

.PHONY: apps.launch-prod
apps.launch-prod:
yq -y .services deploy/helm/config/production.yaml | helm install --name vortex-services-prod --debug --wait -f - deploy/helm/services
yq -y .apps deploy/helm/config/production.yaml | helm install --name vortex-apps-prod --debug --wait -f - --set vortex-server.controller.apiserverImageTag=$(SERVER_VERSION) deploy/helm/apps

.PHONY: apps.launch-testing
apps.launch-testing:
yq -y .services deploy/helm/config/testing.yaml | helm install --name vortex-services-testing --debug --wait -f - deploy/helm/services
yq -y .apps deploy/helm/config/testing.yaml | helm install --name vortex-apps-testing --debug --wait -f - --set vortex-server.controller.apiserverImageTag=$(SERVER_VERSION) deploy/helm/apps

.PHONY: apps.upgrade-dev
apps.upgrade-dev:
yq -y .services deploy/helm/config/development.yaml | helm upgrade vortex-services-dev --debug -f - deploy/helm/services
yq -y .apps deploy/helm/config/development.yaml | helm upgrade vortex-apps-dev --debug -f - --set vortex-server.controller.apiserverImageTag=$(SERVER_VERSION) deploy/helm/apps

.PHONY: apps.upgrade-prod
apps.upgrade-prod:
yq -y .services deploy/helm/config/production.yaml | helm upgrade vortex-services-prod --debug -f - deploy/helm/services
yq -y .apps deploy/helm/config/production.yaml | helm upgrade vortex-apps-prod --debug -f - --set vortex-server.controller.apiserverImageTag=$(SERVER_VERSION) deploy/helm/apps

.PHONY: apps.upgrade-testing
apps.upgrade-testing:
yq -y .services deploy/helm/config/testing.yaml | helm upgrade vortex-services-testing --debug -f - deploy/helm/services
yq -y .apps deploy/helm/config/testing.yaml | helm upgrade vortex-apps-testing --debug -f - --set vortex-server.controller.apiserverImageTag=$(SERVER_VERSION) deploy/helm/apps

.PHONY: apps.teardown-dev
apps.teardown-dev:
helm delete --purge vortex-services-dev
helm delete --purge vortex-apps-dev

.PHONY: apps.teardown-prod
apps.teardown-prod:
helm delete --purge vortex-services-prod
helm delete --purge vortex-apps-prod

.PHONY: apps.teardown-testing
apps.teardown-testing:
helm delete --purge vortex-services-testing
helm delete --purge vortex-apps-testing

## dockerfiles/ ########################################

Expand Down
6 changes: 3 additions & 3 deletions deploy/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ make apps.init-helm
### Using helm deploy apps
This will deploy services and apps in your cluster, and please set the CONFIG variable (could be development, production, or testing) right.
```
make CONFIG=development apps.launch
make apps.launch-dev
```

If you wnat to deploy certain chart, you can type
Expand All @@ -37,10 +37,10 @@ helm install --debug --wait --set global.environment=local deploy/helm/apps/prom

### Upgrade the releases
```
make CONFIG=development apps.upgrade
make apps.upgrade-dev
```

### Delete the releases
```
make CONFIG=development apps.teardown
make apps.teardown-dev
```

0 comments on commit a1ff08b

Please sign in to comment.