This repository has been archived by the owner on May 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29bbb33
commit 7df9c1f
Showing
9 changed files
with
358 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
tests/ | ||
.pytest_cache/ | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
default: test | ||
include ../../../helpers/examples.mk | ||
|
||
RELEASE := helm-es-networkpolicy | ||
|
||
install: | ||
helm upgrade --wait --timeout=600 --install $(RELEASE) --values ./values.yaml ../../ ; \ | ||
|
||
restart: | ||
helm upgrade --set terminationGracePeriod=121 --wait --timeout=600 --install $(RELEASE) --values ./values.yaml ../../ ; \ | ||
|
||
test: install goss | ||
|
||
purge: | ||
helm del --purge $(RELEASE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
kernel-param: | ||
vm.max_map_count: | ||
value: '262144' | ||
|
||
http: | ||
http://elasticsearch-master:9200/_cluster/health: | ||
status: 200 | ||
timeout: 2000 | ||
body: | ||
- 'green' | ||
- '"number_of_nodes":3' | ||
- '"number_of_data_nodes":3' | ||
|
||
http://localhost:9200: | ||
status: 200 | ||
timeout: 2000 | ||
body: | ||
- '"number" : "7.6.0"' | ||
- '"cluster_name" : "elasticsearch"' | ||
- '"name" : "elasticsearch-master-0"' | ||
- 'You Know, for Search' | ||
|
||
file: | ||
/usr/share/elasticsearch/data: | ||
exists: true | ||
mode: "2775" | ||
owner: root | ||
group: elasticsearch | ||
filetype: directory | ||
|
||
mount: | ||
/usr/share/elasticsearch/data: | ||
exists: true | ||
|
||
user: | ||
elasticsearch: | ||
exists: true | ||
uid: 1000 | ||
gid: 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
networkPolicy: | ||
http: | ||
enabled: true | ||
explicitNamespacesSelector: | ||
# Accept from namespaces with all those different rules (from whitelisted Pods) | ||
matchLabels: | ||
role: frontend | ||
matchExpressions: | ||
- {key: role, operator: In, values: [frontend]} | ||
additionalRules: | ||
- podSelector: | ||
matchLabels: | ||
role: frontend | ||
- podSelector: | ||
matchExpressions: | ||
- key: role | ||
operator: In | ||
values: | ||
- frontend | ||
transport: | ||
enabled: true | ||
allowExternal: true | ||
explicitNamespacesSelector: | ||
matchLabels: | ||
role: frontend | ||
matchExpressions: | ||
- {key: role, operator: In, values: [frontend]} | ||
additionalRules: | ||
- podSelector: | ||
matchLabels: | ||
role: frontend | ||
- podSelector: | ||
matchExpressions: | ||
- key: role | ||
operator: In | ||
values: | ||
- frontend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{- if (or .Values.networkPolicy.http.enabled .Values.networkPolicy.transport.enabled) }} | ||
kind: NetworkPolicy | ||
apiVersion: networking.k8s.io/v1 | ||
metadata: | ||
name: {{ template "elasticsearch.uname" . }} | ||
labels: | ||
heritage: {{ .Release.Service | quote }} | ||
release: {{ .Release.Name | quote }} | ||
chart: "{{ .Chart.Name }}" | ||
app: "{{ template "elasticsearch.uname" . }}" | ||
spec: | ||
podSelector: | ||
matchLabels: | ||
app: "{{ template "elasticsearch.uname" . }}" | ||
ingress: # Allow inbound connections | ||
|
||
{{- if .Values.networkPolicy.http.enabled }} | ||
# For HTTP access | ||
- ports: | ||
- port: {{ .Values.httpPort }} | ||
from: | ||
# From authorized Pods (having the correct label) | ||
- podSelector: | ||
matchLabels: | ||
{{ template "elasticsearch.uname" . }}-http-client: "true" | ||
{{- with .Values.networkPolicy.http.explicitNamespacesSelector }} | ||
# From authorized namespaces | ||
namespaceSelector: | ||
{{ toYaml . | indent 12 }} | ||
{{- end }} | ||
{{- with .Values.networkPolicy.transport.additionalRules }} | ||
# Or from custom additional rules | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- if .Values.networkPolicy.transport.enabled }} | ||
# For transport access | ||
- ports: | ||
- port: {{ .Values.transportPort }} | ||
from: | ||
# From authorized Pods (having the correct label) | ||
- podSelector: | ||
matchLabels: | ||
{{ template "elasticsearch.uname" . }}-transport-client: "true" | ||
{{- with .Values.networkPolicy.transport.explicitNamespacesSelector }} | ||
# From authorized namespaces | ||
namespaceSelector: | ||
{{ toYaml . | indent 12 }} | ||
{{- end }} | ||
{{- with .Values.networkPolicy.transport.additionalRules }} | ||
# Or from custom additional rules | ||
{{ toYaml . | indent 8 }} | ||
{{- end }} | ||
# Or from other ElasticSearch Pods | ||
- podSelector: | ||
matchLabels: | ||
app: "{{ template "elasticsearch.uname" . }}" | ||
{{- end }} | ||
|
||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters