mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 18:59:09 +00:00
Add network egress resource (#357)
This change adds a new import resource which enables exposing Netbird resources as Kubernetes services. This remove the need to add sidecars to every pod. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a new `NetworkEgress` custom resource (`netbird.io/v1alpha1`) with CRD, schema validation, and status/conditions. * Extended controller functionality to create egress services and translate egress rules into import `EndpointSlice` resources; egress pods now include a kube-egress-forwarder sidecar. * **Bug Fixes** * Added missing deep-copy and declarative apply support for the new `NetworkEgress` API types. * **Documentation** * Updated README/API reference and added example manifests for `NetworkEgress` (including IP/FQDN target usage). <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
// NetworkEgressSpecApplyConfiguration represents a declarative configuration of the NetworkEgressSpec type for use
|
||||
// with apply.
|
||||
//
|
||||
// NetworkEgressSpec defines the desired state of NetworkEgress.
|
||||
type NetworkEgressSpecApplyConfiguration struct {
|
||||
// NetworkRouterRef is a reference to the network and router where the resource will be created.
|
||||
NetworkRouterRef *CrossNamespaceReferenceApplyConfiguration `json:"networkRouterRef,omitempty"`
|
||||
// Target for egress traffic.
|
||||
Target *NetworkEgressTargetApplyConfiguration `json:"target,omitempty"`
|
||||
// Ports to the resource to route.
|
||||
Ports []NetworkEgressPortApplyConfiguration `json:"ports,omitempty"`
|
||||
}
|
||||
|
||||
// NetworkEgressSpecApplyConfiguration constructs a declarative configuration of the NetworkEgressSpec type for use with
|
||||
// apply.
|
||||
func NetworkEgressSpec() *NetworkEgressSpecApplyConfiguration {
|
||||
return &NetworkEgressSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithNetworkRouterRef sets the NetworkRouterRef field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the NetworkRouterRef field is set to the value of the last call.
|
||||
func (b *NetworkEgressSpecApplyConfiguration) WithNetworkRouterRef(value *CrossNamespaceReferenceApplyConfiguration) *NetworkEgressSpecApplyConfiguration {
|
||||
b.NetworkRouterRef = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithTarget sets the Target field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Target field is set to the value of the last call.
|
||||
func (b *NetworkEgressSpecApplyConfiguration) WithTarget(value *NetworkEgressTargetApplyConfiguration) *NetworkEgressSpecApplyConfiguration {
|
||||
b.Target = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPorts adds the given value to the Ports field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Ports field.
|
||||
func (b *NetworkEgressSpecApplyConfiguration) WithPorts(values ...*NetworkEgressPortApplyConfiguration) *NetworkEgressSpecApplyConfiguration {
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithPorts")
|
||||
}
|
||||
b.Ports = append(b.Ports, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
Reference in New Issue
Block a user