Skip to content

Commit

Permalink
Merge pull request #43 from estafette/add-official-helm-chart
Browse files Browse the repository at this point in the history
Add official helm chart
  • Loading branch information
JorritSalverda authored Nov 6, 2019
2 parents 4189c90 + 3ef23fb commit edcface
Show file tree
Hide file tree
Showing 24 changed files with 436 additions and 379 deletions.
99 changes: 92 additions & 7 deletions .estafette.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ builder:
track: dev

labels:
app-group: estafette-various
app-group: estafette-controllers
team: estafette-team
language: golang

version:
semver:
major: 1
minor: 0
minor: 2

stages:
build:
Expand All @@ -35,10 +35,62 @@ stages:
action: push
repositories:
- estafette
when:
status == 'succeeded' &&
branch == 'master' &&
server == 'gocd'

lint-helm-chart:
image: alpine/helm:2.15.1
commands:
- helm lint ${ESTAFETTE_GIT_NAME}

package-helm-chart:
image: alpine/helm:2.15.1
commands:
- helm package --save=false --app-version ${ESTAFETTE_BUILD_VERSION} --version ${ESTAFETTE_BUILD_VERSION_MAJOR}.${ESTAFETTE_BUILD_VERSION_MINOR}.0-pre-${ESTAFETTE_BUILD_VERSION_PATCH} ${ESTAFETTE_GIT_NAME}

test-helm-chart:
services:
- name: kubernetes
image: bsycorp/kind:latest-1.12
ports:
- port: 8443
- port: 10080
readiness:
path: /kubernetes-ready
timeoutSeconds: 180
image: alpine/helm:2.15.1
env:
KUBERNETES_HOST: kubernetes
commands:
- apk add sed
- mkdir -p ~/.kube
- wget -q -O - http://${KUBERNETES_HOST}:10080/config | sed -e "s/localhost/${KUBERNETES_HOST}/" > ~/.kube/config
- wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.15.1/bin/linux/amd64/kubectl
- chmod +x /usr/local/bin/kubectl
- kubectl version
- kubectl -n kube-system create serviceaccount tiller
- kubectl create clusterrolebinding tiller --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
- helm init --service-account tiller --wait
- helm template --name ${ESTAFETTE_GIT_NAME} ${ESTAFETTE_GIT_NAME}-${ESTAFETTE_BUILD_VERSION_MAJOR}.${ESTAFETTE_BUILD_VERSION_MINOR}.0-pre-${ESTAFETTE_BUILD_VERSION_PATCH}.tgz --namespace estafette
- helm upgrade --install ${ESTAFETTE_GIT_NAME} ${ESTAFETTE_GIT_NAME}-${ESTAFETTE_BUILD_VERSION_MAJOR}.${ESTAFETTE_BUILD_VERSION_MINOR}.0-pre-${ESTAFETTE_BUILD_VERSION_PATCH}.tgz --namespace estafette --wait --timeout 120 || (kubectl logs -l app.kubernetes.io/name=${ESTAFETTE_GIT_NAME},app.kubernetes.io/instance=${ESTAFETTE_GIT_NAME} -n estafette && exit 1)
- kubectl logs -l app.kubernetes.io/name=${ESTAFETTE_GIT_NAME},app.kubernetes.io/instance=${ESTAFETTE_GIT_NAME} -n estafette

clone-charts-repo:
image: extensions/git-clone:dev
repo: helm-charts
branch: master

publish-helm-chart:
image: alpine/helm:2.15.1
commands:
- apk add git
- mkdir -p helm-charts/charts
- cp *.tgz helm-charts/charts
- cd helm-charts
- helm repo index --url https://helm.estafette.io/ --merge index.yaml .
- git config --global user.email "[email protected]"
- git config --global user.name "Estafette bot"
- git add --all
- git commit --allow-empty -m "${ESTAFETTE_BUILD_VERSION_MAJOR}.${ESTAFETTE_BUILD_VERSION_MINOR}.0-pre-${ESTAFETTE_BUILD_VERSION_PATCH}"
- git push origin master

slack-notify:
image: extensions/slack-build-status:dev
Expand All @@ -47,4 +99,37 @@ stages:
- '#build-status'
when:
status == 'succeeded' ||
status == 'failed'
status == 'failed'

