networkroute

package
v0.23.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package networkroute provides the NetworkRouteService for managing Cloudflare NetworkRoute configuration.

Package networkroute provides types and service for NetworkRoute configuration management.

Index

Constants

View Source
const (
	// ResourceType is the SyncState resource type for NetworkRoute
	ResourceType = v1alpha2.SyncResourceNetworkRoute

	// PriorityNetworkRoute is the default priority for NetworkRoute configuration
	PriorityNetworkRoute = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NetworkRouteConfig

type NetworkRouteConfig struct {
	// Network is the CIDR notation for the route (e.g., "10.0.0.0/8")
	Network string `json:"network"`
	// TunnelID is the Cloudflare Tunnel ID to route traffic through
	TunnelID string `json:"tunnelId"`
	// TunnelName is the Cloudflare Tunnel name (for display purposes)
	TunnelName string `json:"tunnelName,omitempty"`
	// VirtualNetworkID is the Cloudflare Virtual Network ID
	VirtualNetworkID string `json:"virtualNetworkId,omitempty"`
	// Comment is a user-provided comment for the route
	Comment string `json:"comment,omitempty"`
}

NetworkRouteConfig represents a NetworkRoute configuration. Each NetworkRoute K8s resource contributes one NetworkRouteConfig to its SyncState.

type RegisterOptions

type RegisterOptions struct {
	// AccountID is the Cloudflare Account ID
	AccountID string
	// RouteNetwork is the network CIDR that serves as the route identifier
	// Used as the CloudflareID in SyncState
	// For new routes, a placeholder is used until the route is created
	RouteNetwork string
	// VirtualNetworkID is the Virtual Network ID for this route
	VirtualNetworkID string
	// Source identifies the K8s resource contributing this configuration
	Source service.Source
	// Config contains the NetworkRoute configuration
	Config NetworkRouteConfig
	// CredentialsRef references the CloudflareCredentials to use
	CredentialsRef v1alpha2.CredentialsReference
}

RegisterOptions contains options for registering a NetworkRoute configuration.

type Service

type Service struct {
	*service.BaseService
}

Service handles NetworkRoute configuration registration. It implements the ConfigService interface for NetworkRoute resources.

func NewService

func NewService(c client.Client) *Service

NewService creates a new NetworkRouteService

func (*Service) GetSyncStatus

func (s *Service) GetSyncStatus(ctx context.Context, source service.Source, knownNetwork, virtualNetworkID string) (*SyncStatus, error)

GetSyncStatus returns the sync status for a NetworkRoute.

func (*Service) Register

func (s *Service) Register(ctx context.Context, opts RegisterOptions) error

Register registers a NetworkRoute configuration to SyncState. Each NetworkRoute K8s resource has its own SyncState, keyed by a generated ID based on the network CIDR and virtual network ID.

func (*Service) Unregister

func (s *Service) Unregister(ctx context.Context, network, virtualNetworkID string, source service.Source) error

Unregister removes a NetworkRoute's configuration from the SyncState. This is called when the NetworkRoute K8s resource is deleted.

func (*Service) UpdateRouteID

func (s *Service) UpdateRouteID(ctx context.Context, source service.Source, network, virtualNetworkID string) error

UpdateRouteID updates the SyncState to use the actual network CIDR as the ID after the route is created. This migrates from the pending placeholder.

type SyncResult

type SyncResult struct {
	// Network is the CIDR notation for the route
	Network string
	// TunnelID is the Cloudflare Tunnel ID
	TunnelID string
	// TunnelName is the Cloudflare Tunnel name
	TunnelName string
	// VirtualNetworkID is the Cloudflare Virtual Network ID
	VirtualNetworkID string
}

SyncResult contains the result of a successful NetworkRoute sync operation.

type SyncStatus

type SyncStatus struct {
	// IsSynced indicates whether the NetworkRoute has been synced to Cloudflare
	IsSynced bool
	// Network is the CIDR notation for the route
	Network string
	// AccountID is the Cloudflare Account ID
	AccountID string
	// SyncStateID is the name of the SyncState resource
	SyncStateID string
}

SyncStatus represents the sync status of a NetworkRoute.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL