operator

package
v0.73.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 52 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// ShardEnvVar is the name of the environment variable injected into the
	// config-reloader container that contains the shard number.
	ShardEnvVar = "SHARD"

	// PodNameEnvVar is the name of the environment variable injected in the
	// config-reloader container that contains the pod name.
	PodNameEnvVar = "POD_NAME"
)
View Source
const (
	// DefaultAlertmanagerVersion is a default image tag for the prometheus alertmanager.
	DefaultAlertmanagerVersion = "v0.27.0"
	// DefaultAlertmanagerBaseImage is a base container registry address for the prometheus alertmanager.
	DefaultAlertmanagerBaseImage = "quay.io/prometheus/alertmanager"
	// DefaultAlertmanagerImage is a default image pulling address for the prometheus alertmanager.
	DefaultAlertmanagerImage = DefaultAlertmanagerBaseImage + ":" + DefaultAlertmanagerVersion

	// DefaultThanosVersion is a default image tag for the Thanos long-term prometheus storage collector.
	DefaultThanosVersion = "v0.34.1"
	// DefaultThanosBaseImage is a base container registry address for the Thanos long-term prometheus
	// storage collector.
	DefaultThanosBaseImage = "quay.io/thanos/thanos"
	// DefaultThanosImage is a default image pulling address for the Thanos long-term prometheus storage collector.
	DefaultThanosImage = DefaultThanosBaseImage + ":" + DefaultThanosVersion
)
View Source
const (
	PrometheusOperatorFieldManager = "PrometheusOperator"

	InvalidConfigurationEvent = "InvalidConfiguration"
)
View Source
const (
	AddEvent    = HandlerEvent("add")
	DeleteEvent = HandlerEvent("delete")
	UpdateEvent = HandlerEvent("update")
)
View Source
const MaxSecretDataSizeBytes = v1.MaxSecretSize - 50_000

MaxSecretDataSizeBytes is the maximum data size that a single secret shard may use. This is lower than v1.MaxSecretSize in order to reserve space for metadata and the rest of the secret k8s object.

Variables

View Source
var (
	// DefaultPrometheusVersion is a default image tag for the prometheus.
	DefaultPrometheusVersion = PrometheusCompatibilityMatrix[len(PrometheusCompatibilityMatrix)-1]
	// DefaultPrometheusBaseImage is a base container registry address for the prometheus.
	DefaultPrometheusBaseImage = "quay.io/prometheus/prometheus"
	// DefaultPrometheusImage is a default image pulling address for the prometheus.
	DefaultPrometheusImage = DefaultPrometheusBaseImage + ":" + DefaultPrometheusVersion

	// DefaultPrometheusConfigReloaderImage is an image that will be used as a sidecar to provide dynamic prometheus
	// configuration reloading.
	DefaultPrometheusConfigReloaderImage = "quay.io/prometheus-operator/prometheus-config-reloader:v" + version.Version

	// PrometheusCompatibilityMatrix is a list of supported prometheus versions.
	// prometheus-operator end-to-end tests verify that the operator can deploy from LTS n-1 to the latest stable.
	// This list should be updated every time a new LTS is released.
	PrometheusCompatibilityMatrix = []string{
		"v2.37.0",
		"v2.37.1",
		"v2.37.2",
		"v2.37.3",
		"v2.37.4",
		"v2.37.5",
		"v2.37.6",
		"v2.37.7",
		"v2.37.8",
		"v2.38.0",
		"v2.39.0",
		"v2.39.1",
		"v2.39.2",
		"v2.40.0",
		"v2.40.1",
		"v2.40.2",
		"v2.40.3",
		"v2.40.4",
		"v2.40.5",
		"v2.40.6",
		"v2.40.7",
		"v2.41.0",
		"v2.42.0",
		"v2.43.0",
		"v2.43.1",
		"v2.44.0",
		"v2.45.0",
		"v2.46.0",
		"v2.47.0",
		"v2.47.1",
		"v2.47.2",
		"v2.48.0",
		"v2.48.1",
		"v2.49.0",
		"v2.49.1",
		"v2.50.0",
		"v2.50.1",
		"v2.51.0",
		"v2.51.1",
	}
)
View Source
var (
	DefaultReloaderTestConfig = &Config{
		ReloaderConfig: ContainerConfig{
			CPURequests:    Quantity{q: resource.MustParse("100m")},
			CPULimits:      Quantity{q: resource.MustParse("100m")},
			MemoryRequests: Quantity{q: resource.MustParse("50Mi")},
			MemoryLimits:   Quantity{q: resource.MustParse("50Mi")},
			Image:          "quay.io/prometheus-operator/prometheus-config-reloader:latest",
		},
	}
)

