From 61bf66a64971e6b4e6658f3b37f42634ab12756b Mon Sep 17 00:00:00 2001 From: Karolis Rusenas Date: Sat, 22 Jul 2017 21:40:54 +0100 Subject: [PATCH 1/2] showing latest version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0b177bbb..5fa1449f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ JOBDATE ?= $(shell date -u +%Y-%m-%dT%H%M%SZ) GIT_REVISION = $(shell git rev-parse --short HEAD) -VERSION ?= $(GIT_REVISION) +VERSION ?= $(shell git describe --tags --abbrev=0) LDFLAGS += -X github.com/rusenask/keel/version.Version=$(VERSION) LDFLAGS += -X github.com/rusenask/keel/version.Revision=$(GIT_REVISION) From 34acf8ab2e79b8558dd378ebf5df1f56d64475e4 Mon Sep 17 00:00:00 2001 From: rimas Date: Mon, 24 Jul 2017 11:28:38 +0100 Subject: [PATCH 2/2] [feature]: Helm chart for keel --- chart/keel/.helmignore | 21 +++++++ chart/keel/Chart.yaml | 18 ++++++ chart/keel/README.md | 22 ++++++++ chart/keel/templates/NOTES.txt | 5 ++ chart/keel/templates/_helpers.tpl | 16 ++++++ chart/keel/templates/deployment.yaml | 67 +++++++++++++++++++++++ chart/keel/templates/service-account.yaml | 10 ++++ chart/keel/templates/service.yaml | 22 ++++++++ chart/keel/values.yaml | 59 ++++++++++++++++++++ 9 files changed, 240 insertions(+) create mode 100644 chart/keel/.helmignore create mode 100644 chart/keel/Chart.yaml create mode 100644 chart/keel/README.md create mode 100644 chart/keel/templates/NOTES.txt create mode 100644 chart/keel/templates/_helpers.tpl create mode 100644 chart/keel/templates/deployment.yaml create mode 100644 chart/keel/templates/service-account.yaml create mode 100644 chart/keel/templates/service.yaml create mode 100644 chart/keel/values.yaml diff --git a/chart/keel/.helmignore b/chart/keel/.helmignore new file mode 100644 index 00000000..f0c13194 --- /dev/null +++ b/chart/keel/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/chart/keel/Chart.yaml b/chart/keel/Chart.yaml new file mode 100644 index 00000000..547f79b3 --- /dev/null +++ b/chart/keel/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +name: keel +description: Open source, tool for automating Kubernetes deployment updates. Keel is stateless, robust and lightweight. +version: 0.1.0 +appversion: 0.4.0-rc.2 +keywords: +- kubernetes deployment +- helm release +- continuous deployment +home: https://keel.sh +sources: +- https://github.com/rusenask/keel +maintainers: +- name: Rimas Mocevicius + email: rmocius@gmail.com +- name: Karolis Rusenas + email: karolis.rusenas@gmail.com +engine: gotpl diff --git a/chart/keel/README.md b/chart/keel/README.md new file mode 100644 index 00000000..f9102a8c --- /dev/null +++ b/chart/keel/README.md @@ -0,0 +1,22 @@ +[![CircleCI](https://circleci.com/gh/rusenask/keel/tree/master.svg?style=shield&circle-token=0239846a42cfa188de531058b9a2116a4b8600d8)](https://circleci.com/gh/rusenask/keel/tree/master) + +# Keel - automated Kubernetes deployments for the rest of us + +* Website [https://keel.sh](https://keel.sh) + +Keel is a tool for automating [Kubernetes](https://kubernetes.io/) deployment updates. Keel is stateless, robust and lightweight. + +## Install for the first time + +Docker image _polling_ is set by default, we also enabling _Helm provider_ support, so Helm releases +can be upgraded when new Docker image is available: + +```console +helm upgrade --install keel keel --set helmProvider.enabled="true" +``` + + +## Run upgrades e.g. for docker image change +```console +helm upgrade keel keel --reuse-values --set image.tag="0.4.0" +``` diff --git a/chart/keel/templates/NOTES.txt b/chart/keel/templates/NOTES.txt new file mode 100644 index 00000000..5a69ff5f --- /dev/null +++ b/chart/keel/templates/NOTES.txt @@ -0,0 +1,5 @@ +1. The {{ template "name" .}} is getting provisioned in your cluster. After a few minutes, you can run the following to verify. + +To verify that {{ template "name" . }} has started, run: + + kubectl --namespace=kube-system get pods -l "app={{ template "name" . }}" diff --git a/chart/keel/templates/_helpers.tpl b/chart/keel/templates/_helpers.tpl new file mode 100644 index 00000000..f0d83d2e --- /dev/null +++ b/chart/keel/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/chart/keel/templates/deployment.yaml b/chart/keel/templates/deployment.yaml new file mode 100644 index 00000000..636b521e --- /dev/null +++ b/chart/keel/templates/deployment.yaml @@ -0,0 +1,67 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "name" . }} + namespace: kube-system + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + kubernetes.io/service-account.name: keel +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "name" . }} + spec: + containers: + - name: keel + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: ["/bin/keel"] + env: +{{- if .Values.polling.enabled }} + # Enable polling + - name: POLL + value: "1" +{{- else }} + # Disable polling + - name: POLL + value: "0" +{{- end }} +{{- if .Values.helmProvider.enabled }} + # Enable/disable Helm provider + - name: HELM_PROVIDER + value: "1" +{{- end }} +{{- if .Values.gcr.enabled }} + # Enable GCR with pub/sub support + - name: PROJECT_ID + value: "{{ .Values.gcr.projectId }}" + - name: PUBSUB + value: "1" +{{- end }} +{{- if .Values.webhook.enabled }} + # Enable webhook endpoint + - name: WEBHOOK_ENDPOINT + value: "{{ .Values.webhook.endpoint }}" +{{- end }} +{{- if .Values.slack.enabled }} + - name: SLACK_TOKEN + value: "{{ .Values.slack.token }}" + - name: SLACK_CHANNELS + value: "{{ .Values.slack.channel }}" +{{- end }} + ports: + - containerPort: {{ .Values.service.internalPort }} + livenessProbe: + httpGet: + path: /healthz + port: {{ .Values.service.internalPort }} + initialDelaySeconds: 30 + timeoutSeconds: 10 + resources: +{{ toYaml .Values.resources | indent 12 }} diff --git a/chart/keel/templates/service-account.yaml b/chart/keel/templates/service-account.yaml new file mode 100644 index 00000000..db37393f --- /dev/null +++ b/chart/keel/templates/service-account.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "name" . }} + namespace: kube-system + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" diff --git a/chart/keel/templates/service.yaml b/chart/keel/templates/service.yaml new file mode 100644 index 00000000..e41ea5fd --- /dev/null +++ b/chart/keel/templates/service.yaml @@ -0,0 +1,22 @@ +{{- if .Values.webhook.enabled }} +apiVersion: v1 +kind: Service +metadata: + name: {{ template "name" . }} + namespace: kube-system + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app: {{ template "name" . }} + sessionAffinity: None +{{- end }} diff --git a/chart/keel/values.yaml b/chart/keel/values.yaml new file mode 100644 index 00000000..ed243ba3 --- /dev/null +++ b/chart/keel/values.yaml @@ -0,0 +1,59 @@ +# Default values for keel. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: karolisr/keel + tag: 0.4.0-rc.3 + pullPolicy: IfNotPresent + +# Service gets set only if webhook is enabled +service: + name: ui + type: LoadBalancer + externalPort: 9300 + internalPort: 9300 + + +# Polling is enabled by default, +# you can disable it setting value below to false +polling: + enabled: true + +# Helm provider support +helmProvider: + enabled: false + +# Google Container Registry +# GCP Project ID +gcr: + enabled: false + projectId: "" + pubSub: + enabled: false + +# Webhook Endpoint +webhook: + enabled: false + endpoint: "" + +# Slack notification +slack: + enabled: false + token: "" + channel: "" + +# Resources +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + #requests: + # cpu: 100m + # memory: 128Mi