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

[kibana] Add configurable nodePort to service spec #160

Merged
merged 2 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helpers/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ template:

build:
cd ../helpers/helm-tester && \
docker build -t helm-tester .
for i in {1..5}; do docker build -t helm-tester . && break || sleep 15; done

pytest:
pytest -sv --color=yes
Expand Down
8 changes: 4 additions & 4 deletions helpers/terraform/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ RUN yum -y install \
gcloud config set component_manager/disable_update_check true && \
gcloud version

RUN curl --retry 5 -O https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip && \
RUN curl -O https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip && \
unzip vault_${VAULT_VERSION}_linux_amd64.zip -d /usr/local/bin/ && \
chmod +x /usr/local/bin/vault && \
vault version

RUN curl --retry 5 -O https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
RUN curl -O https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d /usr/local/bin/ && \
rm -f terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
terraform version

RUN curl --retry 5 -O https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
RUN curl -O https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
mv kubectl /usr/local/bin/ && \
chmod a+x /usr/local/bin/kubectl && \
kubectl version --client

RUN curl --retry 5 -O https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
RUN curl -O https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
tar xfv helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/ && \
rm -rf linux-amd64 && \
Expand Down
2 changes: 1 addition & 1 deletion helpers/terraform/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ integration: creds
make

build:
docker build -t helm-charts .
for i in {1..5}; do docker build -t helm-charts . && break || sleep 15; done
2 changes: 1 addition & 1 deletion kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ helm install --name kibana elastic/kibana --version 7.1.1 --set imageTag=7.1.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>`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: {}` |

## Examples

Expand Down
3 changes: 3 additions & 0 deletions kibana/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
{{- if .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end }}
protocol: TCP
name: http
targetPort: {{ .Values.httpPort }}
Expand Down
18 changes: 17 additions & 1 deletion kibana/tests/kibana_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,20 @@ def test_service_annotatations():
'''
r = helm_template(config)
s = r['service'][name]['metadata']['annotations']['service.beta.kubernetes.io/aws-load-balancer-internal']
assert s == "0.0.0.0/0"
assert s == "0.0.0.0/0"

def test_adding_a_nodePort():
config = ''

r = helm_template(config)

assert 'nodePort' not in r['service'][name]['spec']['ports'][0]

config = '''
service:
nodePort: 30001
'''

r = helm_template(config)

assert r['service'][name]['spec']['ports'][0]['nodePort'] == 30001
1 change: 1 addition & 0 deletions kibana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ updateStrategy:
service:
type: ClusterIP
port: 5601
nodePort:
annotations: {}
# cloud.google.com/load-balancer-type: "Internal"
# service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
Expand Down