From 97dee7894bb772cd0e8ea033832963f629fa9c9b Mon Sep 17 00:00:00 2001 From: Juned Memon Date: Sun, 13 Aug 2017 22:30:21 +0530 Subject: [PATCH] Added check-mk chart to incubator (#1486) * Added check-mk chart to incubator * Changed Name to gitusername --- incubator/check-mk/.helmignore | 21 +++++++++++ incubator/check-mk/Chart.yaml | 17 +++++++++ incubator/check-mk/templates/NOTES.txt | 19 ++++++++++ incubator/check-mk/templates/_helpers.tpl | 16 +++++++++ incubator/check-mk/templates/deployment.yaml | 37 ++++++++++++++++++++ incubator/check-mk/templates/ingress.yaml | 32 +++++++++++++++++ incubator/check-mk/templates/service.yaml | 19 ++++++++++ incubator/check-mk/values.yaml | 37 ++++++++++++++++++++ 8 files changed, 198 insertions(+) create mode 100755 incubator/check-mk/.helmignore create mode 100755 incubator/check-mk/Chart.yaml create mode 100755 incubator/check-mk/templates/NOTES.txt create mode 100755 incubator/check-mk/templates/_helpers.tpl create mode 100755 incubator/check-mk/templates/deployment.yaml create mode 100755 incubator/check-mk/templates/ingress.yaml create mode 100755 incubator/check-mk/templates/service.yaml create mode 100755 incubator/check-mk/values.yaml diff --git a/incubator/check-mk/.helmignore b/incubator/check-mk/.helmignore new file mode 100755 index 0000000000..f0c1319444 --- /dev/null +++ b/incubator/check-mk/.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/incubator/check-mk/Chart.yaml b/incubator/check-mk/Chart.yaml new file mode 100755 index 0000000000..d8490897bf --- /dev/null +++ b/incubator/check-mk/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +description: check_mk monitoring +engine: gotpl +home: https://mathias-kettner.de/check_mk.html +icon: http://git.mathias-kettner.de/git/?p=check_mk.git;a=blob_plain;f=web/htdocs/images/logo_mk.png;h=f41c2227828b79c035fa2e2d3fba5ec939c6f2c3;hb=HEAD +keywords: +- check_mk +- nagios +- monitoring +maintainers: +- email: junaid18183@gmail.com + name: junaid18183 +name: check-mk +sources: +- https://github.com/kubernetes/charts +- http://git.mathias-kettner.de/git/ +version: 0.1.0 diff --git a/incubator/check-mk/templates/NOTES.txt b/incubator/check-mk/templates/NOTES.txt new file mode 100755 index 0000000000..18915704d3 --- /dev/null +++ b/incubator/check-mk/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.hostname }} + http://{{- .Values.ingress.hostname }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT/mva/check_mk +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }}/mva/check_mk +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:5000 to use your application" + kubectl port-forward $POD_NAME 5000:{{ .Values.service.externalPort }}/mva/check_mk +{{- end }} + +The username/password are omdadmin/omd diff --git a/incubator/check-mk/templates/_helpers.tpl b/incubator/check-mk/templates/_helpers.tpl new file mode 100755 index 0000000000..f0d83d2edb --- /dev/null +++ b/incubator/check-mk/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/incubator/check-mk/templates/deployment.yaml b/incubator/check-mk/templates/deployment.yaml new file mode 100755 index 0000000000..d15e0f349d --- /dev/null +++ b/incubator/check-mk/templates/deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + livenessProbe: + httpGet: + path: / + port: {{ .Values.service.internalPort }} + readinessProbe: + httpGet: + path: / + port: {{ .Values.service.internalPort }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/incubator/check-mk/templates/ingress.yaml b/incubator/check-mk/templates/ingress.yaml new file mode 100755 index 0000000000..b09eb9075a --- /dev/null +++ b/incubator/check-mk/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "fullname" . -}} +{{- $servicePort := .Values.service.externalPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: / + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/incubator/check-mk/templates/service.yaml b/incubator/check-mk/templates/service.yaml new file mode 100755 index 0000000000..f311d10a0d --- /dev/null +++ b/incubator/check-mk/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + 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" . }} + release: {{ .Release.Name }} diff --git a/incubator/check-mk/values.yaml b/incubator/check-mk/values.yaml new file mode 100755 index 0000000000..6a73ff18af --- /dev/null +++ b/incubator/check-mk/values.yaml @@ -0,0 +1,37 @@ +# Default values for check-mk. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +image: + repository: "nlmacamp/check_mk" + tag: "latest" + pullPolicy: IfNotPresent +service: + name: check-mk + type: NodePort + externalPort: 80 + internalPort: 5000 +ingress: + enabled: false + # Used to create Ingress record (should used with service.type: ClusterIP). + hosts: + - monitor.ijuned.com + annotations: + kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + tls: + # Secrets must be manually created in the namespace. + # - secretName: chart-example-tls + # hosts: + # - chart-example.local +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