Functions

func BuildArgs added in v0.63.0

func BuildArgs(args []monitoringv1.Argument, additionalArgs []monitoringv1.Argument) ([]string, error)

BuildArgs takes a list of arguments and a list of additional arguments and returns a []string to use in a container Args.

func BuildImagePath added in v0.42.0

func BuildImagePath(specImage, baseImage, version, tag, sha string) (string, error)

BuildImagePath builds a container image path based on the given parameters. Return specImage if not empty. If image contains a tag or digest then image will be returned. Otherwise, return image suffixed by either SHA, tag or version(in that order). Inspired by kubernetes code handling of image building.

func CheckStorageClass added in v0.69.1

func CheckStorageClass(ctx context.Context, canReadStorageClass bool, kclient kubernetes.Interface, storage *monitoringv1.StorageSpec) error

func CreateConfigReloader added in v0.43.0

func CreateConfigReloader(name string, options ...ReloaderOption) v1.Container

CreateConfigReloader returns the definition of the config-reloader container.

func CurlProber added in v0.57.0

func CurlProber(u string) string

func FindStatusCondition added in v0.65.0

func FindStatusCondition(conditions []monitoringv1.Condition, conditionType monitoringv1.ConditionType) *monitoringv1.Condition

FindStatusCondition returns the condition matching the given type. If the condition isn't present, it returns nil.

func GunzipConfig added in v0.59.0

func GunzipConfig(b []byte) (string, error)

func GzipConfig added in v0.59.0

func GzipConfig(w io.Writer, conf []byte) error

func ListMatchingNamespaces added in v0.64.0

func ListMatchingNamespaces(selector labels.Selector, nsInf cache.SharedIndexInformer) ([]string, error)

ListMatchingNamespaces lists all the namespaces that match the provided selector.

func MakeHostAliases added in v0.57.0

func MakeHostAliases(input []monitoringv1.HostAlias) []v1.HostAlias

MakeHostAliases converts array of monitoringv1 HostAlias to array of corev1 HostAlias.

func MakeVolumeClaimTemplate added in v0.42.0

func SanitizeSTS added in v0.42.0

func SanitizeSTS(sts *appsv1.StatefulSet)

SanitizeSTS removes values for APIVersion and Kind from the VolumeClaimTemplates. This prevents update failures due to these fields changing when applied. See https://github.com/kubernetes/kubernetes/issues/87583

func StatusPoller added in v0.65.0

func StatusPoller(ctx context.Context, sr StatusReconciler)

StatusPoller refreshes regularly the objects for which the Available condition isn't True. It ensures that the status subresource eventually reflects the pods conditions. For instance when a new version of the statefulset is rolled out and the updated pod has non-ready containers, the statefulset status won't see any update because the number of ready/updated replicas doesn't change. Without the periodic refresh, the object's status would report "containers with incomplete status: [init-config-reloader]" forever.

func StringPtrValOrDefault added in v0.42.0

func StringPtrValOrDefault(val *string, defaultVal string) string

StringPtrValOrDefault returns the default val if the given string pointer is nil points to an empty/whitespace string. Otherwise returns the value of the string.

func StringValOrDefault added in v0.42.0

func StringValOrDefault(val, defaultVal string) string

StringValOrDefault returns the default val if the given string is empty/whitespace. Otherwise returns the value of the string..

func TestSidecarsResources added in v0.63.0

func TestSidecarsResources(t *testing.T, makeStatefulSet func(reloaderConfig ContainerConfig) *appsv1.StatefulSet)

func UpdateConditions added in v0.65.0

func UpdateConditions(conditions []monitoringv1.Condition, newConditions ...monitoringv1.Condition) []monitoringv1.Condition

UpdateConditions merges the existing conditions with newConditions.

func UpdateObject added in v0.71.0

func UpdateObject(o metav1.Object, opts ...ObjectOption)

UpdateObject updates the object with the provided options.

func ValidateRule added in v0.61.0

func ValidateRule(promRuleSpec monitoringv1.PrometheusRuleSpec) []error

ValidateRule takes PrometheusRuleSpec and validates it using the upstream prometheus rule validator.

func WaitForNamedCacheSync added in v0.43.1

func WaitForNamedCacheSync(ctx context.Context, controllerName string, logger log.Logger, inf cache.SharedIndexInformer) bool

WaitForNamedCacheSync synchronizes the informer's cache and will log a warning every minute if the operation hasn't completed yet, until it reaches a timeout of 10 minutes. Under normal circumstances, the cache sync should be fast. If it takes more than 1 minute, it means that something is stuck and the message will indicate to the admin which informer is the culprit. See https://github.com/prometheus-operator/prometheus-operator/issues/3347.

func WgetProber added in v0.57.0

func WgetProber(u string) string

Types

type Accessor added in v0.64.0

type Accessor struct {
	// contains filtered or unexported fields
}

Accessor can manipulate objects returned by informers and handlers.

func NewAccessor added in v0.64.0

func NewAccessor(l log.Logger) *Accessor

func (*Accessor) MetaNamespaceKey added in v0.64.0

func (a *Accessor) MetaNamespaceKey(obj interface{}) (string, bool)

MetaNamespaceKey returns a key from the object's metadata. For namespaced objects, the format is `<namespace>/<name>`, otherwise `name`.

func (*Accessor) ObjectMetadata added in v0.64.0

func (a *Accessor) ObjectMetadata(obj interface{}) (metav1.Object, bool)

ObjectMetadata returns the object's metadata and bool indicating if the conversion succeeded.

type Byter added in v0.71.0

type Byter interface {
	Bytes() []byte
}

type Config

type Config struct {
	// Version reported by the Kubernetes API.
	KubernetesVersion version.Info

	// Cluster domain for Kubernetes services managed by the operator.
	ClusterDomain string

	// Global configuration for the reloader config sidecar.
	ReloaderConfig ContainerConfig

	// Base container images for operands.
	AlertmanagerDefaultBaseImage string
	PrometheusDefaultBaseImage   string
	ThanosDefaultBaseImage       string

	// Allow and deny lists for namespace watchers.
	Namespaces Namespaces

	// Metadata applied to all resources managed by the operator.
	Annotations Map
	Labels      Map

	// Custom name to use for "localhost".
	LocalHost string

	// Label and field selectors for resource watchers.
	PromSelector            LabelSelector
	AlertmanagerSelector    LabelSelector
	ThanosRulerSelector     LabelSelector
	SecretListWatchSelector FieldSelector

	// Controller id for pod ownership
	ControllerID string
}

Config defines configuration parameters for the Operator.

func DefaultConfig added in v0.68.0

func DefaultConfig(cpu, memory string) Config

DefaultConfig returns a default operator configuration.

type ConfigReloader added in v0.49.0

type ConfigReloader struct {
	// contains filtered or unexported fields
}

ConfigReloader contains the options to configure a config-reloader container.

type ContainerConfig added in v0.63.0

type ContainerConfig struct {
	// The struct tag are needed for github.com/mitchellh/hashstructure to take
	// the field values into account when generating the statefulset hash.
	CPURequests    Quantity `hash:"string"`
	CPULimits      Quantity `hash:"string"`
	MemoryRequests Quantity `hash:"string"`
	MemoryLimits   Quantity `hash:"string"`
	Image          string
	EnableProbes   bool
}

