Documentation
¶
Index ¶
- Variables
- func DeclareOwner(ip *v1beta1.NetBoxIP, obj client.Object) error
- func HasPublishLabels(publishLabels map[string]bool, objLabels map[string]string) bool
- func NetBoxIPName(obj client.Object, suffix string) string
- func Scheme(ip netip.Addr) string
- func UpsertNetBoxIP(ctx context.Context, kubeClient client.Client, ll *log.Logger, ...) error
- type Controller
- type IPs
- type NetBoxIPConfig
- type Option
- func WithClusterDomain(domain string) Option
- func WithDualStackIP() Option
- func WithKubernetesClient(client client.Client) Option
- func WithLabels(labels map[string]bool) Option
- func WithLogger(logger *log.Logger) Option
- func WithNetBoxClient(client netbox.Client) Option
- func WithTags(tags []string, netboxClient netbox.Client) Option
- type Settings
Constants ¶
This section is empty.
Variables ¶
var OnCreateAndUpdateFilter = predicate.Funcs{ CreateFunc: func(e event.CreateEvent) bool { return e.Object != nil }, UpdateFunc: func(e event.UpdateEvent) bool { return e.ObjectNew != nil }, DeleteFunc: func(_ event.DeleteEvent) bool { return false }, }
OnCreateAndUpdateFilter is an event filter that keeps only create and update events, and not deletes.
Functions ¶
func DeclareOwner ¶
DeclareOwner sets the provided object as the controller of the given NetBoxIP.
func HasPublishLabels ¶ added in v0.2.0
HasPublishLabels checks if the given object labels contain any of the publish labels (i.e. labels that indicate its IP should be exported).
func NetBoxIPName ¶
NetBoxIPName derives NetBoxIP name from the object's metadata. suffix may be an empty string, in which case it is ignored. Otherwise, it is appended to the returned name to provide additional context to the IP (such as including the IP address' scheme as part of the name)
Types ¶
type Controller ¶
Controller is responsible for updating IPs of a single k8s resource.
type IPs ¶
IPs is a struct used to store the NetBoxIPs belonging to a pod or service. A nil value means the pod or service does not have an IP of that scheme. If dual stack is not enabled, at least one of the two IPs will be nil
func CreateNetBoxIPs ¶
func CreateNetBoxIPs(ips []string, config NetBoxIPConfig) (*IPs, error)
CreateNetBoxIPs takes a slice of IP addresses in string form and creates NetBoxIPs according to the configuration specified by config The IP addresses are returned in the form of an IPs struct. If IPv4 or IPv6 is nil in the returned struct, that means no IP address of that scheme was given as input
type NetBoxIPConfig ¶
type NetBoxIPConfig struct { Object client.Object DNSName string ReconcilerTags []netbox.Tag ReconcilerLabels map[string]bool }
NetBoxIPConfig is a struct used to pass configuration parameters for the NetBoxIPs created by CreateNetBoxIPs
type Option ¶
Option can be used to tune controller settings.
func WithClusterDomain ¶
WithClusterDomain sets the k8s cluster domain name.
func WithDualStackIP ¶
func WithDualStackIP() Option
WithDualStackIP enables registering both IPv6 and IPv4 address in netbox for dual stack pods and services.
func WithKubernetesClient ¶ added in v0.4.0
WithKubernetesClient sets the Kubernetes client to be used by the controller
func WithLabels ¶
WithLabels sets the k8s object labels that are added to the description of every IP published by the controller.
func WithLogger ¶
WithLogger sets the logger to be used by the controller.
func WithNetBoxClient ¶
WithNetBoxClient sets the NetBox client to be used by the controller.