Skip to content

Commit

Permalink
Added helm chart - thanks Saneep Lamda
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Rua committed Jul 29, 2019
1 parent 2d5e376 commit 7ddfdf6
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 0 deletions.
19 changes: 19 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: kube-tagger
description: Helm Chart to inject TAGS to EBS
version: 3.0.0
apiVersion: v1
kubeVersion: ">=1.11.8-eks-7c34c0"
tillerVersion: ">=2.11.1"
keywords:
- kube-tagger
engine: gotpl
appVersion: 3.0.0
home: https://github.com/sergiorua/kube-tagger
deprecated: false
maintainers:
- email: [email protected]
name: slamba
- email: [email protected]
name: srua
sources:
- https://github.com/sergiorua/kube-tagger
19 changes: 19 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# kube-tagger Helm Chart

This Helm Chart will create the kube-tagger Pod to create EBS tags on PVC

## Installation Commands

You can install the chart directly

```
helm upgrade --install kube-tagger ./kube-tagger/ --namespace=kube-system --debug --dry-run
helm upgrade --install kube-tagger ./kube-tagger/ --namespace=kube-system --debug
```

If Helm-Chart is in a repo

```
helm upgrade --install kube-tagger chartmuseum/kube-tagger/ --namespace=kube-system --debug --dry-run
helm upgrade --install kube-tagger chartmuseum/kube-tagger/ --namespace=kube-system --debug
```
20 changes: 20 additions & 0 deletions helm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The kube-tagger has been deployed.
{{ if .Values.global.name }}
You can see the pod is running or not with below command
command:
kubectl get pod kube-tagger -n kube-system

NOTE: Please add the annotation as below to tag your PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
volume.beta.kubernetes.io/additional-resource-tags: Owner=Sandeep;Environment=Dev
{{ else }}
NOTE: Please add the annotation as below to tag your PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
volume.beta.kubernetes.io/additional-resource-tags: Owner=Sergio;Environment=Dev
{{- end -}}
51 changes: 51 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kube-tagger.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kube-tagger.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kube-tagger.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a service name that defaults to app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "kube-tagger.service.fullname" -}}
{{- .Values.service.nameOverride | default .Chart.Name }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "kube-tagger.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "kube-tagger.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
20 changes: 20 additions & 0 deletions helm/templates/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.global.name }}
namespace: {{ .Values.global.namespace }}
labels:
app: {{ template "kube-tagger.name" . }}
chart: {{ template "kube-tagger.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Values.global.name }}
subjects:
- kind: ServiceAccount
name: {{ .Values.global.name }}
namespace: {{ .Values.global.namespace }}
{{- end -}}
22 changes: 22 additions & 0 deletions helm/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.global.name }}
namespace: {{ .Values.global.namespace }}
labels:
app: {{ template "kube-tagger.name" . }}
chart: {{ template "kube-tagger.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- apiGroups:
- ""
resources:
- persistentvolumeclaims
- persistentvolumes
verbs:
- get
- list
- watch
{{- end -}}
36 changes: 36 additions & 0 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.global.name }}
namespace: {{ .Values.global.namespace }}
labels:
app: {{ template "kube-tagger.name" . }}
chart: {{ template "kube-tagger.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ template "kube-tagger.name" . }}
chart: {{ template "kube-tagger.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
template:
metadata:
labels:
app: {{ template "kube-tagger.name" . }}
chart: {{ template "kube-tagger.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
serviceAccountName: {{ .Values.global.name }}
containers:
- name: {{ .Values.global.name }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
command: ["/app/main"]
{{- if .Values.extraEnv }}
env:
{{ toYaml .Values.extraEnv | indent 6 -}}
{{- end -}}
13 changes: 13 additions & 0 deletions helm/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.global.name }}
namespace: {{ .Values.global.namespace }}
labels:
app: {{ template "kube-tagger.name" . }}
chart: {{ template "kube-tagger.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
automountServiceAccountToken: true
{{- end -}}
27 changes: 27 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
replicas: 1

global:
name: kube-tagger
namespace: kube-system

rbac:
create: true
pspEnabled: false

serviceAccount:
create: true

image:
repository: sergrua/kube-tagger
tag: release-0.0.5
pullPolicy: Always
namespace: kube-system
backoffLimit: 3
containerPort: 8080

extraEnv: {}
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}
podAnnotations: {}

0 comments on commit 7ddfdf6

Please sign in to comment.