ContainerConfig holds some configuration for the ConfigReloader sidecar that can be set through prometheus-operator command line arguments.

func (ContainerConfig) ResourceRequirements added in v0.68.0

func (cc ContainerConfig) ResourceRequirements() v1.ResourceRequirements

type EventHandler added in v0.73.0

type EventHandler struct {
	// contains filtered or unexported fields
}

EventHandler implements the k8s.io/tools/cache.ResourceEventHandler interface.

func NewEventHandler added in v0.73.0

func NewEventHandler(
	logger log.Logger,
	accessor *Accessor,
	metrics *Metrics,
	objName string,
	enqueueFunc func(ns string),
) *EventHandler

func (*EventHandler) OnAdd added in v0.73.0

func (e *EventHandler) OnAdd(obj interface{}, _ bool)

func (*EventHandler) OnDelete added in v0.73.0

func (e *EventHandler) OnDelete(obj interface{})

func (*EventHandler) OnUpdate added in v0.73.0

func (e *EventHandler) OnUpdate(old, cur interface{})

type EventRecorderFactory added in v0.72.0

type EventRecorderFactory func(client kubernetes.Interface, component string) record.EventRecorder

func NewEventRecorderFactory added in v0.72.0

func NewEventRecorderFactory(emitEvents bool) EventRecorderFactory

type FieldSelector added in v0.70.0

type FieldSelector string

func (*FieldSelector) Set added in v0.70.0

func (fs *FieldSelector) Set(value string) error

Set implements the flag.Value interface.

func (*FieldSelector) String added in v0.70.0

func (fs *FieldSelector) String() string

String implements the flag.Value interface.

type GoverningObject added in v0.65.0

type GoverningObject interface {
	metav1.Object
	ExpectedReplicas() int
	SetReplicas(int)
	SetUpdatedReplicas(int)
	SetAvailableReplicas(int)
	SetUnavailableReplicas(int)
}

type HandlerEvent added in v0.61.0

type HandlerEvent string

type LabelSelector added in v0.70.0

type LabelSelector string

func (*LabelSelector) Set added in v0.70.0

func (ls *LabelSelector) Set(value string) error

Set implements the flag.Value interface.

func (*LabelSelector) String added in v0.70.0

func (ls *LabelSelector) String() string

String implements the flag.Value interface.

type Map added in v0.67.0

type Map map[string]string

func (*Map) Merge added in v0.67.0

func (m *Map) Merge(other map[string]string) map[string]string

Merge returns a map which is a merge of the original map and the other parameter. The keys of the original map take precedence over other.

func (*Map) Set added in v0.67.0

func (m *Map) Set(value string) error

Set implements the flag.Value interface.

func (*Map) SortedKeys added in v0.67.0

func (m *Map) SortedKeys() []string

SortedKeys returns a slice of the keys in increasing order.

func (*Map) String added in v0.67.0

func (m *Map) String() string

String implements the flag.Value interface.

type Metrics added in v0.42.0

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics represents metrics associated to an operator.

func NewMetrics added in v0.42.0

func NewMetrics(r prometheus.Registerer) *Metrics

NewMetrics initializes operator metrics and registers them with the given registerer.

func (*Metrics) Collect added in v0.43.0