releases:
release:
clone: true
stages:
package-helm-chart:
image: alpine/helm:2.15.1
commands:
- helm package --save=false --app-version ${ESTAFETTE_BUILD_VERSION} --version ${ESTAFETTE_BUILD_VERSION_MAJOR}.${ESTAFETTE_BUILD_VERSION_MINOR}.0 ${ESTAFETTE_GIT_NAME}

clone-charts-repo:
image: extensions/git-clone:dev
repo: helm-charts
branch: master

publish-helm-chart:
image: alpine/helm:2.15.1
commands:
- apk add git
- mkdir -p helm-charts/charts
- cp *.tgz helm-charts/charts
- cd helm-charts
- helm repo index --url https://helm.estafette.io/ --merge index.yaml .
- git config --global user.email "[email protected]"
- git config --global user.name "Estafette bot"
- git add --all
- git commit --allow-empty -m "${ESTAFETTE_BUILD_VERSION_MAJOR}.${ESTAFETTE_BUILD_VERSION_MINOR}.0"
- git push origin master

create-github-release:
image: extensions/github-release:dev
version: ${ESTAFETTE_BUILD_VERSION_MAJOR}.${ESTAFETTE_BUILD_VERSION_MINOR}.0
closeMilestone: true
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@

# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

# Binary
/estafette-gke-preemptible-killer
49 changes: 12 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,48 +76,23 @@ $ gcloud iam --project=$project_id service-accounts keys create \
google_service_account.json
```

### Deploy with Helm
## Installation

```bash
# Prepare Helm/Tiller
$ kubectl create sa tiller -n kube-system
$ helm init --service-account tiller
$ kubectl create clusterrolebinding tiller \
--clusterrole=cluster-admin \
--serviceaccount=kube-system:tiller

# Install
$ helm upgrade estafette-gke-preemptible-killer \
--namespace estafette \
--install \
--set rbac.create=true \
--set-file googleServiceAccount=./google_service_account.json \
./chart/estafette-gke-preemptible-killer
Prepare using Helm:

```
brew install kubernetes-helm
kubectl -n kube-system create serviceaccount tiller
kubectl create clusterrolebinding tiller --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller --wait
```

### Deploy without Helm
Then install or upgrade with Helm:

```bash
export NAMESPACE=estafette
export APP_NAME=estafette-gke-preemptible-killer
export TEAM_NAME=tooling
export VERSION=1.1.21
export GO_PIPELINE_LABEL=1.1.21
export GOOGLE_SERVICE_ACCOUNT=$(cat google_service_account.json | base64)
export DRAIN_TIMEOUT=300
export INTERVAL=600
export CPU_REQUEST=10m
export MEMORY_REQUEST=16Mi
export CPU_LIMIT=50m
export MEMORY_LIMIT=128Mi

# Setup RBAC
curl https://raw.githubusercontent.com/estafette/estafette-gke-preemptible-killer/master/rbac.yaml | envsubst | kubectl apply -n ${NAMESPACE} -f -

# Run application
curl https://raw.githubusercontent.com/estafette/estafette-gke-preemptible-killer/master/kubernetes.yaml | envsubst | kubectl apply -n ${NAMESPACE} -f -
```

helm repo add estafette https://helm.estafette.io
helm upgrade --install estafette-gke-preemptible-killer --namespace estafette estafette/estafette-gke-preemptible-killer
```
### Deploy with Kustomize

Create a `kustomization.yaml` file:
Expand Down
6 changes: 0 additions & 6 deletions chart/estafette-gke-preemptible-killer/Chart.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions chart/estafette-gke-preemptible-killer/templates/NOTES.txt

This file was deleted.

8 changes: 0 additions & 8 deletions chart/estafette-gke-preemptible-killer/templates/_helpers.tpl

This file was deleted.

28 changes: 0 additions & 28 deletions chart/estafette-gke-preemptible-killer/templates/clusterrole.yaml

This file was deleted.

This file was deleted.

62 changes: 0 additions & 62 deletions chart/estafette-gke-preemptible-killer/templates/deployment.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions chart/estafette-gke-preemptible-killer/templates/secret.yaml

This file was deleted.

This file was deleted.

Loading

0 comments on commit edcface

Please sign in to comment.