Skip to content

Commit ee1db67

Browse files
author
Michael Lechner
committed
chore: enhance server and NAT gateway configurations in Helm chart with updated user data and network settings
1 parent ffd3633 commit ee1db67

File tree

2 files changed

+81
-55
lines changed

2 files changed

+81
-55
lines changed

examples-chart/templates/server.yaml

Lines changed: 24 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,64 +14,34 @@ spec:
1414
matchLabels:
1515
cloudscale.crossplane.io/subnet: {{ .Values.subnet.name }}
1616
type: private
17-
- type: public
1817
name: {{ .Values.server.name }}
1918
sshKeys: {{ .Values.server.sshKeys }}
2019
zoneSlug: {{ .Values.server.zoneSlug }}
2120
userData: |
2221
{{- .Values.server.userData | nindent 6 }}
2322

24-
# apiVersion: cloudscale.crossplane.io/v1alpha1
25-
# kind: Server
26-
# metadata:
27-
# labels:
28-
# cloudscale.crossplane.io/server: nat-gateway
29-
# name: nat-gateway
30-
# spec:
31-
# forProvider:
32-
# flavorSlug: flex-4-2
33-
# imageSlug: ubuntu-24.04
34-
# interfaces:
35-
# - type: public
36-
# - addresses:
37-
# - subnetUuidSelector:
38-
# matchLabels:
39-
# cloudscale.crossplane.io/subnet: {{ .Values.subnet.name }}
40-
# type: private
41-
# name: nat-gateway
42-
# sshKeys: {{ .Values.server.sshKeys }}
43-
# zoneSlug: {{ .Values.server.zoneSlug }}
44-
# userData: |
45-
# #cloud-config
46-
# write_files:
47-
# - path: /etc/sysctl.d/99-ip-forward.conf
48-
# content: |
49-
# net.ipv4.ip_forward = 1
50-
# owner: root:root
51-
# mode: '0644'
52-
53-
# - path: /etc/iptables/rules.v4
54-
# content: |
55-
# *nat
56-
# :PREROUTING ACCEPT [0:0]
57-
# :INPUT ACCEPT [0:0]
58-
# :OUTPUT ACCEPT [0:0]
59-
# :POSTROUTING ACCEPT [0:0]
60-
# -A POSTROUTING -o ens3 -j MASQUERADE
61-
# COMMIT
62-
63-
# *filter
64-
# :INPUT ACCEPT [0:0]
65-
# :FORWARD ACCEPT [0:0]
66-
# :OUTPUT ACCEPT [0:0]
67-
# -A FORWARD -o ens3 -i ens4 -s {{ .Values.subnet.cidr }} -m conntrack --ctstate NEW -j ACCEPT
68-
# -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
69-
# COMMIT
70-
# owner: root:root
71-
# mode: '0644'
23+
---
7224

73-
# runcmd:
74-
# - sysctl --system
75-
# - iptables-restore < /etc/iptables/rules.v4
76-
# - systemctl enable netfilter-persistent
77-
# - systemctl start netfilter-persistent
25+
apiVersion: cloudscale.crossplane.io/v1alpha1
26+
kind: Server
27+
metadata:
28+
labels:
29+
cloudscale.crossplane.io/server: nat-gateway
30+
name: nat-gateway
31+
spec:
32+
forProvider:
33+
flavorSlug: {{ .Values.natGateway.flavorSlug }}
34+
imageSlug: {{ .Values.natGateway.imageSlug }}
35+
interfaces:
36+
- type: public
37+
- addresses:
38+
- address: {{ .Values.natGateway.address }}
39+
subnetUuidSelector:
40+
matchLabels:
41+
cloudscale.crossplane.io/subnet: {{ .Values.subnet.name }}
42+
type: private
43+
name: nat-gateway
44+
sshKeys: {{ .Values.natGateway.sshKeys }}
45+
zoneSlug: {{ .Values.natGateway.zoneSlug }}
46+
userData: |
47+
{{- .Values.natGateway.userData | nindent 6 }}

examples-chart/values.yaml

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ server:
77
zoneSlug: lpg1
88
userData: |
99
#cloud-config
10+
write_files:
11+
- path: /etc/netplan/01-netcfg.yaml
12+
content: |
13+
network:
14+
version: 2
15+
ethernets:
16+
ens3:
17+
dhcp4: true
18+
routes:
19+
- to: 0.0.0.0/0
20+
via: 10.11.12.1
21+
metric: 1
1022
runcmd:
23+
- netplan apply
1124
- apt-get update
1225
- apt-get install -y nginx
1326
- systemctl start nginx
@@ -33,4 +46,47 @@ loadbalancer:
3346
listener:
3447
name: web-loadbalancer-listener
3548
protocol: tcp
36-
protocolPort: 80
49+
protocolPort: 80
50+
51+
natGateway:
52+
name: nat-gateway
53+
flavorSlug: flex-4-2
54+
imageSlug: ubuntu-24.04
55+
address: 10.11.12.1
56+
sshKeys:
57+
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOf/JADcF3j0vZH1gXT+But9nNkVt5tN9LAaJe6Cn6sm
58+
zoneSlug: lpg1
59+
userData: |
60+
#cloud-config
61+
write_files:
62+
- path: /etc/sysctl.d/99-ip-forward.conf
63+
content: |
64+
net.ipv4.ip_forward = 1
65+
owner: root:root
66+
mode: '0644'
67+
68+
- path: /etc/iptables/rules.v4
69+
content: |
70+
*nat
71+
:PREROUTING ACCEPT [0:0]
72+
:INPUT ACCEPT [0:0]
73+
:OUTPUT ACCEPT [0:0]
74+
:POSTROUTING ACCEPT [0:0]
75+
-A POSTROUTING -o ens3 -j MASQUERADE
76+
COMMIT
77+
78+
*filter
79+
:INPUT ACCEPT [0:0]
80+
:FORWARD ACCEPT [0:0]
81+
:OUTPUT ACCEPT [0:0]
82+
-A FORWARD -o ens3 -i ens4 -s {{ .Values.subnet.cidr }} -m conntrack --ctstate NEW -j ACCEPT
83+
-A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
84+
COMMIT
85+
owner: root:root
86+
mode: '0644'
87+
88+
runcmd:
89+
- sysctl --system
90+
- iptables-restore < /etc/iptables/rules.v4
91+
- systemctl enable netfilter-persistent
92+
- systemctl start netfilter-persistent

0 commit comments

Comments
 (0)