Skip to content

Commit

Permalink
feat: add default-container, docs: updated development docs, ci: upda…
Browse files Browse the repository at this point in the history
…te test values
  • Loading branch information
fbuchmeier committed Nov 5, 2022
1 parent 0aa97e9 commit f29590d
Show file tree
Hide file tree
Showing 16 changed files with 173 additions and 64 deletions.
23 changes: 21 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,29 @@ endef
define test =
set -e
shopt -s globstar
status=succeeded
failed=()
succeeded=()
for v in ./test-values/**/*.yaml ; do
helm template -f "${v}" . | diff - ./test-fixtures/$(basename "${v}")
echo "✓ Diffing ${v} with ./test-fixtures/$(basename ${v})"
echo "➞ Diffing ${v} with ./test-fixtures/$(basename ${v})"
if helm template -f "${v}" . | diff - ./test-fixtures/$(basename "${v}") ; then
symb=✓
succeeded+=(./test-fixtures/$(basename ${v}))
else
status=failed
failed+=(./test-fixtures/$(basename ${v}))
symb=✗
fi
echo "${symb} Diffing ${v} with ./test-fixtures/$(basename ${v}) ${status}"
echo ""
done

echo " Summary"
echo " -------"
echo " Succeeded tests: ${#succeeded[@]}"
echo " Failed tests: ${#failed[@]}"

[ "${status}" == "succeeded" ]
endef

.SILENT: validate validate-helm validate-yaml validate-shell validate-markdown package snapshot test release
Expand Down
50 changes: 49 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
# Helm
# Development

## minikube

To deploy and test the chart, you can use
[minikube](https://minikube.sigs.k8s.io/docs/start/).

### Setup

```sh
kubectl create ns arma3
```

```sh
STEAM_USER=bob
STEAM_PASSWORD=abc
TEST_VALUES=rwo-rwo.yaml
RELEASE=arma3-${TEST_VALUES/".yaml"/}

helm upgrade --install "$RELEASE" . -n arma3 \
-f test-values/"$TEST_VALUES" \
--set credentials.steamUser="$STEAM_USER" \
--set credentials.steamPassword="$STEAM_PASSWORD"
```

```sh
watch kubectl get pods -n arma3
```

### Teardown

Uninstall helm release:

```sh
helm uninstall -n arma3 "$RELEASE"
```

Cleanup any unused volumes belonging to this release (copy and paste the output
command when satisfied):

```sh
echo kubectl delete pv $(
kubectl get pv -o json \
| jq -r --arg release "$RELEASE" \
'.items[] | select( .spec.claimRef.name | contains($release) ) | .metadata.name'
)
```

## Helm

Run linting:

Expand Down
28 changes: 28 additions & 0 deletions docs/known_issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,31 @@
connect.
- Solution: Move the second process occupying port 2502 to e.g. 3002 to
reserve enough room for ARMA 3

- Problem: `FileNotFoundError: [Errno 2] No such file or directory:
'/arma3/arma3server'` on startup in log output

```text
Logging in user 'noLookupWhenTemplating' to Steam Public...FAILED (Invalid Password)
Installing ARMA 3
Headless Clients: 0
LAUNCHING ARMA SERVER WITH /arma3/arma3server -limitFPS=100 -world=empty
-mod="" -config="/arma3/configs/main.cfg" -port=2302 -name="main"
-profiles="/arma3/configs/profiles"
Traceback (most recent call last):
File "/launch.py", line 144, in <module>
with subprocess.Popen((launch.split(' ')), stdout=subprocess.PIPE,
bufsize=1, universal_newlines=True,
stderr=subprocess.STDOUT) as process:
File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.9/subprocess.py", line 1823, in_execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
```
- Explanation: The actual error is `Logging in user 'noLookupWhenTemplating'
to Steam Public...FAILED (Invalid Password)`
- Solution: Make sure to either set`credentials.steamUser` and
`credentials.steamPassword` OR `useExistingSecret.enabled=true` when
installing the chart.
3 changes: 2 additions & 1 deletion templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ spec:
app.kubernetes.io/component: server
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
kubectl.kubernetes.io/default-container: "server"
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand Down
12 changes: 4 additions & 8 deletions templates/headlessclient.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ spec:
app.kubernetes.io/component: headlessclient
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
kubectl.kubernetes.io/default-container: "{{ .Values.headlessclient.name }}"
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
Expand All @@ -48,7 +49,7 @@ spec:
- -c
- |
while ! timeout 10 nc -zv {{ include "arma3.fullname" . }}-rsyncd 873 ; do
echo "Could not connect to {{ include "arma3.fullname" . }}-rsyncd:873, waiting for 10 seconds before trying again"
echo "$[(date)] Could not connect to {{ include "arma3.fullname" . }}-rsyncd:873, waiting for 10 seconds before trying again"
sleep 10
done
resources:
Expand All @@ -74,12 +75,7 @@ spec:
- rsync://{{ .Values.headlessclient.name }}@{{ include "arma3.fullname" . }}-rsyncd:873/volume
- /arma3/
resources:
limits:
memory: 512Mi
cpu: 4
requests:
memory: 256Mi
cpu: 1
{{- toYaml .Values.headlessclient.initResources | nindent 12 }}
volumeMounts:
- name: data
mountPath: /arma3
Expand Down
14 changes: 7 additions & 7 deletions test-fixtures/ephemeral.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ spec:
app.kubernetes.io/component: server
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: "server"
labels:
app.kubernetes.io/name: arma3
app.kubernetes.io/instance: RELEASE-NAME
Expand Down Expand Up @@ -849,13 +851,16 @@ metadata:
reloader.stakater.com/auto: "true"
spec:
serviceName: RELEASE-NAME-arma3-headlessclient
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: arma3
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/component: headlessclient
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: "hc"
labels:
app.kubernetes.io/name: arma3
app.kubernetes.io/instance: RELEASE-NAME
Expand All @@ -882,7 +887,7 @@ spec:
- -c
- |
while ! timeout 10 nc -zv RELEASE-NAME-arma3-rsyncd 873 ; do
echo "Could not connect to RELEASE-NAME-arma3-rsyncd:873, waiting for 10 seconds before trying again"
echo "$[(date)] Could not connect to RELEASE-NAME-arma3-rsyncd:873, waiting for 10 seconds before trying again"
sleep 10
done
resources:
Expand Down Expand Up @@ -911,12 +916,7 @@ spec:
- rsync://hc@RELEASE-NAME-arma3-rsyncd:873/volume
- /arma3/
resources:
limits:
memory: 512Mi
cpu: 4
requests:
memory: 256Mi
cpu: 1
{}
volumeMounts:
- name: data
mountPath: /arma3
Expand Down
19 changes: 9 additions & 10 deletions test-fixtures/production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ spec:
resources:
requests:
storage: "100Gi"
storageClassName: "longhorn"
storageClassName: "nfs"
---
# Source: arma3/templates/pvc.yaml
kind: PersistentVolumeClaim
Expand All @@ -521,7 +521,7 @@ spec:
resources:
requests:
storage: "100Gi"
storageClassName: "longhorn"
storageClassName: "disk"
---
# Source: arma3/templates/pvc.yaml
kind: PersistentVolumeClaim
Expand All @@ -540,7 +540,7 @@ spec:
resources:
requests:
storage: "2Gi"
storageClassName: "longhorn-crypto"
storageClassName: "disk"
---
# Source: arma3/templates/service-headlessclient.yaml
apiVersion: v1
Expand Down Expand Up @@ -696,6 +696,8 @@ spec:
app.kubernetes.io/component: server
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: "server"
labels:
app.kubernetes.io/name: arma3
app.kubernetes.io/instance: RELEASE-NAME
Expand Down Expand Up @@ -939,6 +941,8 @@ spec:
app.kubernetes.io/component: headlessclient
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: "hc"
labels:
app.kubernetes.io/name: arma3
app.kubernetes.io/instance: RELEASE-NAME
Expand All @@ -965,7 +969,7 @@ spec:
- -c
- |
while ! timeout 10 nc -zv RELEASE-NAME-arma3-rsyncd 873 ; do
echo "Could not connect to RELEASE-NAME-arma3-rsyncd:873, waiting for 10 seconds before trying again"
echo "$[(date)] Could not connect to RELEASE-NAME-arma3-rsyncd:873, waiting for 10 seconds before trying again"
sleep 10
done
resources:
Expand Down Expand Up @@ -994,12 +998,7 @@ spec:
- rsync://hc@RELEASE-NAME-arma3-rsyncd:873/volume
- /arma3/
resources:
limits:
memory: 512Mi
cpu: 4
requests:
memory: 256Mi
cpu: 1
{}
volumeMounts:
- name: data
mountPath: /arma3
Expand Down
17 changes: 7 additions & 10 deletions test-fixtures/rwo-rwo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,6 @@ spec:
resources:
requests:
storage: "100Gi"
storageClassName: "longhorn"
---
# Source: arma3/templates/pvc.yaml
kind: PersistentVolumeClaim
Expand All @@ -519,7 +518,6 @@ spec:
resources:
requests:
storage: "100Gi"
storageClassName: "longhorn"
---
# Source: arma3/templates/pvc.yaml
kind: PersistentVolumeClaim
Expand All @@ -538,7 +536,6 @@ spec:
resources:
requests:
storage: "2Gi"
storageClassName: "longhorn-crypto"
---
# Source: arma3/templates/service-headlessclient.yaml
apiVersion: v1
Expand Down Expand Up @@ -687,6 +684,8 @@ spec:
app.kubernetes.io/component: server
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: "server"
labels:
app.kubernetes.io/name: arma3
app.kubernetes.io/instance: RELEASE-NAME
Expand Down Expand Up @@ -908,13 +907,16 @@ metadata:
reloader.stakater.com/auto: "true"
spec:
serviceName: RELEASE-NAME-arma3-headlessclient
replicas: 2
selector:
matchLabels:
app.kubernetes.io/name: arma3
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/component: headlessclient
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: "hc"
labels:
app.kubernetes.io/name: arma3
app.kubernetes.io/instance: RELEASE-NAME
Expand All @@ -941,7 +943,7 @@ spec:
- -c
- |
while ! timeout 10 nc -zv RELEASE-NAME-arma3-rsyncd 873 ; do
echo "Could not connect to RELEASE-NAME-arma3-rsyncd:873, waiting for 10 seconds before trying again"
echo "$[(date)] Could not connect to RELEASE-NAME-arma3-rsyncd:873, waiting for 10 seconds before trying again"
sleep 10
done
resources:
Expand Down Expand Up @@ -970,12 +972,7 @@ spec:
- rsync://hc@RELEASE-NAME-arma3-rsyncd:873/volume
- /arma3/
resources:
limits:
memory: 512Mi
cpu: 4
requests:
memory: 256Mi
cpu: 1
{}
volumeMounts:
- name: data
mountPath: /arma3
Expand Down
Loading

0 comments on commit f29590d

Please sign in to comment.