Skip to content

Commit

Permalink
Add helm chart to deploy kubeops
Browse files Browse the repository at this point in the history
  • Loading branch information
PrasadG193 committed Dec 26, 2018
1 parent 8122af0 commit c4ad77d
Show file tree
Hide file tree
Showing 9 changed files with 285 additions and 0 deletions.
22 changes: 22 additions & 0 deletions helm/kubeops/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
.vscode/
5 changes: 5 additions & 0 deletions helm/kubeops/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: kubeops
version: 0.1.0
32 changes: 32 additions & 0 deletions helm/kubeops/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kubeops.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 "kubeops.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 "kubeops.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
13 changes: 13 additions & 0 deletions helm/kubeops/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "kubeops.fullname" . }}-clusterrole
labels:
app.kubernetes.io/name: {{ include "kubeops.name" . }}
helm.sh/chart: {{ include "kubeops.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["get", "watch", "list"]
17 changes: 17 additions & 0 deletions helm/kubeops/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "kubeops.fullname" . }}-clusterrolebinding
labels:
app.kubernetes.io/name: {{ include "kubeops.name" . }}
helm.sh/chart: {{ include "kubeops.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "kubeops.fullname" . }}-clusterrole
subjects:
- kind: ServiceAccount
name: {{ include "kubeops.fullname" . }}-sa
namespace: {{ .Release.Namespace }}
15 changes: 15 additions & 0 deletions helm/kubeops/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "kubeops.fullname" . }}-configmap
labels:
app.kubernetes.io/name: {{ include "kubeops.name" . }}
helm.sh/chart: {{ include "kubeops.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
kubeopsconfig.yaml: |
{{- with .Values.kubeopsconfig }}
{{- toYaml . | nindent 4 }}
{{- end }}

40 changes: 40 additions & 0 deletions helm/kubeops/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ include "kubeops.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "kubeops.name" . }}
helm.sh/chart: {{ include "kubeops.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
component: controller
app: kubeops
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
component: controller
app: kubeops
template:
metadata:
labels:
component: controller
app: kubeops
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
serviceAccountName: {{ include "kubeops.fullname" . }}-sa
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: config-volume
mountPath: "/config"
env:
- name: KUBEOPS_CONFIG_PATH
value: "/config/"
volumes:
- name: config-volume
configMap:
name: {{ include "kubeops.fullname" . }}-configmap
9 changes: 9 additions & 0 deletions helm/kubeops/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "kubeops.fullname" . }}-sa
labels:
app.kubernetes.io/name: {{ include "kubeops.name" . }}
helm.sh/chart: {{ include "kubeops.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
132 changes: 132 additions & 0 deletions helm/kubeops/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Default values for kubeops.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
repository: infracloud/kubeops
tag: "0.1"
pullPolicy: Always

nameOverride: ""
fullnameOverride: ""

kubeopsconfig:
## Resources you want to watch
resources:
- name: pods
namespaces:
- all
events:
- delete
- name: services
namespaces:
- all
events:
- delete
- name: deployments
namespaces:
- all
events:
- delete
- name: ingresses
namespaces:
- all
events:
- delete
- name: nodes
namespaces:
- all
events:
- delete
- name: namespaces
namespaces:
- all
events:
- delete
- name: persistentvolumes
namespaces:
- all
events:
- delete
- name: secrets
namespaces:
- all
events:
- delete
- name: configmaps
namespaces:
- all
events:
- delete
- name: daemonsets
namespaces:
- all
events:
- delete
- name: jobs
namespaces:
- all
events:
- delete

# Events you want to watch
events:
types:
- normal
- warning

# RBAC events you want to watch
#rbac:
# - name: roles
# namespaces:
# - all
# events:
# - create
# - delete
# - name: rolebindings
# namespaces:
# - all
# events:
# - create
# - delete
# - name: clusterroles
# namespaces:
# - all
# events:
# - create
# - delete
# - name: clusterrolebindings
# namespace:
# - all
# events:
# - create
# - delete
#
# Recommendations you want to receive
recommendations: true

# Channels configuration
communications:
slack:
channel: 'SLACK_CHANNEL'
token: 'SLACK_API_TOKEN'

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

nodeSelector: {}

tolerations: []

affinity: {}

0 comments on commit c4ad77d

Please sign in to comment.