From 2c3d44296d80f81b7b3d19e934766d5c27e29137 Mon Sep 17 00:00:00 2001 From: Max Kovgan Date: Fri, 15 May 2020 17:27:58 +0300 Subject: [PATCH] upd kibana to support LB - based on PR: https://github.com/elastic/helm-charts/pull/539 Signed-off-by: Max Kovgan --- kibana/README.md | 35 +++++++++++++++++++---------------- kibana/templates/service.yaml | 3 +++ kibana/tests/kibana_test.py | 17 +++++++++++++++++ kibana/values.yaml | 1 + 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/kibana/README.md b/kibana/README.md index 6b8dd78fc..dc5015d2f 100644 --- a/kibana/README.md +++ b/kibana/README.md @@ -10,22 +10,23 @@ for supported version. -- [Requirements](#requirements) -- [Installing](#installing) - - [Install released version using Helm repository](#install-released-version-using-helm-repository) - - [Install development version using master branch](#install-development-version-using-master-branch) -- [Upgrading](#upgrading) -- [Compatibility](#compatibility) -- [Usage notes](#usage-notes) -- [Configuration](#configuration) - - [Deprecated](#deprecated) -- [FAQ](#faq) - - [How to deploy this chart on a specific K8S distribution?](#how-to-deploy-this-chart-on-a-specific-k8s-distribution) - - [How to use Kibana with security (authentication and TLS) enabled?](#how-to-use-kibana-with-security-authentication-and-tls-enabled) - - [How to install OSS version of Kibana?](#how-to-install-oss-version-of-kibana) - - [How to install plugins?](#how-to-install-plugins) - - [How to import objects post-deployment?](#how-to-import-objects-post-deployment) -- [Contributing](#contributing) +- [Kibana Helm Chart](#kibana-helm-chart) + - [Requirements](#requirements) + - [Installing](#installing) + - [Install released version using Helm repository](#install-released-version-using-helm-repository) + - [Install development version using master branch](#install-development-version-using-master-branch) + - [Upgrading](#upgrading) + - [Compatibility](#compatibility) + - [Usage notes](#usage-notes) + - [Configuration](#configuration) + - [Deprecated](#deprecated) + - [FAQ](#faq) + - [How to deploy this chart on a specific K8S distribution?](#how-to-deploy-this-chart-on-a-specific-k8s-distribution) + - [How to use Kibana with security (authentication and TLS) enabled?](#how-to-use-kibana-with-security-authentication-and-tls-enabled) + - [How to install OSS version of Kibana?](#how-to-install-oss-version-of-kibana) + - [How to install plugins?](#how-to-install-plugins) + - [How to import objects post-deployment?](#how-to-import-objects-post-deployment) + - [Contributing](#contributing) @@ -112,6 +113,8 @@ as a reference. They are also used in the automated testing of this chart. | `ingress` | Configurable [ingress][] to expose the Kibana service. | see [values.yaml][] | | `kibanaConfig` | Allows you to add any config files in `/usr/share/kibana/config/` such as `kibana.yml` See [values.yaml][] for an example of the formatting | `{}` | | `labels` | Configurable [labels][] applied to all Kibana pods | `{}` | +| `loadBalancerIP` | Some cloud providers allow you to specify the loadBalancerIP. If the loadBalancerIP field is not specified, the IP is dynamically assigned. If you specify a loadBalancerIP but your cloud provider does not support the feature, the `loadbalancerIP` field is ignored. [LoadBalancer options](https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer) | `""` | + | `lifecycle` | Allows you to add [lifecycle hooks][]. See [values.yaml][] for an example of the formatting | `{}` | | `nameOverride` | Overrides the chart name for resources. If not set the name will default to `.Chart.Name` | `""` | | `nodeSelector` | Configurable [nodeSelector][] so that you can target specific nodes for your Kibana instances | `{}` | diff --git a/kibana/templates/service.yaml b/kibana/templates/service.yaml index 5734580bf..6897b1ce7 100644 --- a/kibana/templates/service.yaml +++ b/kibana/templates/service.yaml @@ -16,6 +16,9 @@ metadata: {{- end }} spec: type: {{ .Values.service.type }} +{{- if .Values.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} +{{- end }} {{- with .Values.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{ toYaml . | indent 4 }} diff --git a/kibana/tests/kibana_test.py b/kibana/tests/kibana_test.py index 1341c6146..e2609fc2c 100644 --- a/kibana/tests/kibana_test.py +++ b/kibana/tests/kibana_test.py @@ -467,6 +467,23 @@ def test_adding_a_nodePort(): assert r["service"][name]["spec"]["ports"][0]["nodePort"] == 30001 +def test_adding_a_loadBalancerIP(): + config = "" + + r = helm_template(config) + + assert "loadBalancerIP" not in r["service"][name]["spec"] + + config = """ + service: + loadBalancerIP: 12.4.19.81 + """ + + r = helm_template(config) + + assert r["service"][name]["spec"]["loadBalancerIP"] == "12.4.19.81" + + def test_override_the_serverHost(): config = """ diff --git a/kibana/values.yaml b/kibana/values.yaml index b843b7f70..027434648 100755 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -104,6 +104,7 @@ service: # service.beta.kubernetes.io/azure-load-balancer-internal: "true" # service.beta.kubernetes.io/openstack-internal-load-balancer: "true" # service.beta.kubernetes.io/cce-load-balancer-internal-vpc: "true" + loadBalancerIP: "" loadBalancerSourceRanges: [] # 0.0.0.0/0