Documentation
¶
Overview ¶
Package privateservice provides the PrivateServiceService for managing Cloudflare PrivateService configuration.
Package privateservice provides types and service for PrivateService configuration management.
Index ¶
- Constants
- type PrivateServiceConfig
- type RegisterOptions
- type Service
- func (s *Service) GetSyncStatus(ctx context.Context, source service.Source, ...) (*SyncStatus, error)
- func (s *Service) Register(ctx context.Context, opts RegisterOptions) error
- func (s *Service) Unregister(ctx context.Context, network, virtualNetworkID string, source service.Source) error
- func (s *Service) UpdateRouteID(ctx context.Context, source service.Source, network, virtualNetworkID string) error
- type SyncResult
- type SyncStatus
Constants ¶
const ( // ResourceType is the SyncState resource type for PrivateService ResourceType = v1alpha2.SyncResourcePrivateService // PriorityPrivateService is the default priority for PrivateService configuration PriorityPrivateService = 100 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrivateServiceConfig ¶
type PrivateServiceConfig struct {
// Network is the CIDR notation for the route (e.g., "10.96.0.1/32")
// Derived from the referenced Service's ClusterIP
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"`
// ServiceIP is the ClusterIP of the referenced K8s Service
ServiceIP string `json:"serviceIP"`
// Comment is a user-provided comment for the route
Comment string `json:"comment,omitempty"`
}
PrivateServiceConfig represents a PrivateService configuration. Each PrivateService K8s resource contributes one PrivateServiceConfig 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 PrivateService configuration
Config PrivateServiceConfig
// CredentialsRef references the CloudflareCredentials to use
CredentialsRef v1alpha2.CredentialsReference
}
RegisterOptions contains options for registering a PrivateService configuration.
type Service ¶
type Service struct {
*service.BaseService
}
Service handles PrivateService configuration registration. It implements the ConfigService interface for PrivateService resources.
func NewService ¶
NewService creates a new PrivateServiceService
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 PrivateService.
func (*Service) Register ¶
func (s *Service) Register(ctx context.Context, opts RegisterOptions) error
Register registers a PrivateService configuration to SyncState. Each PrivateService K8s resource has its own SyncState, keyed by a generated ID based on the network CIDR and virtual network ID.
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
// ServiceIP is the ClusterIP of the referenced K8s Service
ServiceIP string
}
SyncResult contains the result of a successful PrivateService sync operation.
type SyncStatus ¶
type SyncStatus struct {
// IsSynced indicates whether the PrivateService 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 PrivateService.