common

package
v1.4.12 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetaInfoConfigmapName       = "reloader-meta-info"
	MetaInfoConfigmapLabelKey   = "reloader.stakater.com/meta-info"
	MetaInfoConfigmapLabelValue = "reloader-oss"
)

Variables

View Source
var BuildDate = "unknown"
View Source
var Commit = "unknown"
View Source
var Version = "dev"

Version, Commit, and BuildDate are set during the build process using the -X linker flag to inject these values into the binary. They provide metadata about the build version, commit hash, build date, and whether there are uncommitted changes in the source code at the time of build. This information is useful for debugging and tracking the specific build of the Reloader binary.

Functions

func GetNamespaceLabelSelector added in v1.4.7

func GetNamespaceLabelSelector(slice []string) (string, error)

func GetResourceLabelSelector added in v1.4.7

func GetResourceLabelSelector(slice []string) (string, error)

func ParseUTCTime

func ParseUTCTime(value string) time.Time

func PublishMetaInfoConfigmap

func PublishMetaInfoConfigmap(clientset kubernetes.Interface)

Types

type BuildInfo

type BuildInfo struct {
	// GoVersion is the version of Go used to compile the binary
	GoVersion string `json:"goVersion"`
	// ReleaseVersion is the version tag or branch of the Reloader release
	ReleaseVersion string `json:"releaseVersion"`
	// CommitHash is the Git commit hash of the source code used to build this binary
	CommitHash string `json:"commitHash"`
	// CommitTime is the timestamp of the Git commit used to build this binary
	CommitTime time.Time `json:"commitTime"`
}

BuildInfo contains information about the build and version of the Reloader binary. This includes Go version, release version, commit details, and build timestamp.

func NewBuildInfo

func NewBuildInfo() *BuildInfo

type Config added in v1.4.7

type Config struct {
	Namespace           string
	ResourceName        string
	ResourceAnnotations map[string]string
	Annotation          string
	TypedAutoAnnotation string
	SHAValue            string
	Type                string
	Labels              map[string]string
}

Config contains rolling upgrade configuration parameters

func GetConfigmapConfig added in v1.4.7

func GetConfigmapConfig(configmap *v1.ConfigMap) Config

GetConfigmapConfig provides utility config for configmap

func GetSecretConfig added in v1.4.7

func GetSecretConfig(secret *v1.Secret) Config

GetSecretConfig provides utility config for secret

type Map

type Map map[string]string

type MetaInfo

type MetaInfo struct {
	// BuildInfo contains information about the build version, commit, and compilation details
	BuildInfo BuildInfo `json:"buildInfo"`
	// ReloaderOptions contains all the configuration options and flags used by this Reloader instance
	ReloaderOptions ReloaderOptions `json:"reloaderOptions"`
	// DeploymentInfo contains metadata about the Kubernetes deployment of this Reloader instance
	DeploymentInfo metav1.ObjectMeta `json:"deploymentInfo"`
}

MetaInfo contains comprehensive metadata about the Reloader instance. This includes build information, configuration options, and deployment details.

func NewMetaInfo

func NewMetaInfo(configmap *v1.ConfigMap) (*MetaInfo, error)

func (*MetaInfo) ToConfigMap

func (m *MetaInfo) ToConfigMap() *v1.ConfigMap

type ReloadCheckResult

type ReloadCheckResult struct {
	ShouldReload bool
	AutoReload   bool
}

func ShouldReload

func ShouldReload(config Config, resourceType string, annotations Map, podAnnotations Map, options *ReloaderOptions) ReloadCheckResult

ShouldReload checks if a resource should be reloaded based on its annotations and the provided options.

type ReloadSource added in v1.4.7

type ReloadSource struct {
	Type          string   `json:"type"`
	Name          string   `json:"name"`
	Namespace     string   `json:"namespace"`
	Hash          string   `json:"hash"`
	ContainerRefs []string `json:"containerRefs"`
	ObservedAt    int64    `json:"observedAt"`
}

func NewReloadSource added in v1.4.7

func NewReloadSource(
	resourceName string,
	resourceNamespace string,
	resourceType string,
	resourceHash string,
	containerRefs []string,
) ReloadSource

func NewReloadSourceFromConfig added in v1.4.7

func NewReloadSourceFromConfig(config Config, containerRefs []string) ReloadSource

type ReloaderOptions

