Documentation
¶
Overview ¶
Package configmap provides utilities for managing cloudflared ConfigMaps and triggering Deployment restarts when configuration changes.
Index ¶
- Constants
- func CalculateChecksum(configStr string) string
- type Manager
- func (m *Manager) GetCurrentConfig(ctx context.Context, tunnel TunnelInfo) (*cf.Configuration, error)
- func (m *Manager) TriggerDeploymentRestart(ctx context.Context, tunnel TunnelInfo, configStr string) error
- func (m *Manager) UpdateAndRestart(ctx context.Context, tunnel TunnelInfo, rules []cf.UnvalidatedIngressRule) error
- func (m *Manager) UpdateIngressRules(ctx context.Context, tunnel TunnelInfo, rules []cf.UnvalidatedIngressRule) (bool, error)
- type TunnelInfo
Constants ¶
const ( // ConfigKeyName is the key in the ConfigMap data for the cloudflared config ConfigKeyName = "config.yaml" // ChecksumAnnotation is the annotation key used to track config changes ChecksumAnnotation = "cloudflare-operator.io/checksum" )
Variables ¶
This section is empty.
Functions ¶
func CalculateChecksum ¶
CalculateChecksum calculates MD5 checksum of the config string.
Types ¶
type Manager ¶
Manager handles ConfigMap operations for cloudflared tunnels.
func NewManager ¶
NewManager creates a new ConfigMap manager.
func (*Manager) GetCurrentConfig ¶
func (m *Manager) GetCurrentConfig(ctx context.Context, tunnel TunnelInfo) (*cf.Configuration, error)
GetCurrentConfig retrieves the current cloudflared configuration from ConfigMap.
func (*Manager) TriggerDeploymentRestart ¶
func (m *Manager) TriggerDeploymentRestart(ctx context.Context, tunnel TunnelInfo, configStr string) error
TriggerDeploymentRestart updates the Deployment annotation to trigger a rolling restart. This is typically called after updating the ConfigMap to ensure pods pick up the new config.
func (*Manager) UpdateAndRestart ¶
func (m *Manager) UpdateAndRestart( ctx context.Context, tunnel TunnelInfo, rules []cf.UnvalidatedIngressRule, ) error
UpdateAndRestart updates the ConfigMap and triggers a Deployment restart if changed. This is a convenience method that combines UpdateIngressRules and TriggerDeploymentRestart. nolint:revive // Cognitive complexity for ConfigMap update and restart logic
func (*Manager) UpdateIngressRules ¶
func (m *Manager) UpdateIngressRules( ctx context.Context, tunnel TunnelInfo, rules []cf.UnvalidatedIngressRule, ) (bool, error)
UpdateIngressRules updates the cloudflared ConfigMap with new ingress rules. Returns true if the ConfigMap was actually updated, false if unchanged. nolint:revive // Cognitive complexity for ConfigMap update logic
type TunnelInfo ¶
TunnelInfo contains the basic tunnel information needed for ConfigMap operations.