Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #408 from maedadev/master
Browse files Browse the repository at this point in the history
[kibana] add support for loadBalancerSourceRanges
  • Loading branch information
jmlrt authored Jan 6, 2020
2 parents 0b9202f + 4455120 commit f4fb799
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ helm install --name kibana elastic/kibana --set imageTag=7.5.1
| `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`<br>`port: 5601`<br>`nodePort:`<br>`labels: {}`<br>`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`<br>`port: 5601`<br>`nodePort:`<br>`annotations: {}`<br>`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`" | `""` |
Expand Down
4 changes: 4 additions & 0 deletions kibana/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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 }}
Expand Down
27 changes: 27 additions & 0 deletions kibana/tests/kibana_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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' list is empty
assert 'loadBalancerSourceRanges' not in r['service'][name]['spec']

def test_overriding_the_elasticsearch_hosts():
config = '''
elasticsearchHosts: 'http://hello.world'
Expand Down Expand Up @@ -323,6 +326,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 = ''

Expand Down
2 changes: 2 additions & 0 deletions kibana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,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
Expand Down

0 comments on commit f4fb799

Please sign in to comment.