-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from Icinga/add-icinga-kuberentes
Add `Icinga Kubernetes`
- Loading branch information
Showing
19 changed files
with
361 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,5 @@ jobs: | |
run: | | ||
set -x | ||
cd charts/icinga-stack | ||
helm unittest . | ||
helm dependency update | ||
helm unittest . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
dependencies: | ||
- name: common | ||
version: 2.x.x | ||
repository: oci://registry-1.docker.io/bitnamicharts | ||
|
||
apiVersion: v2 | ||
name: icinga-kubernetes | ||
description: Icinga Kubernetes | ||
maintainers: | ||
- name: Icinga GmbH | ||
email: [email protected] | ||
url: https://icinga.com | ||
|
||
type: application | ||
version: 0.1.0 | ||
appVersion: "edge" |
27 changes: 27 additions & 0 deletions
27
charts/icinga-stack/charts/icinga-kubernetes/templates/_config.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{{/* | ||
Create the config | ||
*/}} | ||
{{- define "icinga-kubernetes.config" -}} | ||
# This is the configuration file for Icinga Kubernetes. | ||
|
||
# Connection configuration for the database to which Icinga Kubernetes synchronizes data. | ||
# This is also the database used in Icinga Kubernetes Web to view and work with the data. | ||
database: | ||
# Database type. Only 'mysql' is supported yet which is the default. | ||
# type: mysql | ||
|
||
# Database host or absolute Unix socket path. | ||
host: {{ if .Values.global.databases.kubernetes.enabled }} {{ .Release.Name }}-kubernetes-database {{ else }} {{ .Values.global.databases.kubernetes.host | quote }} {{ end }} | ||
|
||
# Database port. By default, the MySQL port. | ||
port: {{ .Values.global.databases.kubernetes.port | default 3306 }} | ||
|
||
# Database name. | ||
database: kubernetes | ||
|
||
# Database user. | ||
user: {{ .Values.global.databases.kubernetes.username.value }} | ||
|
||
# Database password. | ||
password: {{ .Values.global.databases.kubernetes.password.value }} | ||
{{- end -}} |
18 changes: 18 additions & 0 deletions
18
charts/icinga-stack/charts/icinga-kubernetes/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "icinga-kubernetes.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{- default (include "common.names.fullname" .) .Values.serviceAccount.name -}} | ||
{{- else -}} | ||
{{- default "default" .Values.serviceAccount.name -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create the name of the config map to use | ||
*/}} | ||
{{- define "icinga-kubernetes.configmapName" -}} | ||
{{- printf "%s-configuration" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
19 changes: 19 additions & 0 deletions
19
charts/icinga-stack/charts/icinga-kubernetes/templates/clusterrole.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{{- if .Values.rbac.create -}} | ||
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "common.names.fullname" . }} | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
rules: | ||
- apiGroups: | ||
- '*' | ||
resources: | ||
- '*' | ||
verbs: | ||
- get | ||
- watch | ||
- list | ||
{{- end }} |
18 changes: 18 additions & 0 deletions
18
charts/icinga-stack/charts/icinga-kubernetes/templates/clusterrolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{- if .Values.rbac.create -}} | ||
kind: ClusterRoleBinding | ||
apiVersion: {{ include "common.capabilities.rbac.apiVersion" . }} | ||
metadata: | ||
name: {{ include "common.names.fullname" . }} | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "common.names.fullname" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "icinga-kubernetes.serviceAccountName" . }} | ||
namespace: {{ include "common.names.namespace" . | quote }} | ||
{{- end }} |
12 changes: 12 additions & 0 deletions
12
charts/icinga-stack/charts/icinga-kubernetes/templates/configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "icinga-kubernetes.configmapName" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
data: | ||
config.yml: |- | ||
{{- include "icinga-kubernetes.config" . | nindent 4 }} |
39 changes: 39 additions & 0 deletions
39
charts/icinga-stack/charts/icinga-kubernetes/templates/deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{{ if .Values.enabled -}} | ||
apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} | ||
kind: Deployment | ||
metadata: | ||
name: {{ template "common.names.fullname" . }} | ||
namespace: {{ .Release.Namespace | quote }} | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- if .Values.commonAnnotations }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
replicas: 1 | ||
{{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels ) "context" . ) }} | ||
selector: | ||
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} | ||
template: | ||
metadata: | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} | ||
annotations: | ||
{{- if .Values.podAnnotations }} | ||
{{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
serviceAccountName: {{ include "icinga-kubernetes.serviceAccountName" . }} | ||
containers: | ||
- name: {{ .Chart.Name}} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
volumeMounts: | ||
- name: configuration | ||
mountPath: /config.yml | ||
subPath: config.yml | ||
volumes: | ||
- name: empty-dir | ||
emptyDir: {} | ||
- name: configuration | ||
configMap: | ||
name: {{ include "icinga-kubernetes.configmapName" . }} | ||
{{- end }} |
12 changes: 12 additions & 0 deletions
12
charts/icinga-stack/charts/icinga-kubernetes/templates/serviceaccount.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.serviceAccount.create }} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "icinga-kubernetes.serviceAccountName" . }} | ||
namespace: {{ include "common.names.namespace" . | quote }} | ||
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} | ||
{{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }} | ||
{{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceAccount.annotations .Values.commonAnnotations ) "context" . ) }} | ||
annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $ ) | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
enabled: true | ||
|
||
image: | ||
repository: icinga/icinga-kubernetes | ||
tag: edge | ||
pullPolicy: Always | ||
|
||
rbac: | ||
create: true | ||
|
||
serviceAccount: | ||
create: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
charts/icinga-stack/tests/icinga-kubernetes_clusterrole_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
suite: "[Icinga Kubernetes] ClusterRole creation" | ||
templates: | ||
- ../charts/icinga-kubernetes/templates/clusterrole.yaml | ||
tests: | ||
- it: creates a ClusterRole if enabled | ||
values: | ||
- required_values.yaml | ||
set: | ||
icinga-kubernetes: | ||
rbac: | ||
create: true | ||
release: | ||
name: my-icinga | ||
namespace: my-namespace | ||
asserts: | ||
- containsDocument: | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
- equal: | ||
path: metadata.name | ||
value: my-icinga-icinga-kubernetes | ||
- contains: | ||
path: rules | ||
content: | ||
apiGroups: | ||
- '*' | ||
resources: | ||
- '*' | ||
verbs: | ||
- get | ||
- watch | ||
- list |
37 changes: 37 additions & 0 deletions
37
charts/icinga-stack/tests/icinga-kubernetes_clusterrolebinding_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
suite: "[Icinga Kubernetes] ClusterRoleBinding creation" | ||
templates: | ||
- ../charts/icinga-kubernetes/templates/clusterrolebinding.yaml | ||
tests: | ||
- it: creates a ClusterRoleBinding if enabled | ||
values: | ||
- required_values.yaml | ||
set: | ||
icinga-kubernetes: | ||
rbac: | ||
create: true | ||
release: | ||
name: my-icinga | ||
namespace: my-namespace | ||
asserts: | ||
- containsDocument: | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
- equal: | ||
path: metadata.name | ||
value: my-icinga-icinga-kubernetes | ||
- equal: | ||
path: roleRef.apiGroup | ||
value: rbac.authorization.k8s.io | ||
- equal: | ||
path: roleRef.kind | ||
value: ClusterRole | ||
- equal: | ||
path: roleRef.name | ||
value: my-icinga-icinga-kubernetes | ||
- contains: | ||
path: subjects | ||
content: | ||
kind: ServiceAccount | ||
name: my-icinga-icinga-kubernetes | ||
namespace: my-namespace | ||
|
21 changes: 21 additions & 0 deletions
21
charts/icinga-stack/tests/icinga-kubernetes_serviceaccount_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
suite: "[Icinga Kubernetes] ServiceAccount creation" | ||
templates: | ||
- ../charts/icinga-kubernetes/templates/serviceaccount.yaml | ||
tests: | ||
- it: creates a ServiceAccount if enabled | ||
values: | ||
- required_values.yaml | ||
set: | ||
icinga-kubernetes: | ||
serviceAccount: | ||
create: true | ||
release: | ||
name: my-icinga | ||
namespace: my-namespace | ||
asserts: | ||
- containsDocument: | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
- equal: | ||
path: metadata.name | ||
value: my-icinga-icinga-kubernetes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.