Documentation
¶
Index ¶
- Constants
- Variables
- func ArgumentsIntersection(a, b []monitoringv1.Argument) []string
- func BuildArgs(args []monitoringv1.Argument, additionalArgs []monitoringv1.Argument) ([]string, error)
- func BuildImagePath(specImage, baseImage, version, tag, sha string) (string, error)
- func BuildImagePathForAgent(specImage, baseImage, version string) (string, error)
- func CheckStorageClass(ctx context.Context, canReadStorageClass bool, kclient kubernetes.Interface, ...) error
- func CleanupBindings[T ConfigurationResource](ctx context.Context, listerFunc func(labels.Selector, cache.AppendFunc) error, ...) error
- func ConfigMapGVK() schema.GroupVersionKind
- func CreateConfigReloader(name string, options ...ReloaderOption) v1.Container
- func ExecAction(u string) *v1.ExecAction
- func FindStatusCondition(conditions []monitoringv1.Condition, conditionType monitoringv1.ConditionType) *monitoringv1.Condition
- func GenerationChanged(ep EventPayload) bool
- func GetObjectFromKey[T runtime.Object](infs *informers.ForResource, key string) (T, error)
- func GunzipConfig(b []byte) (string, error)
- func GzipConfig(w io.Writer, conf []byte) error
- func KeyForObject(o metav1.Object) string
- func LabelsChanged(ep EventPayload) bool
- func MakeHostAliases(input []monitoringv1.HostAlias) []v1.HostAlias
- func MakeVolumeClaimTemplate(e monitoringv1.EmbeddedPersistentVolumeClaim) *v1.PersistentVolumeClaim
- func ManagedByOperatorLabelSelector() string
- func ResourceVersionChanged(ep EventPayload) bool
- func SanitizeSTS(sts *appsv1.StatefulSet)
- func SecretGVK() schema.GroupVersionKind
- func SelectNamespacesFromCache(obj metav1.Object, sel *metav1.LabelSelector, nsInfs cache.SharedIndexInformer) ([]string, error)
- func StatusPoller(ctx context.Context, sr StatusReconciler)
- func StringValOrDefault(val, defaultVal string) string
- func TestSidecarsResources(t *testing.T, ...)
- func UpdateConditions(conditions []monitoringv1.Condition, newConditions ...monitoringv1.Condition) []monitoringv1.Condition
- func UpdateObject(o metav1.Object, opts ...ObjectOption)
- func UpdateStrategyForStatefulSet(updateStrategy *monitoringv1.StatefulSetUpdateStrategy) appsv1.StatefulSetUpdateStrategy
- func ValidateRule(promRuleSpec monitoringv1.PrometheusRuleSpec, ...) []error
- func ValidationSchemeForPrometheus(version semver.Version) model.ValidationScheme
- func ValidationSchemeForThanos(version semver.Version) model.ValidationScheme
- func WaitForNamedCacheSync(ctx context.Context, controllerName string, logger *slog.Logger, ...) bool
- type Accessor
- type Config
- type ConfigReloader
- type ConfigResourceSyncer
- func (crs *ConfigResourceSyncer) GetBindingIndex(bindings []monitoringv1.WorkloadBinding) int
- func (crs *ConfigResourceSyncer) RemoveBinding(ctx context.Context, configResource ConfigurationObject) error
- func (crs *ConfigResourceSyncer) UpdateBinding(ctx context.Context, configResource ConfigurationObject, ...) error
- type ConfigurationObject
- type ConfigurationResource
- type ContainerConfig
- type EventHandler
- type EventHandlerOption
- type EventPayload
- type EventRecorder
- type EventRecorderFactory
- type EventType
- type FeatureGate
- type FeatureGateName
- type FeatureGates
- func (fg *FeatureGates) Collect(ch chan<- prometheus.Metric)
- func (fg *FeatureGates) Describe(ch chan<- *prometheus.Desc)
- func (fg *FeatureGates) Descriptions() []string
- func (fg *FeatureGates) Enabled(name FeatureGateName) bool
- func (fg *FeatureGates) String() string
- func (fg *FeatureGates) UpdateFeatureGates(flags map[string]bool) error
- type FieldSelector
- type FilterFunc
- type FinalizerSyncer
- type GoverningObject
- type HandlerEvent
- type InformerGetter
- type LabelSelector
- type Map
- type Metrics
- func (m *Metrics) Collect(ch chan<- prometheus.Metric)
- func (m *Metrics) Describe(ch chan<- *prometheus.Desc)
- func (m *Metrics) MustRegister(metrics ...prometheus.Collector)
- func (m *Metrics) NewInstrumentedListerWatcher(lw cache.ListerWatcher) cache.ListerWatcher
- func (m *Metrics) Ready() prometheus.Gauge
- func (m *Metrics) SetRejectedResources(objKey, resource string, v int)
- func (m *Metrics) SetSelectedResources(objKey, resource string, v int)
- func (m *Metrics) StsDeleteCreateCounter() prometheus.Counter
- func (m *Metrics) TriggerByCounter(triggeredBy string, action HandlerEvent) prometheus.Counter
- type Namespaces
- type NewEventRecorderFunc
- type NodeAddressPriority
- type ObjectOption
- func WithAnnotations(annotations map[string]string) ObjectOption
- func WithInputHashAnnotation(h string) ObjectOption
- func WithLabels(labels map[string]string) ObjectOption
- func WithManagingOwner(owner Owner) ObjectOption
- func WithName(name string) ObjectOption
- func WithNamespace(namespace string) ObjectOption
- func WithOwner(owner Owner) ObjectOption
- func WithSelectorLabels(selector *metav1.LabelSelector) ObjectOption
- func WithoutKubectlAnnotations() ObjectOption
- type OwnedResourceOwner
- type Owner
- type Pod
- type PrometheusRuleSelection
- type PrometheusRuleSelector
- type PrometheusRuleSyncer
- type Quantity
- type ReconcilerMetrics
- type ReconciliationStatus
- type ReconciliationTracker
- func (rt *ReconciliationTracker) Collect(ch chan<- prometheus.Metric)
- func (rt *ReconciliationTracker) Describe(ch chan<- *prometheus.Desc)
- func (rt *ReconciliationTracker) ForgetObject(key string)
- func (rt *ReconciliationTracker) GetCondition(k string, gen int64) monitoringv1.Condition
- func (rt *ReconciliationTracker) HasRefTo(key string, obj runtime.Object) bool
- func (rt *ReconciliationTracker) ResetStatus(key string)
- func (rt *ReconciliationTracker) SetReasonAndMessage(key string, reason, message string)
- func (rt *ReconciliationTracker) SetStatus(key string, err error)
- func (rt *ReconciliationTracker) UpdateReferenceTracker(key string, refTracker ReferenceTracker)
- type RefResolver
- type ReferenceTracker
- type ReloaderOption
- func ConfigEnvsubstFile(configEnvsubstFile string) ReloaderOption
- func ConfigFile(configFile string) ReloaderOption
- func ImagePullPolicy(imagePullPolicy v1.PullPolicy) ReloaderOption
- func InitContainer() ReloaderOption
- func ListenLocal(listenLocal bool) ReloaderOption
- func LocalHost(localHost string) ReloaderOption
- func LogFormat(logFormat string) ReloaderOption
- func LogLevel(logLevel string) ReloaderOption
- func ReloaderConfig(rc ContainerConfig) ReloaderOption
- func ReloaderURL(u url.URL) ReloaderOption
- func ReloaderUseSignal() ReloaderOption
- func RuntimeInfoURL(u url.URL) ReloaderOption
- func Shard(shard int32) ReloaderOption
- func VolumeMounts(mounts []v1.VolumeMount) ReloaderOption
- func WatchedDirectories(watchedDirectories []string) ReloaderOption
- func WebConfigFile(config string) ReloaderOption
- func WithDaemonSetMode() ReloaderOption
- type ResourceReconciler
- func (rr *ResourceReconciler) DeletionInProgress(o metav1.Object) bool
- func (rr *ResourceReconciler) EnqueueForReconciliation(obj metav1.Object)
- func (rr *ResourceReconciler) EnqueueForStatus(obj metav1.Object)
- func (rr *ResourceReconciler) OnAdd(obj any, _ bool)
- func (rr *ResourceReconciler) OnDelete(obj any)
- func (rr *ResourceReconciler) OnUpdate(old, cur any)
- func (rr *ResourceReconciler) Run(ctx context.Context)
- func (rr *ResourceReconciler) Stop()
- type RuleConfigurationFormat
- type RuntimeObject
- type ShardedSecret
- type StatefulSetReporter
- type StatusReconciler
- type StringSet
- type Syncer
- type TypedConfigurationResource
- type TypedResourcesSelection
Constants ¶
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" // NodeNameEnvVar is the name of the environment variable injected in the // config-reloader container that contains the node name. NodeNameEnvVar = "NODE_NAME" )
const ( // DefaultAlertmanagerVersion is a default image tag for the prometheus alertmanager. DefaultAlertmanagerVersion = "v0.31.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.40.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 )
const ( // InputHashAnnotationKey is the name of the annotation used to store the // operator's computed hash value. InputHashAnnotationKey = "prometheus-operator-input-hash" // ApplicationNameLabelKey is the name of the application. ApplicationNameLabelKey = "app.kubernetes.io/name" // ManagedByLabelKey is the tool managing the application (e.g. this operator). ManagedByLabelKey = "app.kubernetes.io/managed-by" // ManagedByLabelValue is the name of this operator. ManagedByLabelValue = "prometheus-operator" // ApplicationInstanceLabelKey is the unique name identifying the application's instance. ApplicationInstanceLabelKey = "app.kubernetes.io/instance" // ApplicationVersionLabelKey is the version of the application. ApplicationVersionLabelKey = "app.kubernetes.io/version" // DefaultContainerAnnotationKey is the annotation defining the default container of the pod. DefaultContainerAnnotationKey = "kubectl.kubernetes.io/default-container" )
const ( AddEvent = HandlerEvent("add") DeleteEvent = HandlerEvent("delete") UpdateEvent = HandlerEvent("update") )
const ( // NoSelectedResourcesReason is used in status conditions to indicate that // a workload resource selected no configuration resources. NoSelectedResourcesReason = "NoSelectedResources" // DeprecatedFieldsInUseReason is used in status conditions to indicate that // the resource uses deprecated fields. DeprecatedFieldsInUseReason = "DeprecatedFieldsInUse" )
const (
// InvalidConfiguration is a generic reason for selected resources that are not valid.
InvalidConfiguration = "InvalidConfiguration"
)
const ( // InvalidConfigurationEvent is the type used for events reporting invalid // configuration resources. InvalidConfigurationEvent = "InvalidConfiguration" )
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 ¶
var ( // DefaultPrometheusVersion is a default image tag for the prometheus. DefaultPrometheusVersion = PrometheusCompatibilityMatrix[len(PrometheusCompatibilityMatrix)-1] // DefaultPrometheusV2 is latest version of Prometheus v2. DefaultPrometheusV2 = getLatestPrometheusV2() // 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/rhobs/obo-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 the current LTS version to the latest stable release. // This list should be updated every time a new LTS is released. PrometheusCompatibilityMatrix = []string{ "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", "v2.51.2", "v2.52.0", "v2.53.0", "v2.53.1", "v2.53.2", "v2.53.3", "v2.54.0", "v2.54.1", "v2.55.0", "v2.55.1", "v3.0.0", "v3.0.1", "v3.1.0", "v3.2.0", "v3.2.1", "v3.3.0", "v3.3.1", "v3.4.0", "v3.4.1", "v3.4.2", "v3.5.0", "v3.6.0", "v3.7.0", "v3.7.1", "v3.7.2", "v3.7.3", "v3.8.0", "v3.8.1", "v3.9.0", "v3.9.1", } )
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/rhobs/obo-prometheus-config-reloader:latest", }, } )
var MaxConfigMapDataSize = int(float64(v1.MaxSecretSize) * 0.5)
MaxConfigMapDataSize represents the maximum size for ConfigMap's data. The maximum `Data` size of a ConfigMap seems to differ between environments. This is probably due to different meta data sizes which count into the overall maximum size of a ConfigMap. Thereby lets leave a large buffer.
Functions ¶
func ArgumentsIntersection ¶
func ArgumentsIntersection(a, b []monitoringv1.Argument) []string
ArgumentsIntersection returns the list of arguments which intersect between a and b.
func BuildArgs ¶
func BuildArgs(args []monitoringv1.Argument, additionalArgs []monitoringv1.Argument) ([]string, error)
BuildArgs returns the concatenation of the 2 argument lists of arguments. It returns an error if the 2 lists intersect.
func BuildImagePath ¶
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 BuildImagePathForAgent ¶
BuildImagePathForAgent builds a container image path based on the given parameters for Prometheus Agent. Return specImage if not empty. Otherwise a combination of baseImage and version.
func CheckStorageClass ¶
func CheckStorageClass(ctx context.Context, canReadStorageClass bool, kclient kubernetes.Interface, storage *monitoringv1.StorageSpec) error
func CleanupBindings ¶
func CleanupBindings[T ConfigurationResource]( ctx context.Context, listerFunc func(labels.Selector, cache.AppendFunc) error, resourceSelection TypedResourcesSelection[T], csr *ConfigResourceSyncer, ) error
CleanupBindings removes the workload's binding from all configuration resources that are not in the resourceSelection.
func ConfigMapGVK ¶
func ConfigMapGVK() schema.GroupVersionKind
ConfigMapGVK returns the GroupVersionKind representing ConfigMap objects.
func CreateConfigReloader ¶
func CreateConfigReloader(name string, options ...ReloaderOption) v1.Container
CreateConfigReloader returns the definition of the config-reloader container.
func ExecAction ¶
func ExecAction(u string) *v1.ExecAction
ExecAction returns an ExecAction probing the given URL.
func FindStatusCondition ¶
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 GenerationChanged ¶
func GenerationChanged(ep EventPayload) bool
GenerationChanged returns true if the old and current objects don't have the same generation.
It always returns true for creation and deletion events.
func GetObjectFromKey ¶
GetObjectFromKey retrieves an object from the informer cache using the provided key. It returns a nil value and no error if the object is not found.
The function will panic if the caller provides an informer which doesn't reference objects of type T.
func GunzipConfig ¶
func KeyForObject ¶
KeyForObject returns a string key identifying the given object. For cluster-scoped resources, the key is `<name>`. For namespace-scoped resources, the key is `<namespace>/<name>`.
func LabelsChanged ¶
func LabelsChanged(ep EventPayload) bool
LabelsChanged returns true if the old and current objects don't have the same labels.
It always returns true for creation and deletion events.
func MakeHostAliases ¶
func MakeHostAliases(input []monitoringv1.HostAlias) []v1.HostAlias
MakeHostAliases converts array of monitoringv1 HostAlias to array of corev1 HostAlias.
func MakeVolumeClaimTemplate ¶
func MakeVolumeClaimTemplate(e monitoringv1.EmbeddedPersistentVolumeClaim) *v1.PersistentVolumeClaim
func ManagedByOperatorLabelSelector ¶
func ManagedByOperatorLabelSelector() string
ManagedByOperatorLabelSelector returns a label selector which selects objects managed by this operator.
func ResourceVersionChanged ¶
func ResourceVersionChanged(ep EventPayload) bool
ResourceVersionChanged returns true if the old and current objects don't have the same resource version.
It always returns true for creation and deletion events.
func SanitizeSTS ¶
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 SecretGVK ¶
func SecretGVK() schema.GroupVersionKind
SecretGVK returns the GroupVersionKind representing Secret objects.
func SelectNamespacesFromCache ¶
func SelectNamespacesFromCache(obj metav1.Object, sel *metav1.LabelSelector, nsInfs cache.SharedIndexInformer) ([]string, error)
SelectNamespacesFromCache returns the selected namespaces from the informer's cache.
func StatusPoller ¶
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 StringValOrDefault ¶
StringValOrDefault returns the default val if the given string is empty/whitespace. Otherwise returns the value of the string..
func TestSidecarsResources ¶
func TestSidecarsResources(t *testing.T, makeStatefulSet func(reloaderConfig ContainerConfig) *appsv1.StatefulSet)
func UpdateConditions ¶
func UpdateConditions(conditions []monitoringv1.Condition, newConditions ...monitoringv1.Condition) []monitoringv1.Condition
UpdateConditions merges the existing conditions with newConditions.
func UpdateObject ¶
func UpdateObject(o metav1.Object, opts ...ObjectOption)
UpdateObject updates the object's metadata with the provided options. It automatically injects the "managed-by" and "app.kubernetes.io/managed-by" labels which identifies the operator as the managing entity.
func UpdateStrategyForStatefulSet ¶
func UpdateStrategyForStatefulSet(updateStrategy *monitoringv1.StatefulSetUpdateStrategy) appsv1.StatefulSetUpdateStrategy
UpdateStrategyForStatefulSet converts a monitoring update strategy to a statefulset update strategy.
func ValidateRule ¶
func ValidateRule(promRuleSpec monitoringv1.PrometheusRuleSpec, validationScheme model.ValidationScheme) []error
ValidateRule takes PrometheusRuleSpec and validates it using the upstream prometheus rule validator.
func ValidationSchemeForPrometheus ¶
func ValidationSchemeForPrometheus(version semver.Version) model.ValidationScheme
ValidationSchemeForPrometheus returns the appropriate validation scheme based on Prometheus version.
func ValidationSchemeForThanos ¶
func ValidationSchemeForThanos(version semver.Version) model.ValidationScheme
ValidationSchemeForThanos returns the appropriate validation scheme based on Thanos version.
func WaitForNamedCacheSync ¶
func WaitForNamedCacheSync(ctx context.Context, controllerName string, logger *slog.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/rhobs/obo-prometheus-operator/issues/3347.
Types ¶
type Accessor ¶
type Accessor struct {
// contains filtered or unexported fields
}
Accessor can manipulate objects returned by informers and handlers.
func NewAccessor ¶
func (*Accessor) MetaNamespaceKey ¶
MetaNamespaceKey returns a key from the object's metadata. For namespaced objects, the format is `<namespace>/<name>`, otherwise `name`.
type Config ¶
type Config struct {
// Version reported by the Kubernetes API.
KubernetesVersion semver.Version
// 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
SecretListWatchFieldSelector FieldSelector
SecretListWatchLabelSelector LabelSelector
// Controller id for pod ownership.
ControllerID string
// Event recorder factory.
EventRecorderFactory EventRecorderFactory
// Feature gates.
Gates *FeatureGates
WatchObjectRefsInAllNamespaces bool
}
Config defines configuration parameters for the Operator.
func DefaultConfig ¶
DefaultConfig returns a default operator configuration.
func (*Config) RegisterFeatureGatesFlags ¶
func (c *Config) RegisterFeatureGatesFlags(fs *flag.FlagSet, flags *k8sflag.MapStringBool)
type ConfigReloader ¶
type ConfigReloader struct {
// contains filtered or unexported fields
}
ConfigReloader contains the options to configure a config-reloader container.
type ConfigResourceSyncer ¶
type ConfigResourceSyncer struct {
// contains filtered or unexported fields
}
ConfigResourceSyncer patches the status of configuration resources.
func NewConfigResourceSyncer ¶
func NewConfigResourceSyncer(workload RuntimeObject, client dynamic.Interface, accessor *Accessor) *ConfigResourceSyncer
func (*ConfigResourceSyncer) GetBindingIndex ¶
func (crs *ConfigResourceSyncer) GetBindingIndex(bindings []monitoringv1.WorkloadBinding) int
GetBindingIndex returns the index of the workload binding in the slice. The return value is negative if there's no binding for the workload.
func (*ConfigResourceSyncer) RemoveBinding ¶
func (crs *ConfigResourceSyncer) RemoveBinding(ctx context.Context, configResource ConfigurationObject) error
RemoveBinding removes the workload's binding from the configuration resource's status subresource. If the workload has no binding, this a no-operation.
func (*ConfigResourceSyncer) UpdateBinding ¶
func (crs *ConfigResourceSyncer) UpdateBinding(ctx context.Context, configResource ConfigurationObject, conditions []monitoringv1.ConfigResourceCondition) error
UpdateBinding updates the workload's binding in the configuration resource's status subresource. If the binding is up-to-date, this is a no-operation.
type ConfigurationObject ¶
type ConfigurationObject interface {
RuntimeObject
Bindings() []monitoringv1.WorkloadBinding
}
type ConfigurationResource ¶
type ConfigurationResource interface {
*monitoringv1.ServiceMonitor | *monitoringv1.PodMonitor | *monitoringv1.Probe | *monitoringv1alpha1.ScrapeConfig | *monitoringv1.PrometheusRule
}
ConfigurationResource is a type constraint that permits only the specific pointer types for configuration resources selectable by Prometheus, PrometheusAgent, Alertmanager or ThanosRuler.
type ContainerConfig ¶
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 ¶
func (cc ContainerConfig) ResourceRequirements() v1.ResourceRequirements
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
EventHandler implements the k8s.io/tools/cache.ResourceEventHandler interface.
func NewEventHandler ¶
func NewEventHandler( logger *slog.Logger, accessor *Accessor, metrics *Metrics, objName string, enqueueFunc func(ns string), options ...EventHandlerOption, ) *EventHandler
NewEventHandler returns a new event handler.
func (*EventHandler) OnAdd ¶
func (e *EventHandler) OnAdd(obj any, _ bool)
OnAdd implements the k8s.io/tools/cache.ResourceEventHandler interface.
func (*EventHandler) OnDelete ¶
func (e *EventHandler) OnDelete(obj any)
OnDelete implements the k8s.io/tools/cache.ResourceEventHandler interface.
func (*EventHandler) OnUpdate ¶
func (e *EventHandler) OnUpdate(old, cur any)
OnUpdate implements the k8s.io/tools/cache.ResourceEventHandler interface.
type EventHandlerOption ¶
type EventHandlerOption func(*EventHandler)
EventHandlerOption allows to configure the event handler.
func WithFilter ¶
func WithFilter(filter FilterFunc) EventHandlerOption
WithFilter adds a filter function to the event handler.
type EventPayload ¶
type EventPayload struct {
EventType EventType
Old any
OldMeta metav1.Object
Current any
CurrentMeta metav1.Object
}
EventPayload represents the object(s) being notified.
It contains both the raw object and the object's metadata to avoid redundant type-casting.
The Old and OldMeta fields are only set for update events.
type EventRecorder ¶
type EventRecorder struct {
// contains filtered or unexported fields
}
EventRecorder records events which are related to the associated Object.
func NewFakeRecorder ¶
func NewFakeRecorder(bufferSize int, related runtime.Object) *EventRecorder
type EventRecorderFactory ¶
type EventRecorderFactory func(client kubernetes.Interface, component string) NewEventRecorderFunc
EventRecorderFactory returns an function to create EventRecorder objects.
func NewEventRecorderFactory ¶
func NewEventRecorderFactory(emitEvents bool) EventRecorderFactory
type EventType ¶
type EventType int
EventType reports whether the event is a creation, update or deletion.
type FeatureGate ¶
type FeatureGate struct {
// contains filtered or unexported fields
}
type FeatureGateName ¶
type FeatureGateName string
const ( // PrometheusAgentDaemonSetFeature enables the DaemonSet mode for PrometheusAgent. PrometheusAgentDaemonSetFeature FeatureGateName = "PrometheusAgentDaemonSet" // PrometheusTopologyShardingFeature enables the zone-aware sharding for Prometheus. PrometheusTopologyShardingFeature FeatureGateName = "PrometheusTopologySharding" // PrometheusShardRetentionPolicyFeature enables the shard retention policy for Prometheus. PrometheusShardRetentionPolicyFeature FeatureGateName = "PrometheusShardRetentionPolicy" // StatusForConfigurationResourcesFeature enables the status subresource for Prometheus-Operator Config Objects. StatusForConfigurationResourcesFeature FeatureGateName = "StatusForConfigurationResources" )
type FeatureGates ¶
type FeatureGates map[FeatureGateName]FeatureGate
func (*FeatureGates) Collect ¶
func (fg *FeatureGates) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (*FeatureGates) Describe ¶
func (fg *FeatureGates) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
func (*FeatureGates) Descriptions ¶
func (fg *FeatureGates) Descriptions() []string
func (*FeatureGates) Enabled ¶
func (fg *FeatureGates) Enabled(name FeatureGateName) bool
func (*FeatureGates) String ¶
func (fg *FeatureGates) String() string
func (*FeatureGates) UpdateFeatureGates ¶
func (fg *FeatureGates) UpdateFeatureGates(flags map[string]bool) error
UpdateFeatureGates merges the current feature gate values with the values provided by the user.
type FieldSelector ¶
type FieldSelector string
func (*FieldSelector) Set ¶
func (fs *FieldSelector) Set(value string) error
Set implements the flag.Value interface.
func (*FieldSelector) String ¶
func (fs *FieldSelector) String() string
String implements the flag.Value interface.
type FilterFunc ¶
type FilterFunc func(EventPayload) bool
FilterFunc is a function that gets an EventPayload and returns true if the object should trigger a reconciliation.
func AnyFilter ¶
func AnyFilter(filters ...FilterFunc) FilterFunc
AnyFilter returns a FilterFunc which calls the filters sequentially and returns true as soon as one filter returns true.
func HasReferenceFunc ¶
func HasReferenceFunc( informerGetter InformerGetter, refResolver RefResolver, ) FilterFunc
HasReferenceFunc returns a function which takes a object (secret or configmap) as input parameter and returns true if at least one workload watched by the controller has a reference to this object or is in the same namespace.
The object is expected to be a *metav1.PartialObjectMetadata.
type FinalizerSyncer ¶
type FinalizerSyncer struct {
// contains filtered or unexported fields
}
FinalizerSyncer holds the configuration and dependencies required to perform finalizer synchronization.
func NewFinalizerSyncer ¶
func NewFinalizerSyncer(mdClient metadata.Interface, gvr schema.GroupVersionResource) *FinalizerSyncer
func NewNoopFinalizerSyncer ¶
func NewNoopFinalizerSyncer() *FinalizerSyncer
func (*FinalizerSyncer) Sync ¶
func (s *FinalizerSyncer) Sync(ctx context.Context, p metav1.Object, deletionInProgress bool, statusCleanup func() error) (bool, error)
Sync ensures the `monitoring.rhobs/status-cleanup` finalizer is correctly set on the given workload resource (Prometheus, PrometheusAgent, Alertmanager, or ThanosRuler). It adds the finalizer if necessary, or removes it when appropriate.
Returns true if the finalizer was added, otherwise false. The second return value indicates any error encountered during the operation.
type GoverningObject ¶
type HandlerEvent ¶
type HandlerEvent string
type InformerGetter ¶
type InformerGetter interface {
GetInformers() []informers.InformLister
}
type LabelSelector ¶
type LabelSelector string
func (*LabelSelector) Set ¶
func (ls *LabelSelector) Set(value string) error
Set implements the flag.Value interface.
func (*LabelSelector) String ¶
func (ls *LabelSelector) String() string
String implements the flag.Value interface.
type Map ¶
func (*Map) Merge ¶
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) SortedKeys ¶
SortedKeys returns a slice of the keys in increasing order.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics represents metrics associated to an operator.
func NewMetrics ¶
func NewMetrics(r prometheus.Registerer) *Metrics
NewMetrics initializes operator metrics and registers them with the given registerer.
func (*Metrics) Collect ¶
func (m *Metrics) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (*Metrics) Describe ¶
func (m *Metrics) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
func (*Metrics) MustRegister ¶
func (m *Metrics) MustRegister(metrics ...prometheus.Collector)
MustRegister registers metrics with the Metrics registerer.
func (*Metrics) NewInstrumentedListerWatcher ¶
func (m *Metrics) NewInstrumentedListerWatcher(lw cache.ListerWatcher) cache.ListerWatcher
NewInstrumentedListerWatcher returns a cache.ListerWatcher with instrumentation.
func (*Metrics) Ready ¶
func (m *Metrics) Ready() prometheus.Gauge
Ready returns a gauge to track whether the controller is ready or not.
func (*Metrics) SetRejectedResources ¶
SetRejectedResources sets the number of resources that the controller rejected for the given object's key.
func (*Metrics) SetSelectedResources ¶
SetSelectedResources sets the number of resources that the controller selected for the given object's key.
func (*Metrics) StsDeleteCreateCounter ¶
func (m *Metrics) StsDeleteCreateCounter() prometheus.Counter
StsDeleteCreateCounter returns a counter to track statefulset's recreations.
func (*Metrics) TriggerByCounter ¶
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 ¶
type Namespaces struct {
// Allow list of namespaces for common custom resources.
// If not empty, DenyList must be empty.
AllowList StringSet
// Deny list of namespaces for common custom resources.
// If not empty, AllowList must be empty.
DenyList StringSet
// Allow list of namespaces for Prometheus custom resources.
PrometheusAllowList StringSet
// Allow list of namespaces for Alertmanager custom resources.
AlertmanagerAllowList StringSet
// Allow list of namespaces for AlertmanagerConfig custom resources.
AlertmanagerConfigAllowList StringSet
// Allow list of namespaces for ThanosRuler custom resources.
ThanosRulerAllowList StringSet
}
Namespaces defines the namespaces which are watched by the operator. The zero value is valid and allows all namespaces.
func (*Namespaces) Finalize ¶
func (n *Namespaces) Finalize() error
Finalize must be called to verify that the configuration is valid.
func (*Namespaces) String ¶
func (n *Namespaces) String() string
type NewEventRecorderFunc ¶
type NewEventRecorderFunc func(related runtime.Object) *EventRecorder
NewEventRecorderFunc returns an EventRecorder which will automatically inject the given runtime.Object as related.
type NodeAddressPriority ¶
type NodeAddressPriority string
func (*NodeAddressPriority) Set ¶
func (p *NodeAddressPriority) Set(value string) error
Set implements the flag.Value interface.
func (*NodeAddressPriority) String ¶
func (p *NodeAddressPriority) String() string
String implements the flag.Value interface.
type ObjectOption ¶
func WithAnnotations ¶
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 WithInputHashAnnotation ¶
func WithInputHashAnnotation(h string) ObjectOption
WithInputHashAnnotation records the given hash string in the object's annotations.
func WithLabels ¶
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 ¶
func WithManagingOwner(owner Owner) ObjectOption
WithManagingOwner adds the given object as the managing object.
func WithNamespace ¶
func WithNamespace(namespace string) ObjectOption
WithNamespace updates the namespace of the object.
func WithOwner ¶
func WithOwner(owner Owner) ObjectOption
WithOwner adds the given object to the list of owner references.
func WithSelectorLabels ¶
func WithSelectorLabels(selector *metav1.LabelSelector) ObjectOption
WithSelectorLabels merges the labels from the selector with the existing object's labels. The selector's labels take precedence over the existing ones.
func WithoutKubectlAnnotations ¶
func WithoutKubectlAnnotations() ObjectOption
WithoutKubectlAnnotations removes kubectl annotations inherited from the governing object. Otherwise the managed object might be deleted when "kubectl apply --prune" is run against the governing object.
type OwnedResourceOwner ¶
OwnedResourceOwner returns an object from its "<namespace>/<name>" key.
type Owner ¶
type Owner interface {
metav1.ObjectMetaAccessor
schema.ObjectKind
}
type Pod ¶
Pod is an alias for the Kubernetes v1.Pod type.
type PrometheusRuleSelection ¶
type PrometheusRuleSelection struct {
// contains filtered or unexported fields
}
func (*PrometheusRuleSelection) RejectedLen ¶
func (prs *PrometheusRuleSelection) RejectedLen() int
func (*PrometheusRuleSelection) RuleFiles ¶
func (prs *PrometheusRuleSelection) RuleFiles() map[string]string
func (*PrometheusRuleSelection) Selected ¶
func (prs *PrometheusRuleSelection) Selected() TypedResourcesSelection[*monitoringv1.PrometheusRule]
func (*PrometheusRuleSelection) SelectedLen ¶
func (prs *PrometheusRuleSelection) SelectedLen() int
type PrometheusRuleSelector ¶
type PrometheusRuleSelector struct {
// contains filtered or unexported fields
}
PrometheusRuleSelector selects PrometheusRule resources and translates them to Prometheus/Thanos configuration format.
func NewPrometheusRuleSelector ¶
func NewPrometheusRuleSelector(ruleFormat RuleConfigurationFormat, version string, labelSelector *metav1.LabelSelector, nsLabeler *namespacelabeler.Labeler, ruleInformer *informers.ForResource, eventRecorder *EventRecorder, logger *slog.Logger) (*PrometheusRuleSelector, error)
NewPrometheusRuleSelector returns a PrometheusRuleSelector pointer.
func (*PrometheusRuleSelector) Select ¶
func (prs *PrometheusRuleSelector) Select(namespaces []string) (PrometheusRuleSelection, error)
Select selects PrometheusRules by Prometheus or ThanosRuler.
type PrometheusRuleSyncer ¶
type PrometheusRuleSyncer struct {
// contains filtered or unexported fields
}
PrometheusRuleSyncer knows how to synchronize ConfigMaps holding Prometheus or Thanos rule configuration.
func NewPrometheusRuleSyncer ¶
func NewPrometheusRuleSyncer( logger *slog.Logger, namePrefix string, cmClient clientv1.ConfigMapInterface, cmSelector labels.Set, options []ObjectOption, ) *PrometheusRuleSyncer
func (*PrometheusRuleSyncer) AppendConfigMapNames ¶
func (prs *PrometheusRuleSyncer) AppendConfigMapNames(configMapNames []string, limit int) []string
AppendConfigMapNames adds "virtual" ConfigMap names to the given slice until it reaches the limit.
The goal is to avoid statefulset redeployments when the number of "concrete" ConfigMaps changes. Because rule's ConfigMaps are mounted with "optional: true", the statefulset will be rolled out successfully even if the ConfigMaps don't exist and if more ConfigMaps are generated, the operator doesn't have to update the statefulset's spec.
type Quantity ¶
type Quantity struct {
// contains filtered or unexported fields
}
nolint:recvcheck,godoclint
type ReconcilerMetrics ¶
type ReconcilerMetrics interface {
TriggerByCounter(string, HandlerEvent) prometheus.Counter
}
ReconcilerMetrics tracks reconciler metrics.
type ReconciliationStatus ¶
type ReconciliationStatus struct {
// contains filtered or unexported fields
}
func (ReconciliationStatus) Message ¶
func (rs ReconciliationStatus) Message() string
func (ReconciliationStatus) Ok ¶
func (rs ReconciliationStatus) Ok() bool
func (ReconciliationStatus) Reason ¶
func (rs ReconciliationStatus) Reason() string
type ReconciliationTracker ¶
type ReconciliationTracker struct {
// contains filtered or unexported fields
}
ReconciliationTracker tracks reconciliation status per object.
It only uses their `<namespace>/<name>` key to identify objects.
The zero ReconciliationTracker is ready to use.
func (*ReconciliationTracker) Collect ¶
func (rt *ReconciliationTracker) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (*ReconciliationTracker) Describe ¶
func (rt *ReconciliationTracker) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
func (*ReconciliationTracker) ForgetObject ¶
func (rt *ReconciliationTracker) ForgetObject(key 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 ¶
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) HasRefTo ¶
func (rt *ReconciliationTracker) HasRefTo(key string, obj runtime.Object) bool
HasRefTo returns true if the object identified by key has a direct or indirect reference to obj (secret or configmap).
func (*ReconciliationTracker) ResetStatus ¶
func (rt *ReconciliationTracker) ResetStatus(key string)
ResetStatus resets the reconciliation status for the object identified by key.
func (*ReconciliationTracker) SetReasonAndMessage ¶
func (rt *ReconciliationTracker) SetReasonAndMessage(key string, reason, message string)
SetReasonAndMessage updates the reason and message for the object identified by key. The reason and message are only used when the reconciliation returned no error.
func (*ReconciliationTracker) SetStatus ¶
func (rt *ReconciliationTracker) SetStatus(key string, err error)
SetStatus updates the last reconciliation status for the object identified by key.
func (*ReconciliationTracker) UpdateReferenceTracker ¶
func (rt *ReconciliationTracker) UpdateReferenceTracker(key string, refTracker ReferenceTracker)
UpdateReferenceTracker updates the reference tracker for the object identified by key.
type RefResolver ¶
type ReferenceTracker ¶
ReferenceTracker returns true if it has a reference to the object.
type ReloaderOption ¶
type ReloaderOption = func(*ConfigReloader)
func ConfigEnvsubstFile ¶
func ConfigEnvsubstFile(configEnvsubstFile string) ReloaderOption
ConfigEnvsubstFile sets the configEnvsubstFile option for the config-reloader container.
func ConfigFile ¶
func ConfigFile(configFile string) ReloaderOption
ConfigFile sets the configFile option for the config-reloader container.
func ImagePullPolicy ¶
func ImagePullPolicy(imagePullPolicy v1.PullPolicy) ReloaderOption
ImagePullPolicy sets the imagePullPolicy option for the config-reloader container.
func InitContainer ¶
func InitContainer() ReloaderOption
InitContainer runs the config-reloader program as an init container meaning that it exits right after generating the configuration.
func ListenLocal ¶
func ListenLocal(listenLocal bool) ReloaderOption
ListenLocal sets the listenLocal option for the config-reloader container.
func LocalHost ¶
func LocalHost(localHost string) ReloaderOption
LocalHost sets the localHost option for the config-reloader container.
func LogFormat ¶
func LogFormat(logFormat string) ReloaderOption
LogFormat sets the logFormat option for the config-reloader container.
func LogLevel ¶
func LogLevel(logLevel string) ReloaderOption
LogLevel sets the logLevel option for the config-reloader container.
func ReloaderConfig ¶
func ReloaderConfig(rc ContainerConfig) ReloaderOption
ReloaderConfig sets the config option for the config-reloader container.
func ReloaderURL ¶
func ReloaderURL(u url.URL) ReloaderOption
ReloaderURL sets the reloaderURL option for the config-reloader container.
func ReloaderUseSignal ¶
func ReloaderUseSignal() ReloaderOption
func RuntimeInfoURL ¶
func RuntimeInfoURL(u url.URL) ReloaderOption
RuntimeInfoURL sets the runtimeInfoURL option for the config-reloader container.
func Shard ¶
func Shard(shard int32) ReloaderOption
Shard sets the shard option for the config-reloader container.
func VolumeMounts ¶
func VolumeMounts(mounts []v1.VolumeMount) ReloaderOption
VolumeMounts sets the volumeMounts option for the config-reloader container.
func WatchedDirectories ¶
func WatchedDirectories(watchedDirectories []string) ReloaderOption
WatchedDirectories sets the watchedDirectories option for the config-reloader container.
func WebConfigFile ¶
func WebConfigFile(config string) ReloaderOption
WebConfigFile sets the webConfigFile option for the config-reloader container.
func WithDaemonSetMode ¶
func WithDaemonSetMode() ReloaderOption
WithDaemonSetMode sets the options that work for DaemonSet mode. Currently we set SHARD env equal to 0, eventhough DaemonSet doesn't use this env. TODO: Remove SHARD env for DaemonSet mode.
type ResourceReconciler ¶
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(..., "Prometheus", ...) statefulSetInformer.AddEventHandler(rr) resourceInformer.AddEventHandler(rr)
ResourceReconciler will trigger object and status reconciliations based on the events received from the informer.
func NewResourceReconciler ¶
func NewResourceReconciler( l *slog.Logger, syncer Syncer, getter OwnedResourceOwner, metrics ReconcilerMetrics, kind string, reg prometheus.Registerer, controllerID string, ) *ResourceReconciler
NewResourceReconciler returns a reconciler for the "kind" resource.
func (*ResourceReconciler) DeletionInProgress ¶
func (rr *ResourceReconciler) DeletionInProgress(o metav1.Object) bool
DeletionInProgress returns true if the object deletion has been requested.
func (*ResourceReconciler) EnqueueForReconciliation ¶
func (rr *ResourceReconciler) EnqueueForReconciliation(obj metav1.Object)
EnqueueForReconciliation asks for reconciling the object.
func (*ResourceReconciler) EnqueueForStatus ¶
func (rr *ResourceReconciler) EnqueueForStatus(obj metav1.Object)
EnqueueForStatus asks for updating the status of the object.
func (*ResourceReconciler) OnAdd ¶
func (rr *ResourceReconciler) OnAdd(obj any, _ bool)
OnAdd implements the cache.ResourceEventHandler interface.
func (*ResourceReconciler) OnDelete ¶
func (rr *ResourceReconciler) OnDelete(obj any)
OnDelete implements the cache.ResourceEventHandler interface.
func (*ResourceReconciler) OnUpdate ¶
func (rr *ResourceReconciler) OnUpdate(old, cur any)
OnUpdate implements the cache.ResourceEventHandler interface.
func (*ResourceReconciler) Run ¶
func (rr *ResourceReconciler) Run(ctx context.Context)
Run the goroutines responsible for processing the reconciliation and status queues.
func (*ResourceReconciler) Stop ¶
func (rr *ResourceReconciler) Stop()
Stop the processing queues and wait for goroutines to exit.
type RuleConfigurationFormat ¶
type RuleConfigurationFormat int
const ( // PrometheusFormat indicates that the rule configuration should comply with the Prometheus format. PrometheusFormat RuleConfigurationFormat = iota // ThanosFormat indicates that the rule configuration should comply with the Thanos format. ThanosFormat )
type ShardedSecret ¶
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 ReconcileShardedSecret ¶
func ReconcileShardedSecret(ctx context.Context, data map[string][]byte, client kubernetes.Interface, template *v1.Secret) (*ShardedSecret, error)
func (*ShardedSecret) Hash ¶
func (s *ShardedSecret) Hash() (uint64, error)
Hash implements the Hashable interface from github.com/mitchellh/hashstructure.
type StatefulSetReporter ¶
type StatefulSetReporter struct {
Pods []*Pod
// contains filtered or unexported fields
}
func NewStatefulSetReporter ¶
func NewStatefulSetReporter(ctx context.Context, kclient kubernetes.Interface, sset *appsv1.StatefulSet) (*StatefulSetReporter, error)
NewStatefulSetReporter returns a statefulset's reporter.
func (*StatefulSetReporter) IsUpdated ¶
func (sr *StatefulSetReporter) IsUpdated(p *Pod) bool
IsUpdated returns true if the given pod matches with the statefulset's revision.
func (*StatefulSetReporter) ReadyPods ¶
func (sr *StatefulSetReporter) ReadyPods() []*Pod
ReadyPods returns the list of pods that are ready.
func (*StatefulSetReporter) Update ¶
func (sr *StatefulSetReporter) Update(gObj GoverningObject) monitoringv1.Condition
func (*StatefulSetReporter) UpdatedPods ¶
func (sr *StatefulSetReporter) UpdatedPods() []*Pod
UpdatedPods returns the list of pods that match with the statefulset's revision.
type StatusReconciler ¶
type StringSet ¶
type StringSet map[string]struct{}
StringSet represents a list of comma-separated strings.
func MergeAllowLists ¶
MergeAllowLists returns a StringSet which is the merge of a and b.
type Syncer ¶
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
}
Syncer knows how to synchronize statefulset-based or daemonset-based resources.
type TypedConfigurationResource ¶
type TypedConfigurationResource[T ConfigurationResource] struct { // contains filtered or unexported fields }
TypedConfigurationResource is a generic type that holds a configuration resource with its validation status.
func NewTypedConfigurationResource ¶
func NewTypedConfigurationResource[T ConfigurationResource](res T, err error, reason string, generation int64) TypedConfigurationResource[T]
func (*TypedConfigurationResource[T]) Conditions ¶
func (r *TypedConfigurationResource[T]) Conditions() []monitoringv1.ConfigResourceCondition
Conditions returns a list of conditions based on the validation status of the configuration resource.
func (*TypedConfigurationResource[T]) Resource ¶
func (r *TypedConfigurationResource[T]) Resource() T
type TypedResourcesSelection ¶
type TypedResourcesSelection[T ConfigurationResource] map[string]TypedConfigurationResource[T]
TypedResourcesSelection represents a map of configuration resources selected by Prometheus or PrometheusAgent.
func (TypedResourcesSelection[T]) ValidResources ¶
func (resources TypedResourcesSelection[T]) ValidResources() map[string]T
ValidResources returns only the resources which the operator considers to be valid. The keys of the returned map identify the resources using the `<namespace>/<name>` format.
Source Files
¶
- accessor.go
- argument.go
- conditions.go
- config.go
- config_reloader.go
- config_reloader_test_lib.go
- config_resource.go
- defaults.go
- event_handler.go
- factory.go
- feature_gates.go
- finalizer.go
- gzip_config.go
- image.go
- informers.go
- kubernetes.go
- operator.go
- prober.go
- resource_reconciler.go
- rules.go
- sharded_secret.go
- statefulset.go
- statefulset_reporter.go
- status.go
- storageclass.go
- types.go
- validations.go