Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm chart improvements #86

Merged
merged 2 commits into from
Nov 21, 2024
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
4 changes: 2 additions & 2 deletions kubernetes/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- define "name-client" -}}
{{ printf "%s-client-%s" $.Chart.Name $.Release.Name | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{ printf "%s-client" $.Chart.Name | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "name-server" -}}
{{ printf "%s-server-%s" $.Chart.Name $.Release.Name | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{ printf "%s-server" $.Chart.Name | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
2 changes: 2 additions & 0 deletions kubernetes/helm/templates/client-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "name-client" . }}-nginx
namespace: {{ $.Release.Namespace }}
data:
nginx.conf: |
worker_processes auto;
Expand All @@ -24,6 +25,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ template "name-client" . }}-env
namespace: {{ $.Release.Namespace }}
stringData:
INVITE_TOKEN: {{ quote .Values.peering.psk }}

Expand Down
4 changes: 4 additions & 0 deletions kubernetes/helm/templates/client-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ spec:
labels:
application: {{ template "name-client" . }}
spec:
{{- if .Values.docker.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.docker.imagePullSecrets | nindent 8 }}
{{- end }}
shareProcessNamespace: true
{{- if .Values.client.priorityClassName }}
priorityClassName: {{ .Values.client.priorityClassName }}
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/helm/templates/server-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "name-server" . }}-nginx
namespace: {{ $.Release.Namespace }}
data:
nginx.conf: |
worker_processes auto;
Expand All @@ -24,6 +25,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ template "name-server" . }}-env
namespace: {{ $.Release.Namespace }}
stringData:
INVITE_TOKEN: {{ .Values.peering.psk | quote }}

Expand Down
4 changes: 4 additions & 0 deletions kubernetes/helm/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ spec:
labels:
application: {{ template "name-server" . }}
spec:
{{- if .Values.docker.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.docker.imagePullSecrets | nindent 8 }}
{{- end }}
shareProcessNamespace: true
{{- if .Values.server.priorityClassName }}
priorityClassName: {{ .Values.server.priorityClassName }}
Expand Down
4 changes: 4 additions & 0 deletions kubernetes/helm/templates/server-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
application: {{ template "name-server" . }}
{{- if .Values.server.service.annotations }}
annotations:
{{- toYaml .Values.server.service.annotations | nindent 4 }}
{{- end }}
spec:
ports:
- name: data
Expand Down
2 changes: 2 additions & 0 deletions kubernetes/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ server:
name: server

service:
annotations: null
type: LoadBalancer

priorityClassName: ""
Expand Down Expand Up @@ -91,6 +92,7 @@ docker:
wgVersion: latest # GHA
nginxImage: glothriel/wormhole-nginx
nginxVersion: latest # GHA
pullSecrets: null

peering:
psk: defaultPeeringKeyPleaseChangeMe
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def k8s_server(
{
"server.enabled": True,
"networkPolicies.enabled": True,
"server.wg.publicHost": "wormhole-server-server.server.svc.cluster.local",
"server.wg.publicHost": "wormhole-server.server.svc.cluster.local",
"server.service.type": "ClusterIP",
"docker.image": wormhole_image.split(":")[0],
"docker.version": wormhole_image.split(":")[1],
Expand Down Expand Up @@ -220,7 +220,7 @@ def k8s_client(
"client.enabled": True,
"networkPolicies.enabled": True,
"client.name": "client",
"client.serverDsn": "http://wormhole-server-server.server.svc.cluster.local:8080",
"client.serverDsn": "http://wormhole-server.server.svc.cluster.local:8080",
"docker.image": wormhole_image.split(":")[0],
"docker.version": wormhole_image.split(":")[1],
"docker.wgImage": wireguard_image.split(":")[0],
Expand Down
6 changes: 3 additions & 3 deletions tests/test_kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,17 @@ def test_reconnecting_clients_with_keys(
@retry(tries=int(DEFAULT_RETRY_TRIES / 10), delay=DEFAULT_RETRY_DELAY)
def _wait_for_peers_paired_using_psk():
assert "Paired with server, assigned IP" in kubectl.run(
["-n", "client", "logs", "-l", "application=wormhole-client-client", "-c", "wormhole"]
["-n", "client", "logs", "-l", "application=wormhole-client", "-c", "wormhole"]
).stdout.decode()

_wait_for_peers_paired_using_psk()

kubectl.run(["-n", "client", "delete", "pod", "-l", "application=wormhole-client-client"])
kubectl.run(["-n", "client", "delete", "pod", "-l", "application=wormhole-client"])

@retry(tries=int(DEFAULT_RETRY_TRIES / 10), delay=DEFAULT_RETRY_DELAY)
def _wait_for_peers_paired_using_keys():
assert "using IP from the cache" in kubectl.run(
["-n", "client", "logs", "-l", "application=wormhole-client-client", "-c", "wormhole"]
["-n", "client", "logs", "-l", "application=wormhole-client", "-c", "wormhole"]
).stdout.decode()

_wait_for_peers_paired_using_keys()
Loading