type ReloaderOptions struct {
	// AutoReloadAll enables automatic reloading of all resources when their corresponding ConfigMaps/Secrets are updated
	AutoReloadAll bool `json:"autoReloadAll"`
	// ConfigmapUpdateOnChangeAnnotation is the annotation key used to detect changes in ConfigMaps specified by name
	ConfigmapUpdateOnChangeAnnotation string `json:"configmapUpdateOnChangeAnnotation"`
	// SecretUpdateOnChangeAnnotation is the annotation key used to detect changes in Secrets specified by name
	SecretUpdateOnChangeAnnotation string `json:"secretUpdateOnChangeAnnotation"`
	// ReloaderAutoAnnotation is the annotation key used to detect changes in any referenced ConfigMaps or Secrets
	ReloaderAutoAnnotation string `json:"reloaderAutoAnnotation"`
	// IgnoreResourceAnnotation is the annotation key used to ignore resources from being watched
	IgnoreResourceAnnotation string `json:"ignoreResourceAnnotation"`
	// ConfigmapReloaderAutoAnnotation is the annotation key used to detect changes in ConfigMaps only
	ConfigmapReloaderAutoAnnotation string `json:"configmapReloaderAutoAnnotation"`
	// SecretReloaderAutoAnnotation is the annotation key used to detect changes in Secrets only
	SecretReloaderAutoAnnotation string `json:"secretReloaderAutoAnnotation"`
	// ConfigmapExcludeReloaderAnnotation is the annotation key containing comma-separated list of ConfigMaps to exclude from watching
	ConfigmapExcludeReloaderAnnotation string `json:"configmapExcludeReloaderAnnotation"`
	// SecretExcludeReloaderAnnotation is the annotation key containing comma-separated list of Secrets to exclude from watching
	SecretExcludeReloaderAnnotation string `json:"secretExcludeReloaderAnnotation"`
	// AutoSearchAnnotation is the annotation key used to detect changes in ConfigMaps/Secrets tagged with SearchMatchAnnotation
	AutoSearchAnnotation string `json:"autoSearchAnnotation"`
	// SearchMatchAnnotation is the annotation key used to tag ConfigMaps/Secrets to be found by AutoSearchAnnotation
	SearchMatchAnnotation string `json:"searchMatchAnnotation"`
	// RolloutStrategyAnnotation is the annotation key used to define the rollout update strategy for workloads
	RolloutStrategyAnnotation string `json:"rolloutStrategyAnnotation"`
	// PauseDeploymentAnnotation is the annotation key used to define the time period to pause a deployment after
	PauseDeploymentAnnotation string `json:"pauseDeploymentAnnotation"`
	// PauseDeploymentTimeAnnotation is the annotation key used to indicate when a deployment was paused by Reloader
	PauseDeploymentTimeAnnotation string `json:"pauseDeploymentTimeAnnotation"`

	// LogFormat specifies the log format to use (json, or empty string for default text format)
	LogFormat string `json:"logFormat"`
	// LogLevel specifies the log level to use (trace, debug, info, warning, error, fatal, panic)
	LogLevel string `json:"logLevel"`
	// IsArgoRollouts indicates whether support for Argo Rollouts is enabled
	IsArgoRollouts bool `json:"isArgoRollouts"`
	// ReloadStrategy specifies the strategy used to trigger resource reloads (env-vars or annotations)
	ReloadStrategy string `json:"reloadStrategy"`
	// ReloadOnCreate indicates whether to trigger reloads when ConfigMaps/Secrets are created
	ReloadOnCreate bool `json:"reloadOnCreate"`
	// ReloadOnDelete indicates whether to trigger reloads when ConfigMaps/Secrets are deleted
	ReloadOnDelete bool `json:"reloadOnDelete"`
	// SyncAfterRestart indicates whether to sync add events after Reloader restarts (only works when ReloadOnCreate is true)
	SyncAfterRestart bool `json:"syncAfterRestart"`
	// EnableHA indicates whether High Availability mode is enabled with leader election
	EnableHA bool `json:"enableHA"`
	// WebhookUrl is the URL to send webhook notifications to instead of performing reloads
	WebhookUrl string `json:"webhookUrl"`
	// ResourcesToIgnore is a list of resource types to ignore (e.g., "configmaps" or "secrets")
	ResourcesToIgnore []string `json:"resourcesToIgnore"`
	// WorkloadTypesToIgnore is a list of workload types to ignore (e.g., "jobs" or "cronjobs")
	WorkloadTypesToIgnore []string `json:"workloadTypesToIgnore"`
	// NamespaceSelectors is a list of label selectors to filter namespaces to watch
	NamespaceSelectors []string `json:"namespaceSelectors"`
	// ResourceSelectors is a list of label selectors to filter ConfigMaps and Secrets to watch
	ResourceSelectors []string `json:"resourceSelectors"`
	// NamespacesToIgnore is a list of namespace names to ignore when watching for changes
	NamespacesToIgnore []string `json:"namespacesToIgnore"`
	// EnablePProf enables pprof for profiling
	EnablePProf bool `json:"enablePProf"`
	// PProfAddr is the address to start pprof server on
	PProfAddr string `json:"pprofAddr"`
}

ReloaderOptions contains all configurable options for the Reloader controller. These options control how Reloader behaves when watching for changes in ConfigMaps and Secrets.

var CommandLineOptions *ReloaderOptions

func GetCommandLineOptions

func GetCommandLineOptions() *ReloaderOptions

Jump to

Keyboard shortcuts

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