Skip to content

Commit

Permalink
Merge branch 'main' into icinga-web-admin_user
Browse files Browse the repository at this point in the history
  • Loading branch information
mocdaniel authored Feb 27, 2024
2 parents 377c105 + a413c2c commit b8fb94a
Show file tree
Hide file tree
Showing 32 changed files with 543 additions and 194 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/lint_test_charts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ jobs:
run: |
set -x
cd charts/icinga-stack
helm unittest .
helm dependency update
helm unittest .
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ To maintain a certain style of tests throughout the charts, please adhere to the

* Tests for subcharts should be placed in the `./tests` directory of the parent chart and prefixed with the subchart's name, e.g. `icingaweb2_deployment_test.yaml`.
* Tests should be grouped by the template they are testing.
* Test files should be named after the template they are testing, e.g. IcingaWeb2's `deployment.yaml` should be tested in `icingaweb2_deployment_test.yaml`.
* **Test Suites** should be prefixed with the name of the chart they test, e.g. *[Icinga2] Test Icinga2 persistence*
* Test files should be named after the template they are testing, e.g. Icinga Web's `deployment.yaml` should be tested in `icingaweb2_deployment_test.yaml`.
* **Test Suites** should be prefixed with the name of the product/chart they test, e.g. *[Icinga 2] Test Icinga 2 persistence*
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Icinga2 Kubernetes Helm Charts
# Icinga Kubernetes Helm Charts

This repository serves as a central repository to host all Icinga2 related Helm charts.
This repository serves as a central repository to host all Icinga related Helm charts.

[Icinga2](https://icinga.com) is a monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting.
[Icinga](https://icinga.com) is a monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting.

[Helm](https://helm.sh) is a tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources.

### Add Helm repository

First you need to add the Icinga2 Helm repository to your Helm installation. Helm repositories are similar to package repositories in Linux distributions as in they contain different available packages of
First you need to add the Icinga Helm repository to your Helm installation. Helm repositories are similar to package repositories in Linux distributions as in they contain different available packages of
Kubernetes manifests for users to consume.

The Icinga2 Helm repository is hosted on GitHub Pages and can be added to your Helm installation by running the following command:
The Icinga Helm repository is hosted on GitHub Pages and can be added to your Helm installation by running the following command:

```console
helm repo add icinga https://icinga.github.io/helm-charts
Expand All @@ -34,4 +34,4 @@ For information on how to contribute to this repository, see the [contribution g

## License

This project is licensed under the terms of the [Apache 2.0](LICENSE) open source license.
This project is licensed under the terms of the [Apache 2.0](LICENSE) open source license.
5 changes: 5 additions & 0 deletions charts/icinga-stack/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
dependencies:
- name: common
version: 2.x.x
repository: oci://registry-1.docker.io/bitnamicharts

apiVersion: v2
name: icinga-stack
description: Icinga is a monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting.
Expand Down
14 changes: 8 additions & 6 deletions charts/icinga-stack/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Icinga2 Kubernetes Helm Charts
# Icinga Kubernetes Helm Charts

> **WARNING**: This chart is currently in alpha state and should not be used in production. Breaking changes in future releases are well possible.
[Icinga2](https://icinga.com) is a monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting.
[Icinga](https://icinga.com) is a monitoring system which checks the availability of your network resources, notifies users of outages, and generates performance data for reporting.

[Helm](https://helm.sh) is a tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources.

Expand All @@ -19,19 +19,19 @@ This chart bootstraps a complete Icinga environment on a [Kubernetes](http://kub

### Add Helm repository

First you need to add the Icinga2 Helm repository to your Helm installation. Helm repositories are similar to package repositories in Linux distributions as in they contain different available packages of
First you need to add the Icinga Helm repository to your Helm installation. Helm repositories are similar to package repositories in Linux distributions as in they contain different available packages of
Kubernetes manifests for users to consume.

The Icinga2 Helm repository is hosted on GitHub Pages and can be added to your Helm installation by running the following command:
The Icinga Helm repository is hosted on GitHub Pages and can be added to your Helm installation by running the following command:

```console
helm repo add icinga https://icinga.github.io/helm-charts
helm repo update
```

### Install Icinga2
### Install Icinga

Once the repository is known to your Helm installation, you can install Icinga2 by running the following command:
Once the repository is known to your Helm installation, you can install Icinga by running the following command:

```console
helm install <release-name> \
Expand All @@ -45,6 +45,8 @@ helm install <release-name> \
--set global.databases.icingaweb2.password.value=CHANGE-ME \
--set global.databases.icingadb.username.value=CHANGE-ME \
--set global.databases.icingadb.password.value=CHANGE-ME \
--set global.databases.kubernetes.username.value=CHANGE-ME \
--set global.databases.kubernetes.password.value=CHANGE-ME \
icinga/icinga-stack
```

Expand Down
16 changes: 16 additions & 0 deletions charts/icinga-stack/charts/icinga-kubernetes/Chart.yaml
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: info@icinga.com
url: https://icinga.com

type: application
version: 0.1.0
appVersion: "edge"
27 changes: 27 additions & 0 deletions charts/icinga-stack/charts/icinga-kubernetes/templates/_config.tpl
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 -}}
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 -}}

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 }}
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 }}
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 }}
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 }}
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 }}
12 changes: 12 additions & 0 deletions charts/icinga-stack/charts/icinga-kubernetes/values.yaml
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- define "icinga2.config" -}}
// Constants for Icinga2 from constants.conf
// Constants for Icinga 2 from constants.conf
const PluginDir = "/usr/lib/nagios/plugins"
const ManubulonPluginDir = "/usr/lib/nagios/plugins"
const PluginContribDir = "/usr/lib/nagios/plugins"
Expand Down
4 changes: 2 additions & 2 deletions charts/icinga-stack/charts/icingaweb2/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ maintainers:
- name: Daniel Bodky
email: daniel.bodky@netways.de
url: https://github.com/mocdaniel

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
Expand All @@ -25,4 +25,4 @@ version: 0.2.0
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "2.11.4"
appVersion: "2.12.1"
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
name: {{ .Values.auth.admin_password.credSecret | quote }}
key: {{ .Values.auth.admin_password.secretKey | quote }}
{{- else }}
{{ fail "IcingaWeb2 auth admin password not set. Set either .Values.icingaweb2.auth.admin_password.value or .Values.icingaweb2.auth.admin_password.credSecret and .Values.icingaweb2.auth.admin_password.secretKey" }}
{{ fail "Icinga Web auth admin password not set. Set either .Values.icingaweb2.auth.admin_password.value or .Values.icingaweb2.auth.admin_password.credSecret and .Values.icingaweb2.auth.admin_password.secretKey" }}
{{- end}}
- name: icingaweb.config.global.config_resource
value: {{ .Values.auth.resource | default .Values.global.databases.icingaweb2.database | quote }}
Expand Down
4 changes: 2 additions & 2 deletions charts/icinga-stack/charts/icingaweb2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ enabled: true

image:
repository: icinga/icingaweb2
tag: 2.11.4
pullPolicy: IfNotPresent
tag: 2.12.1
pullPolicy: Always

imagePullSecrets: []

Expand Down
Loading

0 comments on commit b8fb94a

Please sign in to comment.