Skip to content

Commit c39209d

Browse files
committed
add usage doc for NATGateway and refactor other docs
1 parent 1e56772 commit c39209d

File tree

4 files changed

+75
-11
lines changed

4 files changed

+75
-11
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,58 @@
11
# NATGateway
2+
In the `Ironcore` project, a `NATGateway` (Network Address Translation Gateway) facilitates outbound internet connectivity in private subnets, ensuring that instances in private subnets can access external services without exposing them to unauthorized inbound traffic.
3+
4+
It is a critical network service that provides secure and controlled internet access for private resources in the `Ironcore` infrastructure. It is enforced by the underlying `Ironcore's` network plugin called <a href="https://github.com/ironcore-dev/ironcore-net/blob/main/apinetlet/controllers/natgateway_controller.go"> ironcore-net </a>
5+
6+
# Example NATGateway Resource
7+
An example of how to define a `NATGateway` resource in `Ironcore`
8+
9+
```
10+
apiVersion: networking.ironcore.dev/v1alpha1
11+
kind: NATGateway
12+
metadata:
13+
namespace: default
14+
name: natgateway-sample
15+
spec:
16+
type: Public
17+
ipFamily: IPv4
18+
portsPerNetworkInterface: 64
19+
networkRef:
20+
name: network-sample
21+
```
22+
23+
# Key Fields
24+
- `type`(`string`): This represents a NATGateway type that allocates and routes a stable public IP. The supported value for type is `public`
25+
26+
- `ipFamily`(`string`): `IPFamily` is the IP family of the `NATGateway`. Supported values for IPFamily are `IPv4` and `IPv6`.
27+
28+
- `portsPerNetworkInterface`(`int32`): This Specifies the number of ports allocated per network interface and controls how many simultaneous connections can be handled per interface.
29+
30+
If empty, 2048 (DefaultPortsPerNetworkInterface) is the default.
31+
32+
- `networkRef`(`string`): It represents which network this `NATGateway` serves.
33+
34+
# Example Use Case:
35+
Imagine you have a private server in a private subnet without a public IP. It needs to download software updates from the internet. Instead of giving it direct internet access (which compromises security), the server sends its requests through the NAT Gateway. The NAT Gateway fetches the updates and returns them to the server while keeping the server's private IP hidden from the external world.
36+
37+
# Reconciliation Process:
38+
39+
- **Fetch NATGateway Resource**: It fetches the current state of `NATGateways`, Based on user specifications the desired state of `NATGateway` is determined. This includes the number of NAT Gateways, their types, associated subnets, and routing configurations.
40+
41+
- **Compare and Reconcile**: The reconciler keeps monitoring the state of NAT Gateways to detect any changes or drifts from the desired state, triggering the reconciliation process as needed.
42+
- Creation: If a NAT Gateway specified in the desired state does not exist in the current state, it is created. For instance, creating a public NAT Gateway in a public subnet to provide internet access to instances in private subnets.
43+
44+
- Update: If a NAT Gateway exists but its configuration differs from the desired state, it is updated accordingly. This may involve modifying routing tables or changing associated Elastic IPs.
45+
46+
- Deletion: If a NAT Gateway exists in the current state but is not present in the desired state, it is deleted to prevent unnecessary resource utilization.
47+
48+
- **Error Handling and Logging**: Throughout the reconciliation process, any errors encountered are logged, schedule retries as necessary to ensure eventual consistency.
49+
50+
- **Update Status**:
51+
After reconciling all `NATGateways`, log the successful reconciliation and update the `NATGateways` status with the corresponding values for `ips`as shown below.
52+
53+
```
54+
#status:
55+
# ips:
56+
# - name: ip1
57+
# ip: 10.0.0.1
58+
```

docs/usage/networking/networkinterface.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ spec:
2222
virtualIPRef:
2323
name: virtualip-sample
2424
```
25-
**Note**: For a detailed end-to-end example to understand the ephemeral and non `NetworkInterface`, please refer <a href="https://github.com/ironcore-dev/ironcore/tree/main/config/samples/e2e">E2E Examples</a>
25+
**Note**: For a detailed end-to-end example to understand the ephemeral and non-ephemeral `NetworkInterface` resource, please refer <a href="https://github.com/ironcore-dev/ironcore/tree/main/config/samples/e2e">E2E Examples</a>
2626

2727
# Key Fields
28-
- **networkRef**: `NetworkRef` is the Network this NetworkInterface is connected to
28+
- `networkRef`(`string`): `NetworkRef` is the Network this NetworkInterface is connected to
2929

30-
- **ipFamilies**: `IPFamilies` defines the list of IPFamilies this `NetworkInterface` supports. For eg: `IPV4` and `IPV6`
30+
- `ipFamilies`(`list`): `IPFamilies` defines the list of IPFamilies this `NetworkInterface` supports. Supported values for IPFamily are `IPv4` and `IPv6`.
3131

32-
- **ips**: `IPs` are the list of provided internal IPs which should be assigned to this NetworkInterface
32+
- `ips`(`list`): `IPs` are the list of provided internal IPs which should be assigned to this NetworkInterface
3333

34-
- **virtualIP**: `VirtualIP` specifies the public ip that should be assigned to this NetworkInterface.
34+
- `virtualIP`: `VirtualIP` specifies the public ip that should be assigned to this NetworkInterface.
3535

3636
# Reconciliation Process:
3737

@@ -43,7 +43,7 @@ If the Machine is marked for deletion (indicated by a non-zero DeletionTimestamp
4343
Analyze the Machine's specification to identify the desired ephemeral NetworkInterface resources.
4444
Construct a map detailing these desired NetworkInterfaces, including their configurations and expected states.
4545

46-
- **Fetch Existing Network Interfaces**:
46+
- **Fetch Existing NetworkInterfaces**:
4747
List all existing NetworkInterface resources within the same namespace as the Machine.
4848

4949
- **Compare and Reconcile**:

docs/usage/networking/networkpolicy.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ https://github.com/ironcore-dev/ironcore/tree/main/config/samples/e2e/network-po
6464

6565
- `policyTypes`(`list`): There are two supported policyTypes `Ingress` and `Egress`.
6666

67-
- `ingress`(`list`): ingress defines the list of `NetworkPolicyIngressRules`. Each NetworkPolicy may include a list of allowed `ingress` rules. Each rule allows traffic that matches both the `from` and `ports` sections. The example policy contains a single rule, which matches traffic on a single port, from one of three sources, the first specified via an ipBlock, the second and third via different objectSelector.
67+
- `ingress`(`list`): An Ingress section in a `NetworkPolicy` defines a list of `NetworkPolicyIngressRules` that specify which incoming traffic is allowed. Each `NetworkPolicy` can have multiple ingress rules, and each rule allows traffic that satisfies both the from and ports criteria.
68+
69+
For example, a `NetworkPolicy` with a single ingress rule may permit traffic on a specific port and only from one of the following sources:
70+
- An IP range, defined using an ipBlock.
71+
- A set of resources identified by an objectSelector.
6872

6973
- `egress`(`list`): egress defines the list of `NetworkPolicyEgressRules`. Each NetworkPolicy may include a list of allowed egress rules. Each rule allows traffic that matches both `to` and `ports` sections. The example policy contains a single rule, which matches traffic on a single port to any destination in 10.0.0.0/24.
7074

docs/usage/networking/virtualip.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ metadata:
1111
spec:
1212
type: Public
1313
ipFamily: IPv4
14-
#status:
15-
# ip: 10.0.0.1 # This will be populated by the corresponding controller.
1614
```
1715

1816
# Key Fields
19-
- **type**(`string`): Currently supported type is `public`, which allocates and routes a stable public IP.
17+
- `type`(`string`): Currently supported type is `public`, which allocates and routes a stable public IP.
2018

21-
- **ipFamily**(`string`): `IPFamily` is the ip family of the VirtualIP. Supported values for IPFamily are `IPv4` or `IPv6`.
19+
- `ipFamily`(`string`): `IPFamily` is the ip family of the VirtualIP. Supported values for IPFamily are `IPv4` and `IPv6`.
2220

2321

2422
# Reconciliation Process:
@@ -39,6 +37,11 @@ Requeue the reconciliation to retry the operation.
3937
Update the VirtualIP status to reflect the actual state of the APINet IP.
4038
If successfully allocated, update the status with the assigned IP address.
4139

40+
for example:
41+
```
42+
#status:
43+
# ip: 10.0.0.1 # This will be populated by the corresponding controller.
44+
```
4245
- **Networking Configuration**:
4346
- VM Integration: The allocated VirtualIP is associated with the VM through network configuration mechanisms
4447
- Load Balancer Integration: If a load balancer is used, the virtualIP is configured as the frontend IP to route requests to the VM.

0 commit comments

Comments
 (0)