From 77c282a15707236f72c1d3e8dd95b234bd85e764 Mon Sep 17 00:00:00 2001 From: y-matsuda Date: Wed, 11 Dec 2019 22:38:32 +0900 Subject: [PATCH 1/3] add support for loadBalancerSourceRanges --- kibana/templates/service.yaml | 4 ++++ kibana/tests/kibana_test.py | 27 +++++++++++++++++++++++++++ kibana/values.yaml | 2 ++ 3 files changed, 33 insertions(+) diff --git a/kibana/templates/service.yaml b/kibana/templates/service.yaml index 60f47eb82..d4ca20b0c 100644 --- a/kibana/templates/service.yaml +++ b/kibana/templates/service.yaml @@ -13,6 +13,10 @@ metadata: {{- end }} spec: type: {{ .Values.service.type }} +{{- with .Values.service.loadBalancerSourceRanges }} + loadBalancerSourceRanges: +{{ toYaml . | indent 4 }} +{{- end }} ports: - port: {{ .Values.service.port }} {{- if .Values.service.nodePort }} diff --git a/kibana/tests/kibana_test.py b/kibana/tests/kibana_test.py index afc37e8fd..1e463d501 100644 --- a/kibana/tests/kibana_test.py +++ b/kibana/tests/kibana_test.py @@ -47,6 +47,9 @@ def test_defaults(): # Make sure that the default 'annotation' dictionary is empty assert 'annotations' not in r['service'][name]['metadata'] + # Make sure that the default 'loadBalancerSourceRanges' dictionary is empty + assert 'loadBalancerSourceRanges' not in r['service'][name]['spec'] + def test_overriding_the_elasticsearch_hosts(): config = ''' elasticsearchHosts: 'http://hello.world' @@ -307,6 +310,30 @@ def test_service_annotatations(): s = r['service'][name]['metadata']['annotations']['service.beta.kubernetes.io/aws-load-balancer-internal'] assert s == "0.0.0.0/0" + +def test_service_load_balancer_source_ranges(): + config = ''' +service: + loadBalancerSourceRanges: + - 0.0.0.0/0 + ''' + r = helm_template(config) + l = r['service'][name]['spec']['loadBalancerSourceRanges'][0] + assert l == "0.0.0.0/0" + + config = ''' +service: + loadBalancerSourceRanges: + - 192.168.0.0/24 + - 192.168.1.0/24 + ''' + r = helm_template(config) + l = r['service'][name]['spec']['loadBalancerSourceRanges'][0] + assert l == "192.168.0.0/24" + l = r['service'][name]['spec']['loadBalancerSourceRanges'][1] + assert l == "192.168.1.0/24" + + def test_adding_a_nodePort(): config = '' diff --git a/kibana/values.yaml b/kibana/values.yaml index c67ba204a..901bba70f 100755 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -91,6 +91,8 @@ 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" + loadBalancerSourceRanges: {} + # 0.0.0.0/0 ingress: enabled: false From 0a936b74b66071ba7c72e396fe1ee9a68a4f3a20 Mon Sep 17 00:00:00 2001 From: ichylinux Date: Thu, 12 Dec 2019 10:29:23 +0900 Subject: [PATCH 2/3] correct dictionary to list --- kibana/tests/kibana_test.py | 2 +- kibana/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kibana/tests/kibana_test.py b/kibana/tests/kibana_test.py index 1e463d501..7ae5ac3ae 100644 --- a/kibana/tests/kibana_test.py +++ b/kibana/tests/kibana_test.py @@ -47,7 +47,7 @@ def test_defaults(): # Make sure that the default 'annotation' dictionary is empty assert 'annotations' not in r['service'][name]['metadata'] - # Make sure that the default 'loadBalancerSourceRanges' dictionary is empty + # Make sure that the default 'loadBalancerSourceRanges' list is empty assert 'loadBalancerSourceRanges' not in r['service'][name]['spec'] def test_overriding_the_elasticsearch_hosts(): diff --git a/kibana/values.yaml b/kibana/values.yaml index 901bba70f..cb3ee52b2 100755 --- a/kibana/values.yaml +++ b/kibana/values.yaml @@ -91,7 +91,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" - loadBalancerSourceRanges: {} + loadBalancerSourceRanges: [] # 0.0.0.0/0 ingress: From ca49aedcebcfdf02e0cfccffe83d670ce3ec8e05 Mon Sep 17 00:00:00 2001 From: ichy Date: Sat, 21 Dec 2019 11:06:36 +0900 Subject: [PATCH 3/3] update README about default service values --- kibana/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kibana/README.md b/kibana/README.md index 556e303b0..ed4137e4b 100644 --- a/kibana/README.md +++ b/kibana/README.md @@ -79,7 +79,7 @@ helm install --name kibana elastic/kibana --set imageTag=7.5.0 | `nodeSelector` | Configurable [nodeSelector](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector) so that you can target specific nodes for your Kibana instances | `{}` | | `tolerations` | Configurable [tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) | `[]` | | `ingress` | Configurable [ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) to expose the Kibana service. See [`values.yaml`](./values.yaml) for an example | `enabled: false` | -| `service` | Configurable [service](https://kubernetes.io/docs/concepts/services-networking/service/) to expose the Kibana service. See [`values.yaml`](./values.yaml) for an example | `type: ClusterIP`
`port: 5601`
`nodePort:`
`annotations: {}` | +| `service` | Configurable [service](https://kubernetes.io/docs/concepts/services-networking/service/) to expose the Kibana service. See [`values.yaml`](./values.yaml) for an example | `type: ClusterIP`
`port: 5601`
`nodePort:`
`annotations: {}`
`loadBalancerSourceRanges: {}` | | `labels` | Configurable [label](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) applied to all Kibana pods | `{}` | | `lifecycle` | Allows you to add lifecycle configuration. See [values.yaml](./values.yaml) for an example of the formatting. | `{}` | | `fullnameOverride` | Overrides the full name of the resources. If not set the name will default to "`.Release.Name`-`.Values.nameOverride or .Chart.Name`" | `""` |