From 534be49b769261a204438044f3a1e847223f973b Mon Sep 17 00:00:00 2001 From: "Javier J. Salmeron Garcia" Date: Thu, 19 Sep 2019 13:57:45 +0200 Subject: [PATCH 1/6] [bitnami/kibana] Add Kibana chart --- bitnami/kibana/.helmignore | 22 ++ bitnami/kibana/Chart.yaml | 18 + bitnami/kibana/README.md | 310 +++++++++++++++++ bitnami/kibana/requirements.lock | 6 + bitnami/kibana/requirements.yaml | 5 + bitnami/kibana/templates/NOTES.txt | 43 +++ bitnami/kibana/templates/_helpers.tpl | 314 +++++++++++++++++ bitnami/kibana/templates/configmap.yml | 16 + bitnami/kibana/templates/deployment.yaml | 188 ++++++++++ bitnami/kibana/templates/ingress.yaml | 39 +++ .../kibana/templates/plugins-configmap.yml | 18 + bitnami/kibana/templates/pvc.yaml | 15 + .../templates/saved-objects-configmap.yml | 38 +++ bitnami/kibana/templates/service.yaml | 36 ++ .../templates/tests/test-connection.yaml | 15 + bitnami/kibana/values-production.yaml | 322 ++++++++++++++++++ bitnami/kibana/values.yaml | 322 ++++++++++++++++++ 17 files changed, 1727 insertions(+) create mode 100644 bitnami/kibana/.helmignore create mode 100644 bitnami/kibana/Chart.yaml create mode 100644 bitnami/kibana/README.md create mode 100644 bitnami/kibana/requirements.lock create mode 100644 bitnami/kibana/requirements.yaml create mode 100644 bitnami/kibana/templates/NOTES.txt create mode 100644 bitnami/kibana/templates/_helpers.tpl create mode 100644 bitnami/kibana/templates/configmap.yml create mode 100644 bitnami/kibana/templates/deployment.yaml create mode 100644 bitnami/kibana/templates/ingress.yaml create mode 100644 bitnami/kibana/templates/plugins-configmap.yml create mode 100644 bitnami/kibana/templates/pvc.yaml create mode 100644 bitnami/kibana/templates/saved-objects-configmap.yml create mode 100644 bitnami/kibana/templates/service.yaml create mode 100644 bitnami/kibana/templates/tests/test-connection.yaml create mode 100644 bitnami/kibana/values-production.yaml create mode 100644 bitnami/kibana/values.yaml diff --git a/bitnami/kibana/.helmignore b/bitnami/kibana/.helmignore new file mode 100644 index 000000000..50af03172 --- /dev/null +++ b/bitnami/kibana/.helmignore @@ -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/ diff --git a/bitnami/kibana/Chart.yaml b/bitnami/kibana/Chart.yaml new file mode 100644 index 000000000..d8f94c529 --- /dev/null +++ b/bitnami/kibana/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +name: kibana +appVersion: 7.3.2 +description: Kibana is an open source, browser based analytics and search dashboard for Elasticsearch. +version: 0.0.1 +keywords: +- analitics +- monitoring +- metrics +- logs +home: https://www.elastic.co/products/kibana +sources: +- https://github.com/bitnami/bitnami-docker-kibana +maintainers: +- name: Bitnami + email: containers@bitnami.com +engine: gotpl +icon: https://bitnami.com/assets/stacks/kibana/img/kibana-stack-220x234.png diff --git a/bitnami/kibana/README.md b/bitnami/kibana/README.md new file mode 100644 index 000000000..46c713e99 --- /dev/null +++ b/bitnami/kibana/README.md @@ -0,0 +1,310 @@ +# Kibana + +[Kibana](https://kibana.com/) is an open source, browser based analytics and search dashboard for Elasticsearch. + +## TL;DR; + +```console +$ helm repo add bitnami https://charts.bitnami.com/bitnami + +# Option 1: With an existing Elasticsearch instance +$ helm install bitnami/kibana --set elasticsearch.external.hosts[0]= --set elasticsearch.external.port= + +# Option 2: With a bundled Elasticsearch instance +$ helm install bitnami/kibana --set elasticsearch.useBundled=true +``` + +## Introduction + +This chart bootstraps a [kibana](https://github.com/bitnami/bitnami-docker-kibana) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. + +## Installing the Chart + +This chart requires a Elasticsearch instance to work. The chart offers two options: + +- Use an already existing Elasticsearch instance. +- Deploy a new Elasticsearch instance. + + To install the chart with the release name `my-release`: + +```console +$ helm repo add bitnami https://charts.bitnami.com/bitnami + +# Option 1: With an existing Elasticsearch instance +$ helm install bitnami/kibana --set elasticsearch.external.hosts[0]= --set elasticsearch.external.port= + +# Option 2: With a bundled Elasticsearch instance +$ helm install bitnami/kibana --set elasticsearch.useBundled=true +``` + +These commands deploy kibana on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` statefulset: + +```console +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. Use the option `--purge` to delete all persistent volumes too. + +## Configuration + +The following tables lists the configurable parameters of the kibana chart and their default values. + +| Parameter | Description | Default | +| ------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------- | +| `global.imageRegistry` | Global Docker image registry | `nil` | +| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `global.storageClass` | Global storage class for dynamic provisioning | `nil` | +| `image.registry` | Kibana image registry | `docker.io` | +| `image.repository` | Kibana image name | `bitnami/kibana` | +| `image.tag` | Kibana image tag | `{TAG_NAME}` | +| `image.pullPolicy` | Kibana image pull policy | `IfNotPresent` | +| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `nameOverride` | String to partially override kibana.fullname template with a string (will prepend the release name) | `nil` | +| `fullnameOverride` | String to fully override kibana.fullname template with a string | `nil` | +| `replicaCount` | Number of replicas of the Kibana Pod | `1` | +| `updateStrategy` | Update strategy for deployment | `{type: "RollingUpdate"}` | +| `schedulerName` | Alternative scheduler | `nil` | +| `plugins` | Array containing the Kibana plugins to be installed in deployment | `[]` | +| `savedObjects.urls` | Array containing links to NDJSON files to be imported during Kibana initialization | `[]` | +| `savedObjects.configmap` | Configmap containing NDJSON files to be imported during Kibana initialization | `[]` | +| `extraConfiguration` | Extra settings to be added to the default kibana.yml defined in the chart configuration.yaml file | `nil` | +| `configurationCM` | ConfigMap containing a kibana.yml file that will replace the default one specified in configuration.yaml | `nil` | +| `extraEnvVars` | Array containing extra env vars to configure Kibana | `nil` | +| `extraEnvVarsCM` | ConfigMap containing extra env vars to configure Kibana | `nil` | +| `extraEnvVarsSecret` | Secret containing extra env vars to configure Kibana (in case of sensitive data) | `nil` | +| `extraVolumes` | Array of extra volumes to be added to the Kibana deployment (evaluated as template). Requires setting `extraVolumeMounts` | `nil` | +| `extraVolumeMounts` | Array of extra volume mounts to be added to the Kibana deployment (evaluated as template). Normally used with `extraVolumes`. | `nil` | +| `volumePermissions.enabled` | Enable init container that changes volume permissions in the data directory (for cases where the default k8s `runAsUser` and `fsUser` values do not work) | `false` | +| `volumePermissions.image.registry` | Init container volume-permissions image registry | `docker.io` | +| `volumePermissions.image.repository` | Init container volume-permissions image name | `bitnami/minideb` | +| `volumePermissions.image.tag` | Init container volume-permissions image tag | `stretch` | +| `volumePermissions.image.pullPolicy` | Init container volume-permissions image pull policy | `Always` | +| `volumePermissions.resources` | Init container resource requests/limit | `nil` | +| `persistence.enabled` | Enable persistence | `true` | +| `presistence.storageClass` | Storage class to use with the PVC | `nil` | +| `persistence.accessMode` | Access mode to the PV | `ReadWriteOnce` | +| `persistence.size` | Size for the PV | `10Gi` | +| `livenessProbe.enabled` | Enable/disable the Liveness probe | `true` | +| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `60` | +| `livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed.| `1` | +| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `readinessProbe.enabled` | Enable/disable the Readiness probe | `true` | +| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `5` | +| `readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `6` | +| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed.| `1` | +| `service.type` | Kubernetes Service type | | `ClusterIP` | +| `service.nodePort` | Port to bind to for NodePort service type (client port) | `nil` | +| `service.annotations` | Annotations for Kibana service | `{}` | +| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | +| `service.loadBalancerIP` | loadBalancerIP if Kibana service type is `LoadBalancer` | `nil` | +| `service.extraPorts` | Extra ports to expose in the service (normally used with the `sidecar` value) | `nil` | +| `forceInitScripts` | Force the execution of the init scripts located in `/docker-entrypoint-initdb.d` | `false` | +| `initScriptsCM` | ConfigMap containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time | `nil` | +| `initScriptsSecret` | Secret containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time (that contain sensitive data) | `nil` | +| `ingress.enabled` | Enable the use of the ingress controller to access the web UI | `false` | +| `ingress.annotations` | Annotations for the Kibana Ingress | `{}` | +| `ingress.hosts` | Add hosts to the ingress controller with name and path | `name: kibana.local`, `path: /` | +| `ingress.tls` | Configure TLS for the Kibana Ingress | `[]` | +| `securityContext.enabled` | Enable securityContext on for Kibana deployment | `true` | +| `securityContext.runAsUser` | User for the security context | `1001` | +| `securityContext.fsGroup` | Group to configure permissions for volumes | `1001` | +| `securityContext.runAsNonRoot` | Run containers as non-root users | `true` | +| `resources` | Configure resource requests and limits | `nil` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `tolerations` | Tolerations for pod assignment | `[]` | +| `affinity` | Affinity for pod assignment | `{}` | +| `podAnnotations` | Pod annotations | `{}` | +| `sidecars` | Attach additional containers to the pod | `nil` | +| `initContainers` | Add additional init containers to the pod | `nil` | +| `metrics.enabled` | Start a side-car prometheus exporter | `false` | +| `metrics.service.annotations` | Prometheus annotations for the Kibana service | `{ prometheus.io/scrape: "true", prometheus.io/port: "80", prometheus.io/path: "_prometheus/metrics" }` | +| `elasticsearch.useBundled` | Use bundled Elasticsearch | `false` | +| `elasticsearch.external.hosts` | Array containing the hostnames for the already existing Elasticsearch instances | `nil` | +| `elasticsearch.external.port` | Port for the accessing external Elasticsearch instances | `nil` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install --name my-release \ + --set admin.user=admin-user bitnami/kibana +``` + +The above command sets the Kibana admin user to `admin-user`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml bitnami/kibana +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +### Using custom configuration + +The Bitnami Kibana chart supports using custom configuration settings. For example, to mount a custom `kibana.yml` you can create a ConfigMap like the following: + +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: myconfig +data: + kibana.yml: |- + # Raw text of the file +``` + +And now you need to pass the ConfigMap name, to the corresponding parameter: + +```console +$ helm install bitnami/kibana --set configurationCM=myconfig +``` + +An alternative is to provide extra configuration settings to the default kibana.yml that the chart deploys. This is done using the `extraConfiguration` value: + +```yaml +extraConfiguration: + "server.maxPayloadBytes": 1048576 + "server.pingTimeout": 1500 +``` + +### Adding extra environment variables + +In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the `extraEnvVars` property. + +```yaml +extraEnvVars: + - name: ELASTICSEARCH_VERSION + value: 6 +``` + +Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the `extraEnvVarsCM` or the `extraEnvVarsSecret` values. + +### Using custom init scripts + +For advanced operations, the Bitnami Kibana charts allows using custom init scripts that will be mounted in `/docker-entrypoint.init-db`. You can use a ConfigMap or a Secret (in case of sensitive data) for mounting these extra scripts. + +```console +kubectl create configmap special-scripts --from-file=01_install_kibana_theme.sh --from-file=02_add_special_agent.sh +kubectl create secret generic special-scripts-sensitive --from-file=03_install_company_certificates.sh +``` + +Then use the `initScriptsCM` and `initScriptsSecret` values. + +```console +helm install bitnami/kibana elasticsearch.useBundled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 --set initScriptsCM=special-scripts --set initScriptsSecret=special-scripts-sensitive +``` + +### Installing plugins + +The Bitnami Kibana chart allows you to install a set of plugins at deployment time using the `plugins` value: + +```console +helm install bitnami/kibana elasticsearch.useBundled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 --set plugins[0]=https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip +``` + +> **NOTE** Make sure that the plugin is available for the Kibana version you are deploying + +### Importing saved objects + +If you have visualizations and dashboards (in NDJSON format) that you want to import to Kibana. You can create a ConfigMap that includes them. + +```console +kubectl create configmap my-import --from-file=my-exported-data.ndjson +``` + +Then install the chart with the `savedObjects.configmap` value: + +```console +helm install bitnami/kibana --set savedObjects.configmap=my-import +``` + +Alternatively, if it is available via URL, you can install the chart as follows + +```console +helm install bitnami/kibana --set savedObjects.urls[0]=www.my-site.com/import.ndjson +``` + +## Sidecars and Init Containers + +If you have a need for additional containers to run within the same pod as Kibana (e.g. an additional metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec. + +```yaml +sidecars: +- name: your-image-name + image: your-image + imagePullPolicy: Always + ports: + - name: portname + containerPort: 1234 +``` + +Similarly, you can add extra init containers using the `initContainers` parameter. + +```yaml +initContainers: +- name: your-image-name + image: your-image + imagePullPolicy: Always + ports: + - name: portname + containerPort: 1234 +``` + +### Production configuration + +This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. + +```console +$ helm install --name my-release -f ./values-production.yaml --set elasticsearch.useBundled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 bitnami/kibana +``` + +- Disable bundled Elasticsearch + +```diff +- elasticsearch.useBundled: true ++ elasticsearch.useBundled: false +``` + +- Enable metrics scraping + +```diff +- metrics.enabled: false ++ metrics.enabled: true +``` + +## Persistence + +The [Bitnami Kibana](https://github.com/bitnami/bitnami-docker-kibana) image can persist data. If enabled, the persisted path is `/bitnami/kibana` by default. + +The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) at this location. The volume is created using dynamic volume provisioning. + +## Adding extra volumes + +The Bitnami Kibana chart supports mounting extra volumes (either PVCs, secrets or configmaps) by using the `extraVolumes` and `extraVolumeMounts` property. This can be combined with advanced operations like adding extra init containers and sidecars. + +### Adjust permissions of persistent volume mountpoint + +As the image run as non-root by default, it is necessary to adjust the ownership of the persistent volume so that the container can write data into it. + +By default, the chart is configured to use Kubernetes Security Context to automatically change the ownership of the volume. However, this feature does not work in all Kubernetes distributions. +As an alternative, this chart supports using an initContainer to change the ownership of the volume before mounting it in the final destination. + +You can enable this initContainer by setting `volumePermissions.enabled` to `true`. + +### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/) + +It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image. + +Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist. diff --git a/bitnami/kibana/requirements.lock b/bitnami/kibana/requirements.lock new file mode 100644 index 000000000..b120747c2 --- /dev/null +++ b/bitnami/kibana/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: elasticsearch + repository: https://charts.bitnami.com/bitnami + version: 6.3.6 +digest: sha256:a9ce67ddb82e0d519793a27a9f74c7a0d5b29d2ea31f155b6ab2264063521d63 +generated: "2019-09-19T13:57:56.920138+02:00" diff --git a/bitnami/kibana/requirements.yaml b/bitnami/kibana/requirements.yaml new file mode 100644 index 000000000..fdb302ac1 --- /dev/null +++ b/bitnami/kibana/requirements.yaml @@ -0,0 +1,5 @@ +dependencies: +- name: elasticsearch + version: 6.x.x + repository: https://charts.bitnami.com/bitnami + condition: elasticsearch.useBundled diff --git a/bitnami/kibana/templates/NOTES.txt b/bitnami/kibana/templates/NOTES.txt new file mode 100644 index 000000000..d98003429 --- /dev/null +++ b/bitnami/kibana/templates/NOTES.txt @@ -0,0 +1,43 @@ +** Please be patient while the chart is being deployed ** + +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "kibana.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- 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 --namespace {{ .Release.Namespace }} svc -w {{ include "kibana.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "kibana.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "kibana.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:80 +{{- end }} + +{{- if or .Values.ingress.enabled (contains "NodePort" .Values.service.type) (contains "LoadBalancer" .Values.service.type) }} + +WARNING: Kibana is externally accessible from the cluster but the dashboard does not contain authentication mechanisms. Make sure you follow the authentication guidelines in your Elastic stack. ++info https://www.elastic.co/guide/en/elastic-stack-overview/current/setting-up-authentication.html +{{- end }} + +{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | toString | regexFind "-r\\d+$|sha256:")) }} + +WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ +{{- end }} + +{{- if .Values.metrics.enabled }} + +WARNING: For Prometheus metrics to work, make sure that the kibana-prometheus-exporter plugin is installed: ++info https://github.com/pjhampton/kibana-prometheus-exporter +{{- end }} + +{{ include "kibana.validateValues" . }} diff --git a/bitnami/kibana/templates/_helpers.tpl b/bitnami/kibana/templates/_helpers.tpl new file mode 100644 index 000000000..90a706fa3 --- /dev/null +++ b/bitnami/kibana/templates/_helpers.tpl @@ -0,0 +1,314 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "kibana.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "kibana.imagePullSecrets" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +Also, we can not use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} +{{- if .Values.global.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.global.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- else if or .Values.image.pullSecrets .Values.volumePermissions.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.volumePermissions.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- else if or .Values.image.pullSecrets .Values.volumePermissions.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- range .Values.volumePermissions.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- end -}} + +{{/* +Return true if the deployment should include dashboards +*/}} +{{- define "kibana.importSavedObjects" -}} +{{- if or .Values.savedObjects.configmap .Values.savedObjects.urls }} + {{- true -}} +{{- end -}} +{{- end -}} + +{{/* +Return the proper Kibana image name +*/}} +{{- define "kibana.image" -}} +{{- $registryName := .Values.image.registry -}} +{{- $repositoryName := .Values.image.repository -}} +{{- $tag := .Values.image.tag | toString -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. +Also, we can't use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} + {{- if .Values.global.imageRegistry }} + {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} + {{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} + {{- end -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} +{{- 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 "kibana.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 a default fully qualified elasticsearch name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "kibana.elasticsearch.fullname" -}} +{{- if .Values.elasticsearch.fullnameOverride -}} +{{- .Values.elasticsearch.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default "elasticsearch" .Values.elasticsearch.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "kibana.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "kibana.elasticsearch.url" -}} +{{- if not .Values.elasticsearch.useBundled -}} +{{- if .Values.elasticsearch.external.hosts -}} +{{- $totalHosts := len .Values.elasticsearch.external.hosts -}} +{{- range $i, $host := .Values.elasticsearch.external.hosts -}} +{{- printf "http://%s:%s" $host (include "kibana.elasticsearch.port" $) -}} +{{- if (lt ( add1 $i ) $totalHosts ) }}{{- printf "," -}}{{- end }} +{{- end -}} +{{- end -}} +{{- else -}} +{{- printf "http://%s:%s" (printf "%s-coordinating-only" (include "kibana.elasticsearch.fullname" .)) (include "kibana.elasticsearch.port" .) -}} +{{- end -}} +{{- end -}} + +{{/* +Set Elasticsearch Port. +*/}} +{{- define "kibana.elasticsearch.port" -}} +{{- if .Values.elasticsearch.useBundled -}} +{{- .Values.elasticsearch.coordinating.service.port -}} +{{- else -}} +{{- .Values.elasticsearch.external.port -}} +{{- end -}} +{{- end -}} + +{{/* +Set Elasticsearch Port. +*/}} +{{- define "kibana.pvc" -}} +{{- .Values.persistence.existingClaim | default (include "kibana.fullname" .) -}} +{{- end -}} + +{{/* +Get the initialization scripts Secret name. +*/}} +{{- define "kibana.initScriptsSecret" -}} +{{- printf "%s" (tpl .Values.initScriptsSecret $) -}} +{{- end -}} + +{{/* +Get the initialization scripts configmap name. +*/}} +{{- define "kibana.initScriptsCM" -}} +{{- printf "%s" (tpl .Values.initScriptsCM $) -}} +{{- end -}} + +{{/* +Return the proper image name (for the init container volume-permissions image) +*/}} +{{- define "kibana.volumePermissions.image" -}} +{{- $registryName := .Values.volumePermissions.image.registry -}} +{{- $repositoryName := .Values.volumePermissions.image.repository -}} +{{- $tag := .Values.volumePermissions.image.tag | toString -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. +Also, we can't use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} + {{- if .Values.global.imageRegistry }} + {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} + {{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} + {{- end -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} +{{- end -}} + +{{/* +Get the saved objects configmap name. +*/}} +{{- define "kibana.savedObjectsCM" -}} +{{- printf "%s" (tpl .Values.savedObjects.configmap $) -}} +{{- end -}} + +{{/* +Set Elasticsearch Port. +*/}} +{{- define "kibana.configurationCM" -}} +{{- .Values.configurationCM | default (printf "%s-conf" (include "kibana.fullname" .)) -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "kibana.labels" -}} +app.kubernetes.io/name: {{ include "kibana.name" . }} +helm.sh/chart: {{ include "kibana.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Return the proper Storage Class +*/}} +{{- define "kibana.storageClass" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +*/}} +{{- if .Values.global -}} + {{- if .Values.global.storageClass -}} + {{- if (eq "-" .Values.global.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.global.storageClass -}} + {{- end -}} + {{- else -}} + {{- if .Values.persistence.storageClass -}} + {{- if (eq "-" .Values.persistence.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.persistence.storageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.persistence.storageClass -}} + {{- if (eq "-" .Values.persistence.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.persistence.storageClass -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Compile all warnings into a single message, and call fail. +*/}} +{{- define "kibana.validateValues" -}} +{{- $messages := list -}} +{{- $messages := append $messages (include "kibana.validateValues.noElastic" .) -}} +{{- $messages := append $messages (include "kibana.validateValues.elasticConflict" .) -}} +{{- $messages := append $messages (include "kibana.validateValues.externalESSettings" .) -}} +{{- $messages := append $messages (include "kibana.validateValues.configConflict" .) -}} +{{- $messages := append $messages (include "kibana.validateValues.extraVolumes" .) -}} +{{- $messages := without $messages "" -}} +{{- $message := join "\n" $messages -}} + +{{- if $message -}} +{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}} +{{- end -}} +{{- end -}} + + +{{/* Validate values of Kibana - must provide a ElasticSearch */}} +{{- define "kibana.validateValues.noElastic" -}} +{{- if and (not .Values.elasticsearch.useBundled) (not .Values.elasticsearch.external.hosts) (not .Values.elasticsearch.external.port) -}} +kibana: no-elasticsearch + You did not specify an external Elasticsearch instance nor enabled the bundled + one. Please set either elasticsearch.useBundled=true or set elasticsearch.external.hosts and elasticsearch.external.port +{{- end -}} +{{- end -}} + +{{/* Validate values of Kibana - conflict with ElasticSearch */}} +{{- define "kibana.validateValues.elasticConflict" -}} +{{- if and (.Values.elasticsearch.useBundled) (.Values.elasticsearch.external.hosts) -}} +kibana: conflict-elasticsearch + You specified both the external Elasticsearch instance and the bundled one. + Please only set either elasticsearch.useBundled=true or elasticsearch.external.hosts +{{- end -}} +{{- end -}} + +{{/* Validate values of Kibana - Missing external ES Setting */}} +{{- define "kibana.validateValues.externalESSettings" -}} +{{- if (not .Values.elasticsearch.useBundled) }} +{{- if and (not .Values.elasticsearch.external.hosts) .Values.elasticsearch.external.port }} +kibana: missing-es-settings-host + You specified the external Elasticsearch port but not the host. Please + set elasticsearch.external.hosts +{{- end -}} +{{- if and .Values.elasticsearch.external.hosts (not .Values.elasticsearch.external.port) }} +kibana: missing-es-settings-port + You specified the external Elasticsearch hosts but not the port. Please + set elasticsearch.external.port +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* Validate values of Kibana - configuration conflict */}} +{{- define "kibana.validateValues.configConflict" -}} +{{- if and (.Values.extraConfiguration) (.Values.configurationCM) -}} +kibana: conflict-configuration + You specified a ConfigMap with kibana.yml and a set of settings to be added + to the default kibana.yml. Please only set either extraConfiguration or configurationCM +{{- end -}} +{{- end -}} + +{{/* Validate values of Kibana - Incorrect extra volume settings */}} +{{- define "kibana.validateValues.extraVolumes" -}} +{{- if and (.Values.extraVolumes) (not .Values.extraVolumeMounts) -}} +kibana: missing-extra-volume-mounts + You specified extra volumes but not mount points for them. Please set + the extraVolumeMounts value +{{- end -}} +{{- end -}} diff --git a/bitnami/kibana/templates/configmap.yml b/bitnami/kibana/templates/configmap.yml new file mode 100644 index 000000000..461e478de --- /dev/null +++ b/bitnami/kibana/templates/configmap.yml @@ -0,0 +1,16 @@ +{{- if not .Values.configurationCM }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "kibana.fullname" . }}-conf + labels: {{ include "kibana.labels" . | nindent 4 }} +data: + kibana.yml: | + pid.file: /opt/bitnami/kibana/tmp/kibana.pid + server.host: 0.0.0.0 + server.port: 5601 + elasticsearch.hosts: [{{ include "kibana.elasticsearch.url" . }}] + {{- if .Values.extraConfiguration }} + {{- tpl (toYaml .Values.extraConfiguration) $ | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/bitnami/kibana/templates/deployment.yaml b/bitnami/kibana/templates/deployment.yaml new file mode 100644 index 000000000..69889a66e --- /dev/null +++ b/bitnami/kibana/templates/deployment.yaml @@ -0,0 +1,188 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "kibana.fullname" . }} + labels: +{{ include "kibana.labels" . | indent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- tpl (toYaml .Values.updateStrategy) $ | nindent 4 }} + {{- end }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "kibana.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "kibana.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + {{- if .Values.schedulerName }} + schedulerName: {{ .Values.schedulerName | quote }} + {{- end }} +{{- include "kibana.imagePullSecrets" . | indent 6 }} + {{- if .Values.securityContext.enabled }} + securityContext: + fsGroup: {{ .Values.securityContext.fsGroup }} + {{- end }} + {{- if or .Values.initContainers (and .Values.volumePermissions.enabled .Values.persistence.enabled) }} + initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + - name: volume-permissions + image: "{{ template "kibana.volumePermissions.image" . }}" + imagePullPolicy: {{ default "" .Values.volumePermissions.image.pullPolicy | quote }} + command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "{{ .Values.persistence.mountPath }}"] + securityContext: + runAsUser: 0 + resources: {{ toYaml .Values.volumePermissions.resources | nindent 10 }} + volumeMounts: + - name: data + mountPath: {{ .Values.persistence.mountPath }} + {{- end }} + {{- if .Values.initContainers }} + {{- tpl (toYaml .Values.initContainers) $ | nindent 6 }} + {{- end }} + {{- end }} + containers: + - name: kibana + image: {{ include "kibana.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.securityContext.enabled }} + securityContext: + runAsUser: {{ .Values.securityContext.runAsUser }} + {{- end }} + env: + - name: KIBANA_ELASTICSEARCH_URL + value: {{ include "kibana.elasticsearch.url" . | quote }} + - name: KIBANA_ELASTICSEARCH_PORT + value: {{ include "kibana.elasticsearch.port" . | quote }} + - name: KIBANA_FORCE_INITSCRIPTS + value: {{ .Values.forceInitScripts | quote }} + {{- if .Values.extraEnvVars }} + {{- tpl (toYaml .Values.extraEnvVars) $ | nindent 12 }} + {{- end }} + {{- if or .Values.extraEnvVarsCM .Values.extraEnvVarsSecret }} + envFrom: + {{- if .Values.extraEnvVarsCM }} + - configMapRef: + name: {{ .Values.extraEnvVarsCM }} + {{- end }} + {{- if .Values.extraEnvVarsSecret }} + - secretRef: + name: {{ .Values.extraEnvVarsSecret }} + {{- end }} + {{- end }} + ports: + - name: http + containerPort: 5601 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- if .Values.resources }} + resources: + {{- tpl (toYaml .Values.resources) $ | nindent 12 }} + {{- end }} + volumeMounts: + - name: kibana-data + mountPath: /bitnami/kibana + - name: kibana-config + mountPath: /bitnami/kibana/conf + {{- if .Values.plugins }} + - name: plugins-init-scripts + mountPath: /docker-entrypoint-initdb.d/plugin-install + {{- end }} + {{- if (include "kibana.importSavedObjects" .) }} + - name: saved-objects-init-scripts + mountPath: /docker-entrypoint-initdb.d/saved-objects-import + {{- end }} + {{- if .Values.savedObjects.configmap }} + - name: saved-objects-configmap + mountPath: /bitnami/kibana/saved-objects + {{- end }} + {{- if .Values.initScriptsCM }} + - name: custom-init-scripts-cm + mountPath: /docker-entrypoint-initdb.d/cm + {{- end }} + {{- if .Values.initScriptsSecret }} + - name: custom-init-scripts-secret + mountPath: /docker-entrypoint-initdb.d/secret + {{- end }} + {{- if .Values.extraVolumeMounts }} + {{- tpl (toYaml .Values.extraVolumeMounts) $ | nindent 6 }} + {{- end }} + {{- if .Values.sidecars }} + {{- tpl (toYaml .Values.sidecars) $ | nindent 6 }} + {{- end }} + volumes: + - name: kibana-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "kibana.pvc" . }} + {{- else }} + emptyDir: {} + {{ end }} + - name: kibana-config + configMap: + name: {{ include "kibana.configurationCM" . }} + {{- if (include "kibana.importSavedObjects" .) }} + - name: saved-objects-init-scripts + configMap: + name: {{ include "kibana.fullname" . }}-saved-objects + defaultMode: 0755 + {{- end }} + {{- if .Values.plugins }} + - name: plugins-init-scripts + configMap: + name: {{ include "kibana.fullname" . }}-plugins + defaultMode: 0755 + {{- end }} + {{- if .Values.initScriptsCM }} + - name: custom-init-scripts-cm + configMap: + name: {{ template "kibana.initScriptsCM" . }} + defaultMode: 0755 + {{- end }} + {{- if .Values.initScriptsSecret }} + - name: custom-init-scripts-secret + secret: + name: {{ template "kibana.initScriptsSecret" . }} + defaultMode: 0755 + {{- end }} + {{- if .Values.savedObjects.configmap }} + - name: saved-objects-configmap + configMap: + name: {{ template "kibana.savedObjectsCM" . }} + {{- end }} + {{- if .Values.extraVolumes }} + {{- tpl (toYaml .Values.extraVolumes) $ | nindent 6 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: + {{- tpl (toYaml .Values.nodeSelector) $ | nindent 6 }} + {{- end }} + {{- if .Values.affinity }} + affinity: + {{- tpl (toYaml .Values.affinity) $ | nindent 6 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: + {{- tpl (toYaml .Values.tolerations) $ | nindent 6 }} + {{- end }} diff --git a/bitnami/kibana/templates/ingress.yaml b/bitnami/kibana/templates/ingress.yaml new file mode 100644 index 000000000..d40d12098 --- /dev/null +++ b/bitnami/kibana/templates/ingress.yaml @@ -0,0 +1,39 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "kibana.fullname" . -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: +{{ include "kibana.labels" . | indent 4 }} + annotations: + {{- if .Values.ingress.certManager }} + kubernetes.io/tls-acme: "true" + {{- end }} + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ include "kibana.fullname" $ }} + servicePort: http + {{- end }} + {{- end }} +{{- end }} diff --git a/bitnami/kibana/templates/plugins-configmap.yml b/bitnami/kibana/templates/plugins-configmap.yml new file mode 100644 index 000000000..27aee05e1 --- /dev/null +++ b/bitnami/kibana/templates/plugins-configmap.yml @@ -0,0 +1,18 @@ +{{- if .Values.plugins -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "kibana.fullname" . }}-plugins + labels: {{ include "kibana.labels" . | nindent 4 }} +data: + install-plugins.sh: | + #!/bin/bash + echo "==> Plugin installation" + {{- $totalPlugins := len .Values.plugins }} + echo "Total plugins defined in chart installation: {{ $totalPlugins }}" + {{- range $i, $plugin := .Values.plugins }} + echo "Installing plugin {{ add $i 1 }} out of {{ $totalPlugins }}: {{ $plugin }}" + kibana-plugin install "{{ $plugin }}" + {{- end }} + echo "==> End of Plugin installation" +{{- end -}} \ No newline at end of file diff --git a/bitnami/kibana/templates/pvc.yaml b/bitnami/kibana/templates/pvc.yaml new file mode 100644 index 000000000..adcfdff7b --- /dev/null +++ b/bitnami/kibana/templates/pvc.yaml @@ -0,0 +1,15 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "kibana.fullname" . }} + labels: +{{ include "kibana.labels" . | indent 4 }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{ include "kibana.storageClass" . }} +{{- end -}} diff --git a/bitnami/kibana/templates/saved-objects-configmap.yml b/bitnami/kibana/templates/saved-objects-configmap.yml new file mode 100644 index 000000000..4cab0c87f --- /dev/null +++ b/bitnami/kibana/templates/saved-objects-configmap.yml @@ -0,0 +1,38 @@ +{{- if (include "kibana.importSavedObjects" .) -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "kibana.fullname" . }}-saved-objects + labels: {{ include "kibana.labels" . | nindent 4 }} +data: + import-saved-objects.sh: | + #!/bin/bash + echo "==> Saved objects import" + {{- if .Values.savedObjects.urls }} + {{- $totalURLs := len .Values.savedObjects.urls }} + echo "Total saved objects NDJSON URLs to import: {{ $totalURLs }}" + {{- range $i, $url := .Values.savedObjects.urls }} + echo "Importing saved objects from NDJSON in url {{ add $i 1 }} out of {{ $totalURLs }}: {{ $url }}" + download_tmp_file="$(mktemp)" + curl "{{$url}}" > "${download_tmp_file}.ndjson" + curl -s --connect-timeout 60 --max-time 60 -XPOST localhost:5601/api/saved_objects/_import -H 'kbn-xsrf:true' --form file=@${download_tmp_file}.ndjson + {{- end }} + {{- end }} + {{- if .Values.savedObjects.configmap }} + echo "Searching for dashboard NDJSON files from ConfigMap mounted in /bitnami/kibana/saved-objects" + ndjson_file_list_tmp="$(mktemp)" + find /bitnami/kibana/saved-objects -type f -regex ".*\.ndjson" > $ndjson_file_list_tmp + while read -r f; do + case "$f" in + *.ndjson) + echo "Importing $f" + curl -s --connect-timeout 60 --max-time 60 -XPOST localhost:5601/api/saved_objects/_import -H 'kbn-xsrf:true' --form file=@${f} + ;; + *) + echo "Ignoring $f" + ;; + esac + done < $ndjson_file_list_tmp + {{- end }} + echo "==> End of Saved objects import" +{{- end -}} \ No newline at end of file diff --git a/bitnami/kibana/templates/service.yaml b/bitnami/kibana/templates/service.yaml new file mode 100644 index 000000000..326ad0972 --- /dev/null +++ b/bitnami/kibana/templates/service.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "kibana.fullname" . }} + labels: +{{ include "kibana.labels" . | indent 4 }} +{{- if or (and .Values.metrics.enabled .Values.metrics.service.annotations) .Values.service.annotations }} + annotations: + {{- if and .Values.metrics.enabled .Values.metrics.service.annotations }} + {{- tpl (toYaml .Values.metrics.service.annotations) $ | nindent 4 }} + {{- end }} + {{- if and .Values.service.annotations }} + {{- tpl (toYaml .Values.service.annotations) $ | nindent 4 }} + {{- end }} +{{- end }} + +spec: + type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + ports: + - name: http + port: {{ .Values.service.port }} + targetPort: http + {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort)))}} + nodePort: {{ .Values.service.nodePort }} + {{- else if eq .Values.service.type "ClusterIP" }} + nodePort: null + {{- end }} +{{- if .Values.service.extraPorts }} + {{- tpl (toYaml .Values.service.extraPorts) $ | nindent 4 }} +{{- end }} + selector: + app.kubernetes.io/name: {{ include "kibana.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/bitnami/kibana/templates/tests/test-connection.yaml b/bitnami/kibana/templates/tests/test-connection.yaml new file mode 100644 index 000000000..bdbc57e16 --- /dev/null +++ b/bitnami/kibana/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "kibana.fullname" . }}-test-connection" + labels: +{{ include "kibana.labels" . | indent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "kibana.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/bitnami/kibana/values-production.yaml b/bitnami/kibana/values-production.yaml new file mode 100644 index 000000000..aa2b8f356 --- /dev/null +++ b/bitnami/kibana/values-production.yaml @@ -0,0 +1,322 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Bitnami Kibana image version +## ref: https://hub.docker.com/r/bitnami/kibana/tags/ +## +image: + registry: docker.io + repository: bitnami/kibana + tag: 7.3.2-debian-9-r7 + pullPolicy: IfNotPresent + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + +## String to partially override kibana.fullname template (will maintain the release name) +## +# nameOverride: + +## String to fully override kibana.fullname template +## +# fullnameOverride: + +## Number of Kibana Pod replicas +## +replicaCount: 1 + +## Set up update strategy for Kibana installation. Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to makesure the pods are destroyed first. +## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy +## Example: +# updateStrategy: +# type: RollingUpdate +# rollingUpdate: +# maxSurge: 25% +# maxUnavailable: 25% +updateStrategy: + type: RollingUpdate + +## Use an alternate scheduler, e.g. "stork". +## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ +## +# schedulerName: + +## List of plugins to install +plugins: + # - https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip + +## Saved objects to import (NDJSON format) +savedObjects: + ## List of saved objects URLs + urls: + # - www.example.com/dashboard.ndjson + ## ConfigMap with saved objects + configmap: + +## Extra configuration settings +# extraConfiguration: + +## Configuration ConfigMap +# configurationCM: + +## An array to add extra env vars +## For example: +## extraEnvVars: +## - name: KIBANA_ELASTICSEARCH_URL +## value: test +## +# extraEnvVars: + +## An array to add extra configmaps: +## For example: +## extraEnvVarsCM: + +## An array to add extra configmaps: +## For example: +## extraEnvVarsSecret: + +## extraVolumes: {} + +## extraVolumeMounts: {} + +## +## Init containers parameters: +## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/minideb + tag: stretch + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + resources: {} + # resources: + # requests: + # memory: 128Mi + # cpu: 100m + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +## +persistence: + enabled: true + ## wordpress data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + accessMode: ReadWriteOnce + size: 10Gi + +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) +## +livenessProbe: + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + +## Force execution of init scripts +forceInitScripts: false + +## Configmap with init scripts to execute +# initScriptsCM: + +## Secret with init scripts to execute (for sensitive data) +# initScriptsSecret: + +## Service configuration +## +service: + port: 80 + type: ClusterIP + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: {} + + ## loadBalancerIP for the PrestaShop Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + # loadBalancerIP: + ## Extra ports to expose (normally used with the `sidecar` value) + # extraPorts: + +## Configure the ingress resource that allows you to access the +## Kibana web. Set up the URL +## ref: http://kubernetes.io/docs/user-guide/ingress/ +## +ingress: + ## Set to true to enable ingress record generation + enabled: false + + ## Set this to true in order to add the corresponding annotations for cert-manager + certManager: false + + ## Ingress annotations done as key:value pairs + ## For a full list of possible ingress annotations, please see + ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md + ## + ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set + ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set + # annotations: + # kubernetes.io/ingress.class: nginx + + ## The list of hostnames to be covered with this ingress record. + ## Most likely this will be just one host, but in the event more hosts are needed, this is an array + hosts: + - host: kibana.local + paths: ["/"] + + ## The tls configuration for the ingress + ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +## SecurityContext configuration +## +securityContext: + enabled: true + runAsUser: 1001 + fsGroup: 1001 + runAsNonRoot: true + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## Example: +## resources: +## requests: +## memory: 512Mi +## cpu: 300m +## +# resources: + +## Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## Tolerations for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## Affinity for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## Pod annotations +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} + +sidecars: +## Add sidecars to the pod. +## e.g. +# - name: your-image-name + # image: your-image + # imagePullPolicy: Always + # ports: + # - name: portname + # containerPort: 1234 + +initContainers: +## Add init containers to the pod. +## e.g. +# - name: your-image-name + # image: your-image + # imagePullPolicy: Always + # ports: + # - name: portname + # containerPort: 1234 + +## Prometheus Exporter / Metrics +## +metrics: + enabled: true + podAnnotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9112" + + ## Metrics exporter resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + # resources: {} + + ## Metrics exporter labels and tolerations for pod assignment + # nodeSelector: {"beta.kubernetes.io/arch": "amd64"} + # tolerations: [] + + ## Metrics exporter pod Annotation and Labels + # podAnnotations: {} + # podLabels: {} + + +metrics: + enabled: false + service: + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "80" + prometheus.io/path: "_prometheus/metrics" + +## Properties for Elasticsearch +elasticsearch: + useBundled: false + ## Properties when useBundled is false + external: + hosts: + # - elasticsearch-1 + # - elasticsearch-2 + port: diff --git a/bitnami/kibana/values.yaml b/bitnami/kibana/values.yaml new file mode 100644 index 000000000..611abe4e8 --- /dev/null +++ b/bitnami/kibana/values.yaml @@ -0,0 +1,322 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Bitnami Kibana image version +## ref: https://hub.docker.com/r/bitnami/kibana/tags/ +## +image: + registry: docker.io + repository: bitnami/kibana + tag: 7.3.2-debian-9-r7 + pullPolicy: IfNotPresent + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + +## String to partially override kibana.fullname template (will maintain the release name) +## +# nameOverride: + +## String to fully override kibana.fullname template +## +# fullnameOverride: + +## Number of Kibana Pod replicas +## +replicaCount: 1 + +## Set up update strategy for Kibana installation. Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to makesure the pods are destroyed first. +## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy +## Example: +# updateStrategy: +# type: RollingUpdate +# rollingUpdate: +# maxSurge: 25% +# maxUnavailable: 25% +updateStrategy: + type: RollingUpdate + +## Use an alternate scheduler, e.g. "stork". +## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ +## +# schedulerName: + +## List of plugins to install +plugins: + # - https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip + +## Saved objects to import (NDJSON format) +savedObjects: + ## List of saved objects URLs + urls: + # - www.example.com/dashboard.ndjson + ## ConfigMap with saved objects + configmap: + +## Extra configuration settings +# extraConfiguration: + +## Configuration ConfigMap +# configurationCM: + +## An array to add extra env vars +## For example: +## extraEnvVars: +## - name: KIBANA_ELASTICSEARCH_URL +## value: test +## +# extraEnvVars: + +## An array to add extra configmaps: +## For example: +## extraEnvVarsCM: + +## An array to add extra configmaps: +## For example: +## extraEnvVarsSecret: + +## extraVolumes: {} + +## extraVolumeMounts: {} + +## +## Init containers parameters: +## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup +## +volumePermissions: + enabled: false + image: + registry: docker.io + repository: bitnami/minideb + tag: stretch + pullPolicy: Always + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + resources: {} + # resources: + # requests: + # memory: 128Mi + # cpu: 100m + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +## +persistence: + enabled: true + ## wordpress data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + accessMode: ReadWriteOnce + size: 10Gi + +## Configure extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) +## +livenessProbe: + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + +## Force execution of init scripts +forceInitScripts: false + +## Configmap with init scripts to execute +# initScriptsCM: + +## Secret with init scripts to execute (for sensitive data) +# initScriptsSecret: + +## Service configuration +## +service: + port: 80 + type: ClusterIP + ## Specify the nodePort value for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + # nodePort: + + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: {} + + ## loadBalancerIP for the PrestaShop Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + # loadBalancerIP: + ## Extra ports to expose (normally used with the `sidecar` value) + # extraPorts: + +## Configure the ingress resource that allows you to access the +## Kibana web. Set up the URL +## ref: http://kubernetes.io/docs/user-guide/ingress/ +## +ingress: + ## Set to true to enable ingress record generation + enabled: false + + ## Set this to true in order to add the corresponding annotations for cert-manager + certManager: false + + ## Ingress annotations done as key:value pairs + ## For a full list of possible ingress annotations, please see + ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md + ## + ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set + ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set + # annotations: + # kubernetes.io/ingress.class: nginx + + ## The list of hostnames to be covered with this ingress record. + ## Most likely this will be just one host, but in the event more hosts are needed, this is an array + hosts: + - host: kibana.local + paths: ["/"] + + ## The tls configuration for the ingress + ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +## SecurityContext configuration +## +securityContext: + enabled: true + runAsUser: 1001 + fsGroup: 1001 + runAsNonRoot: true + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## Example: +## resources: +## requests: +## memory: 512Mi +## cpu: 300m +## +# resources: + +## Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## Tolerations for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## Affinity for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## Pod annotations +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} + +sidecars: +## Add sidecars to the pod. +## e.g. +# - name: your-image-name + # image: your-image + # imagePullPolicy: Always + # ports: + # - name: portname + # containerPort: 1234 + +initContainers: +## Add init containers to the pod. +## e.g. +# - name: your-image-name + # image: your-image + # imagePullPolicy: Always + # ports: + # - name: portname + # containerPort: 1234 + +## Prometheus Exporter / Metrics +## +metrics: + enabled: false + podAnnotations: + prometheus.io/scrape: "true" + prometheus.io/port: "9112" + + ## Metrics exporter resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + # resources: {} + + ## Metrics exporter labels and tolerations for pod assignment + # nodeSelector: {"beta.kubernetes.io/arch": "amd64"} + # tolerations: [] + + ## Metrics exporter pod Annotation and Labels + # podAnnotations: {} + # podLabels: {} + + +metrics: + enabled: false + service: + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "80" + prometheus.io/path: "_prometheus/metrics" + +## Properties for Elasticsearch +elasticsearch: + useBundled: true + ## Properties when useBundled is false + external: + hosts: + # - elasticsearch-1 + # - elasticsearch-2 + port: From 048e72769c44d5f542523cbc54df8d6a1f813475 Mon Sep 17 00:00:00 2001 From: "Javier J. Salmeron Garcia" Date: Thu, 19 Sep 2019 17:01:41 +0200 Subject: [PATCH 2/6] Add readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 341c62966..e3ba6d772 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ $ helm search bitnami - [HashiCorp Consul](https://github.com/bitnami/charts/tree/master/bitnami/consul) - [Jenkins](https://github.com/bitnami/charts/tree/master/bitnami/jenkins) - [Kafka](https://github.com/bitnami/charts/tree/master/bitnami/kafka) +- [Kibana](https://github.com/bitnami/charts/tree/master/bitnami/kibana) - [Kubeapps](https://github.com/bitnami/charts/tree/master/bitnami/kubeapps) - [Magento](https://github.com/bitnami/charts/tree/master/bitnami/magento) - [Memcached](https://github.com/bitnami/charts/tree/master/bitnami/memcached) From c718a0daa91d73349c755b4a6fef9c724a9b29f9 Mon Sep 17 00:00:00 2001 From: "Javier J. Salmeron Garcia" Date: Thu, 19 Sep 2019 18:00:14 +0200 Subject: [PATCH 3/6] Apply requested changes --- bitnami/kibana/README.md | 16 ++-- bitnami/kibana/requirements.yaml | 2 +- bitnami/kibana/templates/_helpers.tpl | 84 ++++++++++-------- bitnami/kibana/templates/configmap.yml | 2 +- bitnami/kibana/templates/deployment.yaml | 18 ++-- bitnami/kibana/templates/ingress.yaml | 3 +- .../kibana/templates/plugins-configmap.yml | 2 +- bitnami/kibana/templates/pvc.yaml | 3 +- .../templates/saved-objects-configmap.yml | 2 +- bitnami/kibana/templates/service.yaml | 7 +- .../templates/tests/test-connection.yaml | 3 +- bitnami/kibana/values-production.yaml | 57 ++++++------ bitnami/kibana/values.yaml | 87 +++++++++---------- 13 files changed, 138 insertions(+), 148 deletions(-) diff --git a/bitnami/kibana/README.md b/bitnami/kibana/README.md index 46c713e99..fabfd8d4c 100644 --- a/bitnami/kibana/README.md +++ b/bitnami/kibana/README.md @@ -11,7 +11,7 @@ $ helm repo add bitnami https://charts.bitnami.com/bitnami $ helm install bitnami/kibana --set elasticsearch.external.hosts[0]= --set elasticsearch.external.port= # Option 2: With a bundled Elasticsearch instance -$ helm install bitnami/kibana --set elasticsearch.useBundled=true +$ helm install bitnami/kibana --set elasticsearch.enabled=true ``` ## Introduction @@ -36,7 +36,7 @@ $ helm repo add bitnami https://charts.bitnami.com/bitnami $ helm install bitnami/kibana --set elasticsearch.external.hosts[0]= --set elasticsearch.external.port= # Option 2: With a bundled Elasticsearch instance -$ helm install bitnami/kibana --set elasticsearch.useBundled=true +$ helm install bitnami/kibana --set elasticsearch.enabled=true ``` These commands deploy kibana on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. @@ -130,7 +130,7 @@ The following tables lists the configurable parameters of the kibana chart and t | `initContainers` | Add additional init containers to the pod | `nil` | | `metrics.enabled` | Start a side-car prometheus exporter | `false` | | `metrics.service.annotations` | Prometheus annotations for the Kibana service | `{ prometheus.io/scrape: "true", prometheus.io/port: "80", prometheus.io/path: "_prometheus/metrics" }` | -| `elasticsearch.useBundled` | Use bundled Elasticsearch | `false` | +| `elasticsearch.enabled` | Use bundled Elasticsearch | `false` | | `elasticsearch.external.hosts` | Array containing the hostnames for the already existing Elasticsearch instances | `nil` | | `elasticsearch.external.port` | Port for the accessing external Elasticsearch instances | `nil` | @@ -203,7 +203,7 @@ kubectl create secret generic special-scripts-sensitive --from-file=03_install_c Then use the `initScriptsCM` and `initScriptsSecret` values. ```console -helm install bitnami/kibana elasticsearch.useBundled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 --set initScriptsCM=special-scripts --set initScriptsSecret=special-scripts-sensitive +helm install bitnami/kibana elasticsearch.enabled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 --set initScriptsCM=special-scripts --set initScriptsSecret=special-scripts-sensitive ``` ### Installing plugins @@ -211,7 +211,7 @@ helm install bitnami/kibana elasticsearch.useBundled=false --set elasticsearch.e The Bitnami Kibana chart allows you to install a set of plugins at deployment time using the `plugins` value: ```console -helm install bitnami/kibana elasticsearch.useBundled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 --set plugins[0]=https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip +helm install bitnami/kibana elasticsearch.enabled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 --set plugins[0]=https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip ``` > **NOTE** Make sure that the plugin is available for the Kibana version you are deploying @@ -267,14 +267,14 @@ initContainers: This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. ```console -$ helm install --name my-release -f ./values-production.yaml --set elasticsearch.useBundled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 bitnami/kibana +$ helm install --name my-release -f ./values-production.yaml --set elasticsearch.enabled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 bitnami/kibana ``` - Disable bundled Elasticsearch ```diff -- elasticsearch.useBundled: true -+ elasticsearch.useBundled: false +- elasticsearch.enabled: true ++ elasticsearch.enabled: false ``` - Enable metrics scraping diff --git a/bitnami/kibana/requirements.yaml b/bitnami/kibana/requirements.yaml index fdb302ac1..4710694d3 100644 --- a/bitnami/kibana/requirements.yaml +++ b/bitnami/kibana/requirements.yaml @@ -2,4 +2,4 @@ dependencies: - name: elasticsearch version: 6.x.x repository: https://charts.bitnami.com/bitnami - condition: elasticsearch.useBundled + condition: elasticsearch.enabled diff --git a/bitnami/kibana/templates/_helpers.tpl b/bitnami/kibana/templates/_helpers.tpl index 90a706fa3..ff80a0522 100644 --- a/bitnami/kibana/templates/_helpers.tpl +++ b/bitnami/kibana/templates/_helpers.tpl @@ -6,6 +6,37 @@ Expand the name of the chart. {{- 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 "kibana.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 a default fully qualified elasticsearch name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "kibana.elasticsearch.fullname" -}} +{{- if .Values.elasticsearch.fullnameOverride -}} +{{- .Values.elasticsearch.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default "elasticsearch" .Values.elasticsearch.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} + {{/* Return the proper Docker Image Registry Secret Names */}} @@ -73,37 +104,6 @@ Also, we can't use a single if because lazy evaluation is not an option {{- end -}} {{- 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 "kibana.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 a default fully qualified elasticsearch name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -*/}} -{{- define "kibana.elasticsearch.fullname" -}} -{{- if .Values.elasticsearch.fullnameOverride -}} -{{- .Values.elasticsearch.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default "elasticsearch" .Values.elasticsearch.nameOverride -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} - {{/* Create chart name and version as used by the chart label. */}} @@ -112,7 +112,7 @@ Create chart name and version as used by the chart label. {{- end -}} {{- define "kibana.elasticsearch.url" -}} -{{- if not .Values.elasticsearch.useBundled -}} +{{- if not .Values.elasticsearch.enabled -}} {{- if .Values.elasticsearch.external.hosts -}} {{- $totalHosts := len .Values.elasticsearch.external.hosts -}} {{- range $i, $host := .Values.elasticsearch.external.hosts -}} @@ -129,7 +129,7 @@ Create chart name and version as used by the chart label. Set Elasticsearch Port. */}} {{- define "kibana.elasticsearch.port" -}} -{{- if .Values.elasticsearch.useBundled -}} +{{- if .Values.elasticsearch.enabled -}} {{- .Values.elasticsearch.coordinating.service.port -}} {{- else -}} {{- .Values.elasticsearch.external.port -}} @@ -207,6 +207,14 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} +{{/* +Match labels +*/}} +{{- define "kibana.matchLabels" -}} +app.kubernetes.io/name: {{ include "kibana.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + {{/* Return the proper Storage Class */}} @@ -263,25 +271,25 @@ Compile all warnings into a single message, and call fail. {{/* Validate values of Kibana - must provide a ElasticSearch */}} {{- define "kibana.validateValues.noElastic" -}} -{{- if and (not .Values.elasticsearch.useBundled) (not .Values.elasticsearch.external.hosts) (not .Values.elasticsearch.external.port) -}} +{{- if and (not .Values.elasticsearch.enabled) (not .Values.elasticsearch.external.hosts) (not .Values.elasticsearch.external.port) -}} kibana: no-elasticsearch You did not specify an external Elasticsearch instance nor enabled the bundled - one. Please set either elasticsearch.useBundled=true or set elasticsearch.external.hosts and elasticsearch.external.port + one. Please set either elasticsearch.enabled=true or set elasticsearch.external.hosts and elasticsearch.external.port {{- end -}} {{- end -}} {{/* Validate values of Kibana - conflict with ElasticSearch */}} {{- define "kibana.validateValues.elasticConflict" -}} -{{- if and (.Values.elasticsearch.useBundled) (.Values.elasticsearch.external.hosts) -}} +{{- if and (.Values.elasticsearch.enabled) (.Values.elasticsearch.external.hosts) -}} kibana: conflict-elasticsearch You specified both the external Elasticsearch instance and the bundled one. - Please only set either elasticsearch.useBundled=true or elasticsearch.external.hosts + Please only set either elasticsearch.enabled=true or elasticsearch.external.hosts {{- end -}} {{- end -}} {{/* Validate values of Kibana - Missing external ES Setting */}} {{- define "kibana.validateValues.externalESSettings" -}} -{{- if (not .Values.elasticsearch.useBundled) }} +{{- if (not .Values.elasticsearch.enabled) }} {{- if and (not .Values.elasticsearch.external.hosts) .Values.elasticsearch.external.port }} kibana: missing-es-settings-host You specified the external Elasticsearch port but not the host. Please diff --git a/bitnami/kibana/templates/configmap.yml b/bitnami/kibana/templates/configmap.yml index 461e478de..da461583e 100644 --- a/bitnami/kibana/templates/configmap.yml +++ b/bitnami/kibana/templates/configmap.yml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "kibana.fullname" . }}-conf - labels: {{ include "kibana.labels" . | nindent 4 }} + labels: {{- include "kibana.labels" . | nindent 4 }} data: kibana.yml: | pid.file: /opt/bitnami/kibana/tmp/kibana.pid diff --git a/bitnami/kibana/templates/deployment.yaml b/bitnami/kibana/templates/deployment.yaml index 69889a66e..3cc5789f6 100644 --- a/bitnami/kibana/templates/deployment.yaml +++ b/bitnami/kibana/templates/deployment.yaml @@ -2,22 +2,17 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "kibana.fullname" . }} - labels: -{{ include "kibana.labels" . | indent 4 }} + labels: {{- include "kibana.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} {{- if .Values.updateStrategy }} strategy: {{- tpl (toYaml .Values.updateStrategy) $ | nindent 4 }} {{- end }} selector: - matchLabels: - app.kubernetes.io/name: {{ include "kibana.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + matchLabels: {{- include "kibana.matchLabels" . | nindent 6 }} template: metadata: - labels: - app.kubernetes.io/name: {{ include "kibana.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + labels: {{- include "kibana.labels" . | nindent 8 }} spec: {{- if .Values.schedulerName }} schedulerName: {{ .Values.schedulerName | quote }} @@ -78,6 +73,7 @@ spec: - name: http containerPort: 5601 protocol: TCP + {{- if .Values.livenessProbe.enabled }} livenessProbe: httpGet: path: / @@ -87,6 +83,8 @@ spec: timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} successThreshold: {{ .Values.livenessProbe.successThreshold }} failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} readinessProbe: httpGet: path: / @@ -96,9 +94,9 @@ spec: timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} successThreshold: {{ .Values.readinessProbe.successThreshold }} failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} {{- if .Values.resources }} - resources: - {{- tpl (toYaml .Values.resources) $ | nindent 12 }} + resources: {{- tpl (toYaml .Values.resources) $ | nindent 12 }} {{- end }} volumeMounts: - name: kibana-data diff --git a/bitnami/kibana/templates/ingress.yaml b/bitnami/kibana/templates/ingress.yaml index d40d12098..c301e784b 100644 --- a/bitnami/kibana/templates/ingress.yaml +++ b/bitnami/kibana/templates/ingress.yaml @@ -4,8 +4,7 @@ apiVersion: extensions/v1beta1 kind: Ingress metadata: name: {{ $fullName }} - labels: -{{ include "kibana.labels" . | indent 4 }} + labels: {{- include "kibana.labels" . | nindent 4 }} annotations: {{- if .Values.ingress.certManager }} kubernetes.io/tls-acme: "true" diff --git a/bitnami/kibana/templates/plugins-configmap.yml b/bitnami/kibana/templates/plugins-configmap.yml index 27aee05e1..a1128ac05 100644 --- a/bitnami/kibana/templates/plugins-configmap.yml +++ b/bitnami/kibana/templates/plugins-configmap.yml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "kibana.fullname" . }}-plugins - labels: {{ include "kibana.labels" . | nindent 4 }} + labels: {{- include "kibana.labels" . | nindent 4 }} data: install-plugins.sh: | #!/bin/bash diff --git a/bitnami/kibana/templates/pvc.yaml b/bitnami/kibana/templates/pvc.yaml index adcfdff7b..1a6424e0f 100644 --- a/bitnami/kibana/templates/pvc.yaml +++ b/bitnami/kibana/templates/pvc.yaml @@ -3,8 +3,7 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ include "kibana.fullname" . }} - labels: -{{ include "kibana.labels" . | indent 4 }} + labels: {{- include "kibana.labels" . | nindent 4 }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }} diff --git a/bitnami/kibana/templates/saved-objects-configmap.yml b/bitnami/kibana/templates/saved-objects-configmap.yml index 4cab0c87f..3f451aa06 100644 --- a/bitnami/kibana/templates/saved-objects-configmap.yml +++ b/bitnami/kibana/templates/saved-objects-configmap.yml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ConfigMap metadata: name: {{ include "kibana.fullname" . }}-saved-objects - labels: {{ include "kibana.labels" . | nindent 4 }} + labels: {{- include "kibana.labels" . | nindent 4 }} data: import-saved-objects.sh: | #!/bin/bash diff --git a/bitnami/kibana/templates/service.yaml b/bitnami/kibana/templates/service.yaml index 326ad0972..56265b4c4 100644 --- a/bitnami/kibana/templates/service.yaml +++ b/bitnami/kibana/templates/service.yaml @@ -2,8 +2,7 @@ apiVersion: v1 kind: Service metadata: name: {{ include "kibana.fullname" . }} - labels: -{{ include "kibana.labels" . | indent 4 }} + labels: {{- include "kibana.labels" . | nindent 4 }} {{- if or (and .Values.metrics.enabled .Values.metrics.service.annotations) .Values.service.annotations }} annotations: {{- if and .Values.metrics.enabled .Values.metrics.service.annotations }} @@ -31,6 +30,4 @@ spec: {{- if .Values.service.extraPorts }} {{- tpl (toYaml .Values.service.extraPorts) $ | nindent 4 }} {{- end }} - selector: - app.kubernetes.io/name: {{ include "kibana.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + selector: {{- include "kibana.matchLabels" . | nindent 4 }} diff --git a/bitnami/kibana/templates/tests/test-connection.yaml b/bitnami/kibana/templates/tests/test-connection.yaml index bdbc57e16..2901c945c 100644 --- a/bitnami/kibana/templates/tests/test-connection.yaml +++ b/bitnami/kibana/templates/tests/test-connection.yaml @@ -2,8 +2,7 @@ apiVersion: v1 kind: Pod metadata: name: "{{ include "kibana.fullname" . }}-test-connection" - labels: -{{ include "kibana.labels" . | indent 4 }} + labels: {{- include "kibana.labels" . | nindent 4 }} annotations: "helm.sh/hook": test-success spec: diff --git a/bitnami/kibana/values-production.yaml b/bitnami/kibana/values-production.yaml index aa2b8f356..570a7d61a 100644 --- a/bitnami/kibana/values-production.yaml +++ b/bitnami/kibana/values-production.yaml @@ -57,10 +57,12 @@ updateStrategy: # schedulerName: ## List of plugins to install +## plugins: # - https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip ## Saved objects to import (NDJSON format) +## savedObjects: ## List of saved objects URLs urls: @@ -69,9 +71,11 @@ savedObjects: configmap: ## Extra configuration settings +## # extraConfiguration: -## Configuration ConfigMap +## Configuration ConfigMap (for kibana.yml) +## # configurationCM: ## An array to add extra env vars @@ -82,16 +86,20 @@ savedObjects: ## # extraEnvVars: -## An array to add extra configmaps: -## For example: +## Array to add extra configmaps: +## ## extraEnvVarsCM: -## An array to add extra configmaps: -## For example: +## Array to add extra configmaps: +## ## extraEnvVarsSecret: -## extraVolumes: {} +## Array to add extra volumes +## +## extraVolumes: +## Array to add extra mounts (normally used with extraVolumes) +## ## extraVolumeMounts: {} ## @@ -155,12 +163,15 @@ readinessProbe: successThreshold: 1 ## Force execution of init scripts +## forceInitScripts: false ## Configmap with init scripts to execute +## # initScriptsCM: ## Secret with init scripts to execute (for sensitive data) +## # initScriptsSecret: ## Service configuration @@ -261,8 +272,9 @@ affinity: {} ## podAnnotations: {} +## Add sidecars to the pod +## sidecars: -## Add sidecars to the pod. ## e.g. # - name: your-image-name # image: your-image @@ -271,8 +283,9 @@ sidecars: # - name: portname # containerPort: 1234 +## Add init containers to the pod +## initContainers: -## Add init containers to the pod. ## e.g. # - name: your-image-name # image: your-image @@ -281,30 +294,11 @@ initContainers: # - name: portname # containerPort: 1234 -## Prometheus Exporter / Metrics + +## Prometheus metrics (requires the kibana-prometheus-exporter plugin) ## metrics: enabled: true - podAnnotations: - prometheus.io/scrape: "true" - prometheus.io/port: "9112" - - ## Metrics exporter resource requests and limits - ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ - ## - # resources: {} - - ## Metrics exporter labels and tolerations for pod assignment - # nodeSelector: {"beta.kubernetes.io/arch": "amd64"} - # tolerations: [] - - ## Metrics exporter pod Annotation and Labels - # podAnnotations: {} - # podLabels: {} - - -metrics: - enabled: false service: annotations: prometheus.io/scrape: "true" @@ -312,9 +306,10 @@ metrics: prometheus.io/path: "_prometheus/metrics" ## Properties for Elasticsearch +## elasticsearch: - useBundled: false - ## Properties when useBundled is false + enabled: false + ## Properties when enabled is false external: hosts: # - elasticsearch-1 diff --git a/bitnami/kibana/values.yaml b/bitnami/kibana/values.yaml index 611abe4e8..1b97c2331 100644 --- a/bitnami/kibana/values.yaml +++ b/bitnami/kibana/values.yaml @@ -57,10 +57,12 @@ updateStrategy: # schedulerName: ## List of plugins to install +## plugins: # - https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip ## Saved objects to import (NDJSON format) +## savedObjects: ## List of saved objects URLs urls: @@ -69,9 +71,11 @@ savedObjects: configmap: ## Extra configuration settings +## # extraConfiguration: -## Configuration ConfigMap +## Configuration ConfigMap (for kibana.yml) +## # configurationCM: ## An array to add extra env vars @@ -82,16 +86,20 @@ savedObjects: ## # extraEnvVars: -## An array to add extra configmaps: -## For example: +## Array to add extra configmaps: +## ## extraEnvVarsCM: -## An array to add extra configmaps: -## For example: +## Array to add extra configmaps: +## ## extraEnvVarsSecret: -## extraVolumes: {} +## Array to add extra volumes +## +## extraVolumes: +## Array to add extra mounts (normally used with extraVolumes) +## ## extraVolumeMounts: {} ## @@ -155,12 +163,15 @@ readinessProbe: successThreshold: 1 ## Force execution of init scripts +## forceInitScripts: false ## Configmap with init scripts to execute +## # initScriptsCM: ## Secret with init scripts to execute (for sensitive data) +## # initScriptsSecret: ## Service configuration @@ -261,48 +272,31 @@ affinity: {} ## podAnnotations: {} -sidecars: -## Add sidecars to the pod. -## e.g. -# - name: your-image-name - # image: your-image - # imagePullPolicy: Always - # ports: - # - name: portname - # containerPort: 1234 - -initContainers: -## Add init containers to the pod. -## e.g. -# - name: your-image-name - # image: your-image - # imagePullPolicy: Always - # ports: - # - name: portname - # containerPort: 1234 - -## Prometheus Exporter / Metrics +## Add sidecars to the pod ## -metrics: - enabled: false - podAnnotations: - prometheus.io/scrape: "true" - prometheus.io/port: "9112" +sidecars: +## e.g. +# - name: your-image-name + # image: your-image + # imagePullPolicy: Always + # ports: + # - name: portname + # containerPort: 1234 - ## Metrics exporter resource requests and limits - ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ - ## - # resources: {} - - ## Metrics exporter labels and tolerations for pod assignment - # nodeSelector: {"beta.kubernetes.io/arch": "amd64"} - # tolerations: [] - - ## Metrics exporter pod Annotation and Labels - # podAnnotations: {} - # podLabels: {} +## Add init containers to the pod +## +initContainers: +## e.g. +# - name: your-image-name + # image: your-image + # imagePullPolicy: Always + # ports: + # - name: portname + # containerPort: 1234 +## Prometheus metrics (requires the kibana-prometheus-exporter plugin) +## metrics: enabled: false service: @@ -312,9 +306,10 @@ metrics: prometheus.io/path: "_prometheus/metrics" ## Properties for Elasticsearch +## elasticsearch: - useBundled: true - ## Properties when useBundled is false + enabled: true + ## Properties when enabled is false external: hosts: # - elasticsearch-1 From 3c24c45b5849e43c355cce7586e9f4f136326d7f Mon Sep 17 00:00:00 2001 From: "Javier J. Salmeron Garcia" Date: Thu, 19 Sep 2019 18:02:13 +0200 Subject: [PATCH 4/6] Liveness probes --- bitnami/kibana/requirements.lock | 4 ++-- bitnami/kibana/values-production.yaml | 2 ++ bitnami/kibana/values.yaml | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bitnami/kibana/requirements.lock b/bitnami/kibana/requirements.lock index b120747c2..b28262df8 100644 --- a/bitnami/kibana/requirements.lock +++ b/bitnami/kibana/requirements.lock @@ -2,5 +2,5 @@ dependencies: - name: elasticsearch repository: https://charts.bitnami.com/bitnami version: 6.3.6 -digest: sha256:a9ce67ddb82e0d519793a27a9f74c7a0d5b29d2ea31f155b6ab2264063521d63 -generated: "2019-09-19T13:57:56.920138+02:00" +digest: sha256:7439a36bc3462641137a38d05119ffdaf1db949b5e918ea73913b707bcfaa642 +generated: "2019-09-19T18:00:35.401405+02:00" diff --git a/bitnami/kibana/values-production.yaml b/bitnami/kibana/values-production.yaml index 570a7d61a..bbcc82791 100644 --- a/bitnami/kibana/values-production.yaml +++ b/bitnami/kibana/values-production.yaml @@ -150,12 +150,14 @@ persistence: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## livenessProbe: + enabled: true initialDelaySeconds: 120 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 readinessProbe: + enabled: true initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 diff --git a/bitnami/kibana/values.yaml b/bitnami/kibana/values.yaml index 1b97c2331..1fe9efe8d 100644 --- a/bitnami/kibana/values.yaml +++ b/bitnami/kibana/values.yaml @@ -150,12 +150,14 @@ persistence: ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) ## livenessProbe: + enabled: true initialDelaySeconds: 120 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 readinessProbe: + enabled: true initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 From 99807e25333f2961d1609c54aed6f6756574c318 Mon Sep 17 00:00:00 2001 From: "Javier J. Salmeron Garcia" Date: Fri, 20 Sep 2019 11:00:40 +0200 Subject: [PATCH 5/6] Apply requested changes --- bitnami/kibana/README.md | 71 +++++++++++++++++---------- bitnami/kibana/templates/service.yaml | 5 ++ 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/bitnami/kibana/README.md b/bitnami/kibana/README.md index fabfd8d4c..f7e5645f0 100644 --- a/bitnami/kibana/README.md +++ b/bitnami/kibana/README.md @@ -25,7 +25,7 @@ Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment This chart requires a Elasticsearch instance to work. The chart offers two options: - Use an already existing Elasticsearch instance. -- Deploy a new Elasticsearch instance. +- Deploy a new Elasticsearch instance together with Kibana. This is the default option when deploying the chart. To install the chart with the release name `my-release`: @@ -33,10 +33,13 @@ This chart requires a Elasticsearch instance to work. The chart offers two optio $ helm repo add bitnami https://charts.bitnami.com/bitnami # Option 1: With an existing Elasticsearch instance -$ helm install bitnami/kibana --set elasticsearch.external.hosts[0]= --set elasticsearch.external.port= +$ helm install bitnami/kibana --name my-release \ + --set elasticsearch.external.hosts[0]= \ + --set elasticsearch.external.port= # Option 2: With a bundled Elasticsearch instance -$ helm install bitnami/kibana --set elasticsearch.enabled=true +$ helm install bitnami/kibana --name my-release \ + --set elasticsearch.enabled=true ``` These commands deploy kibana on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. @@ -51,7 +54,7 @@ To uninstall/delete the `my-release` statefulset: $ helm delete my-release ``` -The command removes all the Kubernetes components associated with the chart and deletes the release. Use the option `--purge` to delete all persistent volumes too. +The command removes all the Kubernetes components associated with the chart and deletes the release. Use the option `--purge` to delete all history too. ## Configuration @@ -70,12 +73,12 @@ The following tables lists the configurable parameters of the kibana chart and t | `nameOverride` | String to partially override kibana.fullname template with a string (will prepend the release name) | `nil` | | `fullnameOverride` | String to fully override kibana.fullname template with a string | `nil` | | `replicaCount` | Number of replicas of the Kibana Pod | `1` | -| `updateStrategy` | Update strategy for deployment | `{type: "RollingUpdate"}` | +| `updateStrategy` | Update strategy for deployment (evaluated as a template) | `{type: "RollingUpdate"}` | | `schedulerName` | Alternative scheduler | `nil` | | `plugins` | Array containing the Kibana plugins to be installed in deployment | `[]` | | `savedObjects.urls` | Array containing links to NDJSON files to be imported during Kibana initialization | `[]` | -| `savedObjects.configmap` | Configmap containing NDJSON files to be imported during Kibana initialization | `[]` | -| `extraConfiguration` | Extra settings to be added to the default kibana.yml defined in the chart configuration.yaml file | `nil` | +| `savedObjects.configmap` | Configmap containing NDJSON files to be imported during Kibana initialization (evaluated as a template) | `[]` | +| `extraConfiguration` | Extra settings to be added to the default kibana.yml configmap that the chart creates (unless replaced using `configurationCM`). Evaluated as a template | `nil` | | `configurationCM` | ConfigMap containing a kibana.yml file that will replace the default one specified in configuration.yaml | `nil` | | `extraEnvVars` | Array containing extra env vars to configure Kibana | `nil` | | `extraEnvVarsCM` | ConfigMap containing extra env vars to configure Kibana | `nil` | @@ -106,13 +109,13 @@ The following tables lists the configurable parameters of the kibana chart and t | `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed.| `1` | | `service.type` | Kubernetes Service type | | `ClusterIP` | | `service.nodePort` | Port to bind to for NodePort service type (client port) | `nil` | -| `service.annotations` | Annotations for Kibana service | `{}` | +| `service.annotations` | Annotations for Kibana service (evaluated as a template) | `{}` | | `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | | `service.loadBalancerIP` | loadBalancerIP if Kibana service type is `LoadBalancer` | `nil` | -| `service.extraPorts` | Extra ports to expose in the service (normally used with the `sidecar` value) | `nil` | +| `service.extraPorts` | Extra ports to expose in the service (normally used with the `sidecar` value). Evaluated as a template. | `nil` | | `forceInitScripts` | Force the execution of the init scripts located in `/docker-entrypoint-initdb.d` | `false` | -| `initScriptsCM` | ConfigMap containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time | `nil` | -| `initScriptsSecret` | Secret containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time (that contain sensitive data) | `nil` | +| `initScriptsCM` | ConfigMap containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time (evaluated as a template) | `nil` | +| `initScriptsSecret` | Secret containing `/docker-entrypoint-initdb.d` scripts to be executed at initialization time (that contain sensitive data). Evaluated as a template. | `nil` | | `ingress.enabled` | Enable the use of the ingress controller to access the web UI | `false` | | `ingress.annotations` | Annotations for the Kibana Ingress | `{}` | | `ingress.hosts` | Add hosts to the ingress controller with name and path | `name: kibana.local`, `path: /` | @@ -120,17 +123,16 @@ The following tables lists the configurable parameters of the kibana chart and t | `securityContext.enabled` | Enable securityContext on for Kibana deployment | `true` | | `securityContext.runAsUser` | User for the security context | `1001` | | `securityContext.fsGroup` | Group to configure permissions for volumes | `1001` | -| `securityContext.runAsNonRoot` | Run containers as non-root users | `true` | -| `resources` | Configure resource requests and limits | `nil` | -| `nodeSelector` | Node labels for pod assignment | `{}` | -| `tolerations` | Tolerations for pod assignment | `[]` | -| `affinity` | Affinity for pod assignment | `{}` | -| `podAnnotations` | Pod annotations | `{}` | -| `sidecars` | Attach additional containers to the pod | `nil` | -| `initContainers` | Add additional init containers to the pod | `nil` | +| `resources` | Configure resource requests and limits (evaluated as a template) | `nil` | +| `nodeSelector` | Node labels for pod assignment (evaluated as a template) | `{}` | +| `tolerations` | Tolerations for pod assignment (evaluated as a template) | `[]` | +| `affinity` | Affinity for pod assignment (evaluated as a template) | `{}` | +| `podAnnotations` | Pod annotations (evaluated as a template) | `{}` | +| `sidecars` | Attach additional containers to the pod (evaluated as a template) | `nil` | +| `initContainers` | Add additional init containers to the pod (evaluated as a template) | `nil` | | `metrics.enabled` | Start a side-car prometheus exporter | `false` | | `metrics.service.annotations` | Prometheus annotations for the Kibana service | `{ prometheus.io/scrape: "true", prometheus.io/port: "80", prometheus.io/path: "_prometheus/metrics" }` | -| `elasticsearch.enabled` | Use bundled Elasticsearch | `false` | +| `elasticsearch.enabled` | Use bundled Elasticsearch | `true` | | `elasticsearch.external.hosts` | Array containing the hostnames for the already existing Elasticsearch instances | `nil` | | `elasticsearch.external.port` | Port for the accessing external Elasticsearch instances | `nil` | @@ -196,14 +198,23 @@ Alternatively, you can use a ConfigMap or a Secret with the environment variable For advanced operations, the Bitnami Kibana charts allows using custom init scripts that will be mounted in `/docker-entrypoint.init-db`. You can use a ConfigMap or a Secret (in case of sensitive data) for mounting these extra scripts. ```console -kubectl create configmap special-scripts --from-file=01_install_kibana_theme.sh --from-file=02_add_special_agent.sh -kubectl create secret generic special-scripts-sensitive --from-file=03_install_company_certificates.sh +$ kubectl create configmap special-scripts \ + --from-file=01_install_kibana_theme.sh \ + --from-file=02_add_special_agent.sh + +$ kubectl create secret generic special-scripts-sensitive \ + --from-file=03_install_company_certificates.sh ``` Then use the `initScriptsCM` and `initScriptsSecret` values. ```console -helm install bitnami/kibana elasticsearch.enabled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 --set initScriptsCM=special-scripts --set initScriptsSecret=special-scripts-sensitive +$ helm install bitnami/kibana --name my-release \ + --set elasticsearch.enabled=false \ + --set elasticsearch.external.hosts[0]=elasticsearch-host \ + --set elasticsearch.external.port=9200 \ + --set initScriptsCM=special-scripts \ + --set initScriptsSecret=special-scripts-sensitive ``` ### Installing plugins @@ -211,7 +222,11 @@ helm install bitnami/kibana elasticsearch.enabled=false --set elasticsearch.exte The Bitnami Kibana chart allows you to install a set of plugins at deployment time using the `plugins` value: ```console -helm install bitnami/kibana elasticsearch.enabled=false --set elasticsearch.external.hosts[0]=elasticsearch-host --set elasticsearch.external.port=9200 --set plugins[0]=https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip +$ helm install bitnami/kibana --name my-release \ + --set elasticsearch.enabled=false \ + --set elasticsearch.external.hosts[0]=elasticsearch-host \ + --set elasticsearch.external.port=9200 \ + --set plugins[0]=https://github.com/fbaligand/kibana-enhanced-table/releases/download/v1.5.0/enhanced-table-1.5.0_7.3.2.zip ``` > **NOTE** Make sure that the plugin is available for the Kibana version you are deploying @@ -221,19 +236,21 @@ helm install bitnami/kibana elasticsearch.enabled=false --set elasticsearch.exte If you have visualizations and dashboards (in NDJSON format) that you want to import to Kibana. You can create a ConfigMap that includes them. ```console -kubectl create configmap my-import --from-file=my-exported-data.ndjson +$ kubectl create configmap my-import --from-file=my-exported-data.ndjson ``` Then install the chart with the `savedObjects.configmap` value: ```console -helm install bitnami/kibana --set savedObjects.configmap=my-import +helm install bitnami/kibana --name my-release \ + --set savedObjects.configmap=my-import ``` Alternatively, if it is available via URL, you can install the chart as follows ```console -helm install bitnami/kibana --set savedObjects.urls[0]=www.my-site.com/import.ndjson +helm install bitnami/kibana --name my-release \ + --set savedObjects.urls[0]=www.my-site.com/import.ndjson ``` ## Sidecars and Init Containers diff --git a/bitnami/kibana/templates/service.yaml b/bitnami/kibana/templates/service.yaml index 56265b4c4..bc273f3bf 100644 --- a/bitnami/kibana/templates/service.yaml +++ b/bitnami/kibana/templates/service.yaml @@ -15,6 +15,11 @@ metadata: spec: type: {{ .Values.service.type }} + {{- if eq .Values.service.type "LoadBalancer" }} + {{- if .Values.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} + {{- end }} {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} {{- end }} From d23cbbe404e46cfdcade980e409d76439574ae5a Mon Sep 17 00:00:00 2001 From: "Javier J. Salmeron Garcia" Date: Fri, 20 Sep 2019 11:39:52 +0200 Subject: [PATCH 6/6] Apply more changes --- bitnami/kibana/Chart.yaml | 1 + bitnami/kibana/templates/_helpers.tpl | 28 ++----------------- .../templates/tests/test-connection.yaml | 2 +- bitnami/kibana/values-production.yaml | 2 +- bitnami/kibana/values.yaml | 2 +- 5 files changed, 7 insertions(+), 28 deletions(-) diff --git a/bitnami/kibana/Chart.yaml b/bitnami/kibana/Chart.yaml index d8f94c529..c884e00ed 100644 --- a/bitnami/kibana/Chart.yaml +++ b/bitnami/kibana/Chart.yaml @@ -4,6 +4,7 @@ appVersion: 7.3.2 description: Kibana is an open source, browser based analytics and search dashboard for Elasticsearch. version: 0.0.1 keywords: +- kibana - analitics - monitoring - metrics diff --git a/bitnami/kibana/templates/_helpers.tpl b/bitnami/kibana/templates/_helpers.tpl index ff80a0522..242f3486b 100644 --- a/bitnami/kibana/templates/_helpers.tpl +++ b/bitnami/kibana/templates/_helpers.tpl @@ -41,34 +41,12 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this Return the proper Docker Image Registry Secret Names */}} {{- define "kibana.imagePullSecrets" -}} -{{/* -Helm 2.11 supports the assignment of a value to a variable defined in a different scope, -but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. -Also, we can not use a single if because lazy evaluation is not an option -*/}} -{{- if .Values.global }} -{{- if .Values.global.imagePullSecrets }} +{{- $imagePullSecrets := coalesce .Values.global.imagePullSecrets .Values.image.pullSecrets .Values.volumePermissions.image.pullSecrets -}} +{{- if $imagePullSecrets }} imagePullSecrets: -{{- range .Values.global.imagePullSecrets }} +{{- range $imagePullSecrets }} - name: {{ . }} -{{- end }} -{{- else if or .Values.image.pullSecrets .Values.volumePermissions.image.pullSecrets }} -imagePullSecrets: -{{- range .Values.image.pullSecrets }} - - name: {{ . }} -{{- end }} -{{- range .Values.volumePermissions.image.pullSecrets }} - - name: {{ . }} -{{- end }} {{- end -}} -{{- else if or .Values.image.pullSecrets .Values.volumePermissions.image.pullSecrets }} -imagePullSecrets: -{{- range .Values.image.pullSecrets }} - - name: {{ . }} -{{- end }} -{{- range .Values.volumePermissions.image.pullSecrets }} - - name: {{ . }} -{{- end }} {{- end -}} {{- end -}} diff --git a/bitnami/kibana/templates/tests/test-connection.yaml b/bitnami/kibana/templates/tests/test-connection.yaml index 2901c945c..b9e125f02 100644 --- a/bitnami/kibana/templates/tests/test-connection.yaml +++ b/bitnami/kibana/templates/tests/test-connection.yaml @@ -8,7 +8,7 @@ metadata: spec: containers: - name: wget - image: busybox + image: bitnami/minideb command: ['wget'] args: ['{{ include "kibana.fullname" . }}:{{ .Values.service.port }}'] restartPolicy: Never diff --git a/bitnami/kibana/values-production.yaml b/bitnami/kibana/values-production.yaml index bbcc82791..f075cb73a 100644 --- a/bitnami/kibana/values-production.yaml +++ b/bitnami/kibana/values-production.yaml @@ -2,7 +2,7 @@ ## Please, note that this will override the image parameters, including dependencies, configured to use the global value ## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass ## -# global: +global: {} # imageRegistry: myRegistryName # imagePullSecrets: # - myRegistryKeySecretName diff --git a/bitnami/kibana/values.yaml b/bitnami/kibana/values.yaml index 1fe9efe8d..83bc6327b 100644 --- a/bitnami/kibana/values.yaml +++ b/bitnami/kibana/values.yaml @@ -2,7 +2,7 @@ ## Please, note that this will override the image parameters, including dependencies, configured to use the global value ## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass ## -# global: +global: {} # imageRegistry: myRegistryName # imagePullSecrets: # - myRegistryKeySecretName