Skip to content

Commit d0969eb

Browse files
Merge pull request #2239 from sunu/ssh-bastion-config-fix
Turn ssh bastion into a StatefulSet
2 parents 8c6971f + d9a21e7 commit d0969eb

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

deploy/helm/ifrcgo-helm/templates/bastion.yaml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ data:
1111
---
1212

1313
apiVersion: v1
14-
kind: PersistentVolumeClaim
14+
kind: ConfigMap
1515
metadata:
16-
name: {{ template "ifrcgo-helm.fullname" . }}-ssh-bastion-config
17-
spec:
18-
accessModes:
19-
- ReadWriteOnce
20-
resources:
21-
requests:
22-
storage: 100Mi
16+
name: {{ template "ifrcgo-helm.fullname" . }}-fix-sshd-config
17+
data:
18+
fix-sshd-config.sh: |
19+
#!/bin/bash
20+
# set -e
21+
sed -i 's/#AllowAgentForwarding yes/AllowAgentForwarding yes/g' /etc/ssh/sshd_config
22+
sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/g' /etc/ssh/sshd_config
2323
2424
---
2525

2626
apiVersion: apps/v1
27-
kind: Deployment
27+
kind: StatefulSet
2828
metadata:
2929
name: {{ template "ifrcgo-helm.fullname" . }}-ssh-bastion
3030
labels:
@@ -44,12 +44,6 @@ spec:
4444
containers:
4545
- name: ssh-bastion
4646
image: linuxserver/openssh-server:latest
47-
command: ["sh", "-c"]
48-
args:
49-
- |
50-
sed -i 's@AllowTcpForwarding no@AllowTcpForwarding yes@' /etc/ssh/sshd_config
51-
touch /tmp/touched
52-
/init
5347
ports:
5448
- containerPort: 2222
5549
resources:
@@ -78,13 +72,26 @@ spec:
7872
readOnly: true
7973
- name: config-volume
8074
mountPath: /config
75+
- name: fix-sshd-config
76+
mountPath: /custom-cont-init.d/fix-sshd-config.sh
77+
subPath: fix-sshd-config.sh
78+
restartPolicy: Always
8179
volumes:
8280
- name: ssh-authorized-keys
8381
configMap:
8482
name: {{ template "ifrcgo-helm.fullname" . }}-ssh-authorized-keys
85-
- name: config-volume
86-
persistentVolumeClaim:
87-
claimName: {{ template "ifrcgo-helm.fullname" . }}-ssh-bastion-config
83+
- name: fix-sshd-config
84+
configMap:
85+
name: {{ template "ifrcgo-helm.fullname" . }}-fix-sshd-config
86+
volumeClaimTemplates:
87+
- metadata:
88+
name: config-volume
89+
spec:
90+
accessModes:
91+
- ReadWriteOnce
92+
resources:
93+
requests:
94+
storage: 100Mi
8895

8996
---
9097

0 commit comments

Comments
 (0)