func (m *Metrics) Collect(ch chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (*Metrics) Describe added in v0.43.0

func (m *Metrics) Describe(ch chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface.

func (*Metrics) MustRegister added in v0.42.0

func (m *Metrics) MustRegister(metrics ...prometheus.Collector)

MustRegister registers metrics with the Metrics registerer.

func (*Metrics) NewInstrumentedListerWatcher added in v0.42.0

func (m *Metrics) NewInstrumentedListerWatcher(lw cache.ListerWatcher) cache.ListerWatcher

NewInstrumentedListerWatcher returns a cache.ListerWatcher with instrumentation.

func (*Metrics) Ready added in v0.43.0

func (m *Metrics) Ready() prometheus.Gauge

Ready returns a gauge to track whether the controller is ready or not.

func (*Metrics) SetRejectedResources added in v0.43.0

func (m *Metrics) SetRejectedResources(objKey, resource string, v int)

SetRejectedResources sets the number of resources that the controller rejected for the given object's key.

func (*Metrics) SetSelectedResources added in v0.43.0

func (m *Metrics) SetSelectedResources(objKey, resource string, v int)

SetSelectedResources sets the number of resources that the controller selected for the given object's key.

func (*Metrics) StsDeleteCreateCounter added in v0.42.0

func (m *Metrics) StsDeleteCreateCounter() prometheus.Counter

StsDeleteCreateCounter returns a counter to track statefulset's recreations.

func (*Metrics) TriggerByCounter added in v0.42.0

func (m *Metrics) TriggerByCounter(triggeredBy string, action HandlerEvent) prometheus.Counter

TriggerByCounter returns a counter to track operator actions by resource type and action (add/delete/update).

type Namespaces added in v0.43.0

type Namespaces struct {
	// Allow list for common custom resources.
	AllowList StringSet
	// Deny list for common custom resources.
	DenyList StringSet
	// Allow list for Prometheus custom resources.
	PrometheusAllowList StringSet
	// Allow list for Alertmanager custom resources.
	AlertmanagerAllowList StringSet
	// Allow list for AlertmanagerConfig custom resources.
	AlertmanagerConfigAllowList StringSet
	// Allow list for ThanosRuler custom resources.
	ThanosRulerAllowList StringSet
}

func (*Namespaces) Finalize added in v0.70.0

func (n *Namespaces) Finalize()

func (*Namespaces) String added in v0.70.0

func (n *Namespaces) String() string

type NodeAddressPriority added in v0.73.0

type NodeAddressPriority string

func (*NodeAddressPriority) Set added in v0.73.0

func (p *NodeAddressPriority) Set(value string) error

Set implements the flag.Value interface.

func (*NodeAddressPriority) String added in v0.73.0

func (p *NodeAddressPriority) String() string

String implements the flag.Value interface.

type ObjectOption added in v0.71.0

type ObjectOption func(metav1.Object)

func WithAnnotations added in v0.71.0

func WithAnnotations(annotations map[string]string) ObjectOption

WithAnnotations merges the given annotations with the existing object's annotations. The given annotations take precedence over the existing ones.

func WithLabels added in v0.71.0

func WithLabels(labels map[string]string) ObjectOption

WithLabels merges the given labels with the existing object's labels. The given labels take precedence over the existing ones.

func WithManagingOwner added in v0.71.0

func WithManagingOwner(owner Owner) ObjectOption

WithManagingOwner adds the given owner as a managing controller.

func WithName added in v0.71.0

func WithName(name string) ObjectOption

WithName updates the name of the object.

func WithNamespace added in v0.71.0

func WithNamespace(namespace string) ObjectOption

WithNamespace updates the namespace of the object.

func WithOwner added in v0.71.0

func WithOwner(owner Owner) ObjectOption

WithOwner adds the given owner to the list of owner references.

type Owner added in v0.71.0

type Owner interface {
	metav1.ObjectMetaAccessor
	schema.ObjectKind
}

type Pod added in v0.63.0

type Pod v1.Pod

Pod is an alias for the Kubernetes v1.Pod type.

func (*Pod) Message added in v0.63.0

func (p *Pod) Message() string

Message returns a human-readable and terse message about the state of the pod.

func (*Pod) Ready added in v0.63.0

func (p *Pod) Ready() bool

Ready returns true if the pod is ready.

type PrometheusRuleSelector added in v0.64.0

type PrometheusRuleSelector struct {
	// contains filtered or unexported fields
}

func NewPrometheusRuleSelector added in v0.64.0

func NewPrometheusRuleSelector(ruleFormat RuleConfigurationFormat, version string, labelSelector *metav1.LabelSelector, nsLabeler *namespacelabeler.Labeler, ruleInformer *informers.ForResource, eventRecorder record.EventRecorder, logger log.Logger) (*PrometheusRuleSelector, error)

func (*PrometheusRuleSelector) Select added in v0.64.0

func (prs *PrometheusRuleSelector) Select(namespaces []string) (map[string]string, int, error)

Select selects PrometheusRules and translates them into native Prometheus/Thanos configurations. The second returned value is the number of rejected PrometheusRule objects.

type Quantity added in v0.68.0

type Quantity struct {
	// contains filtered or unexported fields
}

func (*Quantity) Set added in v0.68.0

func (q *Quantity) Set(value string) error

Set implements the flag.Value interface.

func (Quantity) String added in v0.68.0

func (q Quantity) String() string

String implements the flag.Value and fmt.Stringer interfaces.

type ReconcilerMetrics added in v0.61.0

type ReconcilerMetrics interface {
	TriggerByCounter(string, HandlerEvent) prometheus.Counter
}

ReconcilerMetrics tracks reconciler metrics.

type ReconciliationStatus added in v0.56.0

type ReconciliationStatus struct {
	// contains filtered or unexported fields
}

func (ReconciliationStatus) Message added in v0.56.0

func (rs ReconciliationStatus) Message() string

func (ReconciliationStatus) Ok added in v0.56.0

func (rs ReconciliationStatus) Ok() bool

func (ReconciliationStatus) Reason added in v0.56.0

func (rs ReconciliationStatus) Reason() string

type ReconciliationTracker added in v0.56.0

type ReconciliationTracker struct {
	// contains filtered or unexported fields
}

ReconciliationTracker tracks reconciliation status per object. The zero ReconciliationTracker is ready to use.

func (*ReconciliationTracker) Collect added in v0.56.0

func (rt *ReconciliationTracker) Collect(ch chan<- prometheus.Metric)

Collect implements the prometheus.Collector interface.

func (*ReconciliationTracker) Describe added in v0.56.0

func (rt *ReconciliationTracker) Describe(ch chan<- *prometheus.Desc)

Describe implements the prometheus.Collector interface.

func (*ReconciliationTracker) ForgetObject added in v0.56.0

func (rt *ReconciliationTracker) ForgetObject(k string)

ForgetObject removes the given object from the tracker. It should be called when the controller detects that the object has been deleted.

func (*ReconciliationTracker) GetCondition added in v0.65.0

func (rt *ReconciliationTracker) GetCondition(k string, gen int64) monitoringv1.Condition

GetCondition returns a monitoringv1.Condition for the last-known reconciliation status of the given object.

func (*ReconciliationTracker) SetStatus added in v0.56.0

func (rt *ReconciliationTracker) SetStatus(k string, err error)

SetStatus updates the last reconciliation status for the given object.

type ReloaderOption added in v0.49.0

type ReloaderOption = func(*ConfigReloader)

func ConfigEnvsubstFile added in v0.49.0

func ConfigEnvsubstFile(configEnvsubstFile string) ReloaderOption

ConfigEnvsubstFile sets the configEnvsubstFile option for the config-reloader container.

func ConfigFile added in v0.49.0

func ConfigFile(configFile string) ReloaderOption

ConfigFile sets the configFile option for the config-reloader container.

func ImagePullPolicy added in v0.62.0

func ImagePullPolicy(imagePullPolicy v1.PullPolicy) ReloaderOption

ImagePullPolicy sets the imagePullPolicy option for the config-reloader container.

func ListenLocal added in v0.49.0

func ListenLocal(listenLocal bool) ReloaderOption

ListenLocal sets the listenLocal option for the config-reloader container.

func LocalHost added in v0.49.0

func LocalHost(localHost string) ReloaderOption

LocalHost sets the localHost option for the config-reloader container.

func LogFormat added in v0.49.0

func LogFormat(logFormat string) ReloaderOption

LogFormat sets the logFormat option for the config-reloader container.

func LogLevel added in v0.49.0

func LogLevel(logLevel string) ReloaderOption

LogLevel sets the logLevel option for the config-reloader container.

func ReloaderConfig added in v0.43.0

func ReloaderConfig(rc ContainerConfig) ReloaderOption

ReloaderConfig sets the config option for the config-reloader container.

func ReloaderRunOnce added in v0.49.0

func ReloaderRunOnce() ReloaderOption

ReloaderRunOnce sets the runOnce option for the config-reloader container.

func ReloaderURL added in v0.49.0

func ReloaderURL(u url.URL) ReloaderOption

ReloaderURL sets the reloaderURL option for the config-reloader container.

func ReloaderUseSignal added in v0.70.0

func ReloaderUseSignal() ReloaderOption

func RuntimeInfoURL added in v0.70.0

func RuntimeInfoURL(u url.URL) ReloaderOption

RuntimeInfoURL sets the runtimeInfoURL option for the config-reloader container.

func Shard added in v0.49.0

func Shard(shard int32) ReloaderOption

Shard sets the shard option for the config-reloader container.

func VolumeMounts added in v0.49.0

func VolumeMounts(mounts []v1.VolumeMount) ReloaderOption

VolumeMounts sets the volumeMounts option for the config-reloader container.

func WatchedDirectories added in v0.49.0

func WatchedDirectories(watchedDirectories []string) ReloaderOption

WatchedDirectories sets the watchedDirectories option for the config-reloader container.

func WebConfigFile added in v0.69.1

func WebConfigFile(config string) ReloaderOption

WebConfigFile sets the webConfigFile option for the config-reloader container.

type ResourceReconciler added in v0.61.0

type ResourceReconciler struct {
	// contains filtered or unexported fields
}

ResourceReconciler reacts on changes for statefulset-based resources and triggers synchronization of the resources.

ResourceReconciler implements the cache.ResourceEventHandler interface and it can subscribe to resource events like this:

var statefulSetInformer, resourceInformer cache.SharedInformer ... rr := NewResourceReconciler(...) statefulSetInformer.AddEventHandler(rr) resourceInformer.AddEventHandler(rr)

ResourceReconciler will trigger object and status reconciliations based on the events received from the informer.

func NewResourceReconciler added in v0.61.0

func NewResourceReconciler(
	l log.Logger,
	syncer Syncer,
	metrics ReconcilerMetrics,
	kind string,
	reg prometheus.Registerer,
	controllerID string,
) *ResourceReconciler

NewResourceReconciler returns a reconciler for the "kind" resource.

func (*ResourceReconciler) DeletionInProgress added in v0.61.0

func (rr *ResourceReconciler) DeletionInProgress(o metav1.Object) bool

DeletionInProgress returns true if the object deletion has been requested.

func (*ResourceReconciler) EnqueueForReconciliation added in v0.61.0

func (rr *ResourceReconciler) EnqueueForReconciliation(obj metav1.Object)

EnqueueForReconciliation asks for reconciling the object.

func (*ResourceReconciler) EnqueueForStatus added in v0.61.0

func (rr *ResourceReconciler) EnqueueForStatus(obj metav1.Object)

EnqueueForStatus asks for updating the status of the object.

func (*ResourceReconciler) OnAdd added in v0.61.0

func (rr *ResourceReconciler) OnAdd(obj interface{}, _ bool)

OnAdd implements the cache.ResourceEventHandler interface.

func (*ResourceReconciler) OnDelete added in v0.61.0

func (rr *ResourceReconciler) OnDelete(obj interface{})

OnDelete implements the cache.ResourceEventHandler interface.

func (*ResourceReconciler) OnUpdate added in v0.61.0

func (rr *ResourceReconciler) OnUpdate(old, cur interface{})

OnUpdate implements the cache.ResourceEventHandler interface.

func (*ResourceReconciler) Run added in v0.61.0

func (rr *ResourceReconciler) Run(ctx context.Context)

Run the goroutines responsible for processing the reconciliation and status queues.

func (*ResourceReconciler) Stop added in v0.61.0

func (rr *ResourceReconciler) Stop()

Stop the processing queues and wait for goroutines to exit.

type RuleConfigurationFormat added in v0.64.0

type RuleConfigurationFormat int
const (
	PrometheusFormat RuleConfigurationFormat = iota
	ThanosFormat
)

type ShardedSecret added in v0.53.0

type ShardedSecret struct {
	// contains filtered or unexported fields
}

ShardedSecret can shard Secret data across multiple k8s Secrets. This is used to circumvent the size limitation of k8s Secrets.

func NewShardedSecret added in v0.53.0

func NewShardedSecret(template *v1.Secret) *ShardedSecret

NewShardedSecret takes a v1.Secret object as template and returns a new ShardedSecret. The template's name will be used as the prefix for the concrete secrets.

func ReconcileShardedSecretForTLSAssets added in v0.71.0

func ReconcileShardedSecretForTLSAssets(ctx context.Context, store *assets.Store, client kubernetes.Interface, template *v1.Secret) (*ShardedSecret, error)

func (*ShardedSecret) Append added in v0.71.0

func (s *ShardedSecret) Append(k fmt.Stringer, v Byter)

Append adds a new key + data pair. If the key already exists, data gets overwritten.

func (*ShardedSecret) Hash added in v0.72.0

func (s *ShardedSecret) Hash() (uint64, error)

Hash implements the Hashable interface from github.com/mitchellh/hashstructure.

func (*ShardedSecret) UpdateSecrets added in v0.71.0

func (s *ShardedSecret) UpdateSecrets(ctx context.Context, sClient corev1.SecretInterface) error

UpdateSecrets updates the concrete Secrets from the stored data.

func (*ShardedSecret) Volume added in v0.72.0

func (s *ShardedSecret) Volume(name string) v1.Volume

Volume returns a v1.Volume object with all TLS assets ready to be mounted in a container. It must be called after UpdateSecrets().

type StatefulSetReporter added in v0.63.0

type StatefulSetReporter struct {
	Pods []*Pod
	// contains filtered or unexported fields
}

func NewStatefulSetReporter added in v0.63.0

func NewStatefulSetReporter(ctx context.Context, kclient kubernetes.Interface, sset *appsv1.StatefulSet) (*StatefulSetReporter, error)

NewStatefulSetReporter returns a statefulset's reporter.

func (*StatefulSetReporter) IsUpdated added in v0.63.0

func (sr *StatefulSetReporter) IsUpdated(p *Pod) bool

IsUpdated returns true if the given pod matches with the statefulset's revision.

func (*StatefulSetReporter) ReadyPods added in v0.63.0

func (sr *StatefulSetReporter) ReadyPods() []*Pod

ReadyPods returns the list of pods that are ready.

func (*StatefulSetReporter) Update added in v0.65.0

func (*StatefulSetReporter) UpdatedPods added in v0.63.0

func (sr *StatefulSetReporter) UpdatedPods() []*Pod

UpdatedPods returns the list of pods that match with the statefulset's revision.

type StatusReconciler added in v0.65.0

type StatusReconciler interface {
	Iterate(func(metav1.Object, []monitoringv1.Condition))
	RefreshStatusFor(metav1.Object)
}

type StringSet added in v0.70.0

type StringSet map[string]struct{}

StringSet represents a list of comma-separated strings.

func (StringSet) Insert added in v0.70.0

func (s StringSet) Insert(value string)

func (StringSet) Set added in v0.70.0

func (s StringSet) Set(value string) error

Set implements the flag.Value interface.

func (StringSet) Slice added in v0.70.0

func (s StringSet) Slice() []string

func (StringSet) String added in v0.70.0

func (s StringSet) String() string

String implements the flag.Value interface.

type Syncer added in v0.61.0

type Syncer interface {
	// Sync the state of the object identified by its key.
	Sync(context.Context, string) error
	// UpdateStatus updates the status of the object identified by its key.
	UpdateStatus(context.Context, string) error
	// Resolve returns the resource associated to the statefulset.
	Resolve(*appsv1.StatefulSet) metav1.Object
}

Syncer knows how to synchronize statefulset-based resources.

Jump to

Keyboard shortcuts

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