mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 20:05:46 +08:00
adding templates
This commit is contained in:
parent
801919ab0d
commit
dc6ee1a18a
4 changed files with 140 additions and 1 deletions
43
kube/netclient-template-doks-uspace.yaml
Normal file
43
kube/netclient-template-doks-uspace.yaml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: DaemonSet
|
||||||
|
metadata:
|
||||||
|
name: netclient-1
|
||||||
|
labels:
|
||||||
|
app: netclient-1
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: netclient-1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: netclient-1
|
||||||
|
spec:
|
||||||
|
hostNetwork: true
|
||||||
|
containers:
|
||||||
|
- name: netclient-1
|
||||||
|
image: gravitl/netclient:0.9.1-doks-uspace
|
||||||
|
env:
|
||||||
|
- name: NETCLIENT_ROAMING
|
||||||
|
value: "no"
|
||||||
|
- name: NETCLIENT_PORT
|
||||||
|
value: "51821"
|
||||||
|
- name: NETCLIENT_IS_STATIC
|
||||||
|
value: "yes"
|
||||||
|
- name: NETCLIENT_ENDPOINT
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.hostIP
|
||||||
|
- name: TOKEN
|
||||||
|
value: "<token>"
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/netclient
|
||||||
|
name: etc-netclient
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- hostPath:
|
||||||
|
path: /etc/netclient
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
name: etc-netclient
|
||||||
|
|
93
kube/netclient-template-doks.yaml
Normal file
93
kube/netclient-template-doks.yaml
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: DaemonSet
|
||||||
|
metadata:
|
||||||
|
name: netclient-1
|
||||||
|
labels:
|
||||||
|
app: netclient-1
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: netclient-1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: netclient-1
|
||||||
|
spec:
|
||||||
|
hostNetwork: true
|
||||||
|
containers:
|
||||||
|
- name: netclient-1
|
||||||
|
image: gravitl/netclient:0.9.1-doks
|
||||||
|
env:
|
||||||
|
- name: NETCLIENT_ROAMING
|
||||||
|
value: "no"
|
||||||
|
- name: NETCLIENT_PORT
|
||||||
|
value: "51821"
|
||||||
|
- name: NETCLIENT_IS_STATIC
|
||||||
|
value: "yes"
|
||||||
|
- name: NETCLIENT_ENDPOINT
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: status.hostIP
|
||||||
|
- name: TOKEN
|
||||||
|
value: "<token>"
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/netclient
|
||||||
|
name: etc-netclient
|
||||||
|
- mountPath: /usr/bin/wg
|
||||||
|
name: wg
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- hostPath:
|
||||||
|
path: /etc/netclient
|
||||||
|
type: DirectoryOrCreate
|
||||||
|
name: etc-netclient
|
||||||
|
- hostPath:
|
||||||
|
path: /usr/bin/wg
|
||||||
|
type: File
|
||||||
|
name: wg
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: DaemonSet
|
||||||
|
metadata:
|
||||||
|
name: wireguard-controller
|
||||||
|
labels:
|
||||||
|
app: wireguard-controller
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: wireguard-controller
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: wireguard-controller
|
||||||
|
spec:
|
||||||
|
hostNetwork: true
|
||||||
|
containers:
|
||||||
|
- image: gravitl/netclient:0.9.1-doks
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
name: wg-installer
|
||||||
|
command: ['bash', '-c']
|
||||||
|
args:
|
||||||
|
- while [ 1 ];
|
||||||
|
do if ! command -v wg &> /dev/null;
|
||||||
|
then echo "wireguard not installed, installing";
|
||||||
|
echo 'deb http://deb.debian.org/debian buster-backports main contrib non-free' > /etc/apt/sources.list.d/buster-backports.list;
|
||||||
|
apt update;
|
||||||
|
sudo apt -y install linux-headers-$(uname --kernel-release);
|
||||||
|
apt -y install wireguard wireguard-tools;
|
||||||
|
else echo "wireguard installed";
|
||||||
|
sleep 300;
|
||||||
|
fi;
|
||||||
|
done
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- name: rootfolder
|
||||||
|
mountPath: /
|
||||||
|
volumes:
|
||||||
|
- hostPath:
|
||||||
|
path: /
|
||||||
|
type: ""
|
||||||
|
name: rootfolder
|
||||||
|
|
|
@ -410,7 +410,7 @@ func GetSystemNetworks() ([]string, error) {
|
||||||
return networks, err
|
return networks, err
|
||||||
}
|
}
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
if strings.Contains(f.Name(), "netconfig-") {
|
if strings.Contains(f.Name(), "netconfig-") && !strings.Contains(f.Name(), "backup") {
|
||||||
networkname := stringAfter(f.Name(), "netconfig-")
|
networkname := stringAfter(f.Name(), "netconfig-")
|
||||||
networks = append(networks, networkname)
|
networks = append(networks, networkname)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,12 @@ if [ $? -ne 0 ]; then { echo "Failed to join, quitting." ; exit 1; } fi
|
||||||
|
|
||||||
echo "[netclient] Starting netclient checkin"
|
echo "[netclient] Starting netclient checkin"
|
||||||
# loop and call checkin -n all
|
# loop and call checkin -n all
|
||||||
|
FAILCOUNT=0
|
||||||
while [ 1 ]; do
|
while [ 1 ]; do
|
||||||
# add logs to netclient.logs
|
# add logs to netclient.logs
|
||||||
/root/netclient checkin -n all
|
/root/netclient checkin -n all
|
||||||
|
if [ $? -ne 0 ]; then FAILCOUNT=$((FAILCOUNT+1)) ; else FAILCOUNT=0; fi
|
||||||
|
if [ $FAILCOUNT -gt 2 ]; then { echo "Failing checkins frequently, restarting." ; exit 1; } fi
|
||||||
sleep $SLEEP
|
sleep $SLEEP
|
||||||
done
|
done
|
||||||
echo "[netclient] exiting"
|
echo "[netclient] exiting"
|
||||||
|
|
Loading…
Add table
Reference in a new issue