configmap

package
v0.20.0 Latest Latest
Warning

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

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

Documentation

Overview

Package configmap provides utilities for managing cloudflared ConfigMaps and triggering Deployment restarts when configuration changes.

Index

Constants

View Source
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

func CalculateChecksum(configStr string) string

CalculateChecksum calculates MD5 checksum of the config string.

Types

type Manager

type Manager struct {
	client.Client
}

Manager handles ConfigMap operations for cloudflared tunnels.

func NewManager

func NewManager(c client.Client) *Manager

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

type TunnelInfo interface {
	GetName() string
	GetNamespace() string
}

TunnelInfo contains the basic tunnel information needed for ConfigMap operations.

Jump to

Keyboard shortcuts

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