virtualnetwork

package
v0.25.0 Latest Latest
Warning

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

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

Documentation

Overview

Package virtualnetwork provides the VirtualNetwork Sync Controller for managing Cloudflare Virtual Networks. Unlike TunnelConfigSyncController which aggregates multiple sources, VirtualNetworkSyncController handles individual Virtual Networks with a 1:1 mapping.

Unified Sync Architecture Flow: K8s Resources → Resource Controllers → Core Services → SyncState CRD → Sync Controllers → Cloudflare API

This Sync Controller is the SINGLE point that calls Cloudflare API for Virtual Networks. It handles create, update, and delete operations based on SyncState changes.

Index

Constants

View Source
const (
	// FinalizerName is the finalizer for VirtualNetwork SyncState resources.
	// This ensures we delete the VirtualNetwork from Cloudflare before removing SyncState.
	FinalizerName = "virtualnetwork.sync.cloudflare-operator.io/finalizer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	*common.BaseSyncController
}

Controller is the Sync Controller for VirtualNetwork Configuration. It watches CloudflareSyncState resources of type VirtualNetwork, extracts the configuration, and syncs to Cloudflare API. This is the SINGLE point that calls Cloudflare VirtualNetwork API.

func NewController

func NewController(c client.Client) *Controller

NewController creates a new VirtualNetworkSyncController

func (*Controller) Reconcile

func (r *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile processes a CloudflareSyncState resource for VirtualNetwork. Following Unified Sync Architecture: K8s Resources → Resource Controllers → Core Services → SyncState CRD → Sync Controllers → Cloudflare API

The reconciliation flow: 1. Get the SyncState resource 2. Handle deletion (if being deleted or no sources) 3. Add finalizer for cleanup 4. Check for debounce 5. Extract VirtualNetwork configuration 6. Compute hash for change detection 7. If changed, sync to Cloudflare API 8. Update SyncState status

func (*Controller) SetupWithManager

func (r *Controller) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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