Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GITVERSION := $(shell git describe --long --all)
BUILDDATE := $(shell date -Iseconds)
VERSION := $(or ${VERSION},$(shell git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD))

CONTROLLER_TOOLS_VERSION ?= v0.21.0
CONTROLLER_TOOLS_VERSION ?= v0.22.0
LOCALBIN ?= $(shell pwd)/bin
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
Expand Down
26 changes: 26 additions & 0 deletions api/v2/types_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ type FirewallStatus struct {
// The information is used by the firewall-controller in order to reconcile this firewall.
// See .spec.networks.
FirewallNetworks []FirewallNetwork `json:"firewallNetworks,omitempty"`
// Nics connected to the switches
Nics []Nic `json:"nics,omitempty"`
// VPN configuration
VPN *VPN `json:"vpn,omitempty"`
// Conditions contain the latest available observations of a firewall's current state.
Conditions Conditions `json:"conditions"`
// Phase describes the firewall phase at the current time.
Expand Down Expand Up @@ -254,15 +258,37 @@ type FirewallNetwork struct {
// IPs are the ip addresses used in this network.
IPs []string `json:"ips,omitempty"`
// Nat specifies whether the outgoing traffic is natted or not.
// Deprecated will be superseded by NATTypeV2
Nat *bool `json:"nat"`
// NetworkID is the id of this network.
NetworkID *string `json:"networkID"`
// NetworkType is the type of this network.
// Deprecated will be superseded by NetworkTypeV2
NetworkType *string `json:"networkType"`
// Prefixes are the network prefixes of this network.
Prefixes []string `json:"prefixes,omitempty"`
// Vrf is vrf id of this network.
Vrf *int64 `json:"vrf"`
// Project of this network
Project *string `json:"project,omitempty"`
// NetworkTypeV2 is the type of this network.
NetworkTypeV2 *string `json:"networkTypeV2,omitempty"`
// NATTypeV2 is the nat type of this network.
NATTypeV2 *string `json:"natTypeV2,omitempty"`
}

// Nic contains details of a network interface of this firewall.
type Nic struct {
// Mac the macaddress of this interface.
Mac string `json:"mac,omitempty"`
// Name of this interface.
Name string `json:"name,omitempty"`
}

// VPN Configuration of the firewall
type VPN struct {
// Address of VPN control plane.
ControlPlaneAddress string `json:"control_plane_address,omitempty"`
}

// FirewallList contains a list of firewalls
Expand Down
35 changes: 35 additions & 0 deletions api/v2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.0
controller-gen.kubebuilder.io/version: v0.22.0
name: firewalldeployments.firewall.metal-stack.io
spec:
group: firewall.metal-stack.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.0
controller-gen.kubebuilder.io/version: v0.22.0
name: firewallmonitors.firewall.metal-stack.io
spec:
group: firewall.metal-stack.io
Expand Down
41 changes: 37 additions & 4 deletions config/crds/firewall.metal-stack.io_firewalls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.0
controller-gen.kubebuilder.io/version: v0.22.0
name: firewalls.firewall.metal-stack.io
spec:
group: firewall.metal-stack.io
Expand Down Expand Up @@ -311,20 +311,32 @@ spec:
type: string
type: array
nat:
description: Nat specifies whether the outgoing traffic is natted
or not.
description: |-
Nat specifies whether the outgoing traffic is natted or not.
Deprecated will be superseded by NATTypeV2
type: boolean
natTypeV2:
description: NATTypeV2 is the nat type of this network.
type: string
networkID:
description: NetworkID is the id of this network.
type: string
networkType:
description: NetworkType is the type of this network.
description: |-
NetworkType is the type of this network.
Deprecated will be superseded by NetworkTypeV2
type: string
networkTypeV2:
description: NetworkTypeV2 is the type of this network.
type: string
prefixes:
description: Prefixes are the network prefixes of this network.
items:
type: string
type: array
project:
description: Project of this network
type: string
vrf:
description: Vrf is vrf id of this network.
format: int64
Expand Down Expand Up @@ -389,6 +401,20 @@ spec:
- liveliness
- machineID
type: object
nics:
description: Nics connected to the switches
items:
description: Nic contains details of a network interface of this
firewall.
properties:
mac:
description: Mac the macaddress of this interface.
type: string
name:
description: Name of this interface.
type: string
type: object
type: array
phase:
description: Phase describes the firewall phase at the current time.
type: string
Expand Down Expand Up @@ -417,6 +443,13 @@ spec:
- namespace
- tokenSecretName
type: object
vpn:
description: VPN configuration
properties:
control_plane_address:
description: Address of VPN control plane.
type: string
type: object
required:
- conditions
- phase
Expand Down
2 changes: 1 addition & 1 deletion config/crds/firewall.metal-stack.io_firewallsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.20.0
controller-gen.kubebuilder.io/version: v0.22.0
name: firewallsets.firewall.metal-stack.io
spec:
group: firewall.metal-stack.io
Expand Down
27 changes: 26 additions & 1 deletion controllers/firewall/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,29 @@ func (c *controller) setFirewallNetworks(r *controllers.Ctx[*v2.Firewall], f *mo
return fmt.Errorf("firewall entity is missing essential fields")
}

var result []v2.FirewallNetwork
var (
result []v2.FirewallNetwork
nics []v2.Nic
)

if f.Hardware != nil {
for _, nic := range f.Hardware.Nics {
if len(nic.Neighbors) == 0 {
continue
}
nics = append(nics, v2.Nic{
Name: pointer.SafeDeref(nic.Name),
Mac: pointer.SafeDeref(nic.Mac),
})
}
r.Target.Status.Nics = nics
}

if f.Allocation.Vpn != nil {
r.Target.Status.VPN = &v2.VPN{
ControlPlaneAddress: pointer.SafeDeref(f.Allocation.Vpn.Address),
}
}

for _, n := range f.Allocation.Networks {
if n.Networkid == nil {
Expand All @@ -106,10 +128,13 @@ func (c *controller) setFirewallNetworks(r *controllers.Ctx[*v2.Firewall], f *mo
DestinationPrefixes: n.Destinationprefixes,
IPs: n.Ips,
Nat: n.Nat,
NATTypeV2: n.Nattypev2,
NetworkID: n.Networkid,
NetworkType: n.Networktype,
NetworkTypeV2: n.Networktypev2,
Prefixes: nw.Prefixes,
Vrf: n.Vrf,
Project: n.Projectid,
Comment thread
majst01 marked this conversation as resolved.
Resolved
})
}

Expand Down
Loading