controller

package
v0.0.0-...-7b3afae Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupThirdPartyCrdReconcilerWithManager

func SetupThirdPartyCrdReconcilerWithManager(
	ctx context.Context,
	k8sClient client.Client,
	crdReconciler ThirdPartyCrdReconciler,
	logger *logr.Logger,
) error

SetupThirdPartyCrdReconcilerWithManager sets up a ThirdPartyCrdReconciler with the provided manager. It establishes watches for the relevant CRD and starts/stops watching for the corresponding third-party resources as needed. In particular, it

  • creates an ThirdPartyResourceReconciler for the respective third-party resource type,
  • checks if the relevant third-party CRD already exists in the cluster, and if so, calls maybeStartWatchingThirdPartyResources,
  • otherwise, maybeStartWatchingThirdPartyResources will be called later on different trigger points, for example when the third-party CRD is created in the cluster, or when a Dash0 API token is provided to the ThirdPartyCrdReconciler.

See function maybeStartWatchingThirdPartyResources for further details on the startup process.

func StartProcessingThirdPartySynchronizationQueue

func StartProcessingThirdPartySynchronizationQueue(
	thirdPartyResourceSynchronizationQueue *workqueue.Typed[ThirdPartyResourceSyncJob],
	setupLog *logr.Logger,
)

func StopProcessingThirdPartySynchronizationQueue

func StopProcessingThirdPartySynchronizationQueue(
	resourceReconcileQueue *workqueue.Typed[ThirdPartyResourceSyncJob],
	logger *logr.Logger,
)

Types

type ApiClient

type ApiClient interface {
	SetApiEndpointAndDataset(context.Context, *ApiConfig, *logr.Logger)
	RemoveApiEndpointAndDataset(context.Context, *logr.Logger)
}

type ApiConfig

type ApiConfig struct {
	Endpoint string
	Dataset  string
}

type ApiSyncReconciler

type ApiSyncReconciler interface {
	KindDisplayName() string
	ShortName() string
	GetAuthToken() string
	GetApiConfig() *atomic.Pointer[ApiConfig]
	ControllerName() string
	K8sClient() client.Client
	HttpClient() *http.Client
	GetHttpRetryDelay() time.Duration

	// MapResourceToHttpRequests converts a Kubernetes resource object to a list of HTTP requests that can be sent to
	// the Dash0 API. It returns:
	// - the total number of eligible items in the Kubernetes resource,
	// - the request objects for which the conversion was successful,
	// - validation issues for items that were invalid and
	// - synchronization errors that occurred during the conversion.
	MapResourceToHttpRequests(
		*preconditionValidationResult,
		apiAction,
		*logr.Logger,
	) (
		int,
		[]HttpRequestWithItemName,
		[]string,
		map[string][]string,
		map[string]string,
	)
}

ApiSyncReconciler is the common interface for reconcilers that synchonize their Kubernetes resources to the Dash0 API. This can either be resource types owned by the Dash0 operator (like Dash0SyntheticCheck), which then also implement the OwnedResourceReconciler interface, or third-party resource types (like PrometheusRule or PersesDashboard), which implement the ThirdPartyResourceReconciler interface.

type CheckRule

type CheckRule struct {
	Name          string            `json:"name"`
	Expression    string            `json:"expression"`
	For           string            `json:"for,omitempty"`
	Interval      string            `json:"interval,omitempty"`
	KeepFiringFor string            `json:"keepFiringFor,omitempty"`
	Annotations   map[string]string `json:"annotations"`
	Labels        map[string]string `json:"labels"`
}

type Dash0ApiObjectWithOrigin

type Dash0ApiObjectWithOrigin struct {
	Origin string `json:"origin"`
}

type HttpRequestWithItemName

type HttpRequestWithItemName struct {
	ItemName string
	Request  *http.Request
}

type MonitoringReconciler

type MonitoringReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func NewMonitoringReconciler

func NewMonitoringReconciler(
	k8sClient client.Client,
	clientset *kubernetes.Clientset,
	instrumenter *instrumentation.Instrumenter,
	collectorManager *collectors.CollectorManager,
	danglingEventsTimeouts *util.DanglingEventsTimeouts,
) *MonitoringReconciler

func (*MonitoringReconciler) InitializeSelfMonitoringMetrics

func (r *MonitoringReconciler) InitializeSelfMonitoringMetrics(
	meter otelmetric.Meter,
	metricNamePrefix string,
	logger *logr.Logger,
)

func (*MonitoringReconciler) Reconcile

func (r *MonitoringReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. It is essential for the controller's reconciliation loop to be idempotent. By following the Operator pattern you will create Controllers which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster. Breaking this recommendation goes against the design principles of controller-runtime. and may lead to unforeseen consequences such as resources becoming stuck and requiring manual intervention. For further info: - About Operator Pattern: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ - About Controllers: https://kubernetes.io/docs/concepts/architecture/controller/ - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.3/pkg/reconcile

func (*MonitoringReconciler) SetupWithManager

func (r *MonitoringReconciler) SetupWithManager(mgr ctrl.Manager) error

type OperatorConfigurationReconciler

type OperatorConfigurationReconciler struct {
	client.Client

	OperatorManagerPodName string

	DanglingEventsTimeouts *util.DanglingEventsTimeouts
	// contains filtered or unexported fields
}

func NewOperatorConfigurationReconciler

func NewOperatorConfigurationReconciler(
	k8sClient client.Client,
	clientset *kubernetes.Clientset,
	apiClients []ApiClient,
	collectorManager *collectors.CollectorManager,
	pseudoClusterUid types.UID,
	operatorDeploymentNamespace string,
	operatorDeploymentUID types.UID,
	operatorDeploymentName string,
	oTelSdkStarter *selfmonitoringapiaccess.OTelSdkStarter,
	images util.Images,
	operatorNamespace string,
	developmentMode bool,
) *OperatorConfigurationReconciler

func (*OperatorConfigurationReconciler) InitializeSelfMonitoringMetrics

func (r *OperatorConfigurationReconciler) InitializeSelfMonitoringMetrics(
	meter otelmetric.Meter,
	metricNamePrefix string,
	logger *logr.Logger,
)

func (*OperatorConfigurationReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. It is essential for the controller's reconciliation loop to be idempotent. By following the Operator pattern you will create Controllers which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster. Breaking this recommendation goes against the design principles of controller-runtime. and may lead to unforeseen consequences such as resources becoming stuck and requiring manual intervention. For further info: - About Operator Pattern: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ - About Controllers: https://kubernetes.io/docs/concepts/architecture/controller/ - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.16.3/pkg/reconcile

func (*OperatorConfigurationReconciler) SetAuthTokenClients

func (r *OperatorConfigurationReconciler) SetAuthTokenClients(authTokenClients []selfmonitoringapiaccess.AuthTokenClient)

func (*OperatorConfigurationReconciler) SetupWithManager

func (r *OperatorConfigurationReconciler) SetupWithManager(mgr ctrl.Manager) error

type OwnedResourceReconciler

type OwnedResourceReconciler interface {
	ApiSyncReconciler

	// WriteSynchronizationResultToSynchronizedResource writes the result of a synchronization attempt to the status
	// of the Kubernetes resource that has been synchronized. This is only supported for resource types owned by the
	// Dash0 operator, not for third-party resource types.
	WriteSynchronizationResultToSynchronizedResource(
		context.Context,
		client.Object,
		dash0common.Dash0ApiResourceSynchronizationStatus,
		[]string,
		string,
		*logr.Logger,
	)
}

OwnedResourceReconciler extends the ApiSyncReconciler interface with methods that are specific to resource types owned by the Dash0 operator (like Dash0SyntheticCheck, Dash0View).

type PersesDashboardCrdReconciler

type PersesDashboardCrdReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func NewPersesDashboardCrdReconciler

func NewPersesDashboardCrdReconciler(
	k8sClient client.Client,
	queue *workqueue.Typed[ThirdPartyResourceSyncJob],
	leaderElectionAware util.LeaderElectionAware,
	httpClient *http.Client,
) *PersesDashboardCrdReconciler

func (*PersesDashboardCrdReconciler) ControllerName

func (r *PersesDashboardCrdReconciler) ControllerName() string

func (*PersesDashboardCrdReconciler) CreateThirdPartyResourceReconciler

func (r *PersesDashboardCrdReconciler) CreateThirdPartyResourceReconciler(pseudoClusterUid types.UID)

func (*PersesDashboardCrdReconciler) DoesCrdExist

func (r *PersesDashboardCrdReconciler) DoesCrdExist() *atomic.Bool

func (*PersesDashboardCrdReconciler) Group

func (*PersesDashboardCrdReconciler) InitializeSelfMonitoringMetrics

func (r *PersesDashboardCrdReconciler) InitializeSelfMonitoringMetrics(
	meter otelmetric.Meter,
	metricNamePrefix string,
	logger *logr.Logger,
)

func (*PersesDashboardCrdReconciler) Kind

func (*PersesDashboardCrdReconciler) KindDisplayName

func (r *PersesDashboardCrdReconciler) KindDisplayName() string

func (*PersesDashboardCrdReconciler) Manager

func (*PersesDashboardCrdReconciler) OperatorManagerIsLeader

func (r *PersesDashboardCrdReconciler) OperatorManagerIsLeader() bool

func (*PersesDashboardCrdReconciler) QualifiedKind

func (r *PersesDashboardCrdReconciler) QualifiedKind() string

func (*PersesDashboardCrdReconciler) Reconcile

func (*PersesDashboardCrdReconciler) RemoveApiEndpointAndDataset

func (r *PersesDashboardCrdReconciler) RemoveApiEndpointAndDataset(ctx context.Context, logger *logr.Logger)

func (*PersesDashboardCrdReconciler) RemoveAuthToken

func (r *PersesDashboardCrdReconciler) RemoveAuthToken(ctx context.Context, logger *logr.Logger)

func (*PersesDashboardCrdReconciler) SetApiEndpointAndDataset

func (r *PersesDashboardCrdReconciler) SetApiEndpointAndDataset(
	ctx context.Context,
	apiConfig *ApiConfig,
	logger *logr.Logger)

func (*PersesDashboardCrdReconciler) SetAuthToken

func (r *PersesDashboardCrdReconciler) SetAuthToken(
	ctx context.Context,
	authToken string,
	logger *logr.Logger)

func (*PersesDashboardCrdReconciler) SetCrdExists

func (r *PersesDashboardCrdReconciler) SetCrdExists(exists bool)

func (*PersesDashboardCrdReconciler) SetupWithManager

func (r *PersesDashboardCrdReconciler) SetupWithManager(
	ctx context.Context,
	mgr ctrl.Manager,
	startupK8sClient client.Client,
	logger *logr.Logger,
) error

func (*PersesDashboardCrdReconciler) SkipNameValidation

func (r *PersesDashboardCrdReconciler) SkipNameValidation() bool

func (*PersesDashboardCrdReconciler) ThirdPartyResourceReconciler

func (r *PersesDashboardCrdReconciler) ThirdPartyResourceReconciler() ThirdPartyResourceReconciler

func (*PersesDashboardCrdReconciler) Version

func (r *PersesDashboardCrdReconciler) Version() string

type PersesDashboardReconciler

type PersesDashboardReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func (*PersesDashboardReconciler) ControllerName

func (r *PersesDashboardReconciler) ControllerName() string

func (*PersesDashboardReconciler) ControllerStopFunctionLock

func (r *PersesDashboardReconciler) ControllerStopFunctionLock() *sync.Mutex

func (*PersesDashboardReconciler) CreateDeleteRequests

func (r *PersesDashboardReconciler) CreateDeleteRequests(
	_ *preconditionValidationResult,
	_ []string,
	_ []string,
	_ *logr.Logger,
) ([]HttpRequestWithItemName, map[string]string)

func (*PersesDashboardReconciler) FetchExistingResourceOriginsRequest

func (r *PersesDashboardReconciler) FetchExistingResourceOriginsRequest(
	_ *preconditionValidationResult,
) (*http.Request, error)

func (*PersesDashboardReconciler) GetApiConfig

func (r *PersesDashboardReconciler) GetApiConfig() *atomic.Pointer[ApiConfig]

func (*PersesDashboardReconciler) GetAuthToken

func (r *PersesDashboardReconciler) GetAuthToken() string

func (*PersesDashboardReconciler) GetControllerStopFunction

func (r *PersesDashboardReconciler) GetControllerStopFunction() *context.CancelFunc

func (*PersesDashboardReconciler) GetHttpRetryDelay

func (r *PersesDashboardReconciler) GetHttpRetryDelay() time.Duration

func (*PersesDashboardReconciler) HttpClient

func (r *PersesDashboardReconciler) HttpClient() *http.Client

func (*PersesDashboardReconciler) InitializeSelfMonitoringMetrics

func (r *PersesDashboardReconciler) InitializeSelfMonitoringMetrics(
	meter otelmetric.Meter,
	metricNamePrefix string,
	logger *logr.Logger,
)

func (*PersesDashboardReconciler) IsSynchronizationEnabled

func (r *PersesDashboardReconciler) IsSynchronizationEnabled(monitoringResource *dash0v1beta1.Dash0Monitoring) bool

func (*PersesDashboardReconciler) IsWatching

func (r *PersesDashboardReconciler) IsWatching() bool

func (*PersesDashboardReconciler) K8sClient

func (r *PersesDashboardReconciler) K8sClient() client.Client

func (*PersesDashboardReconciler) KindDisplayName

func (r *PersesDashboardReconciler) KindDisplayName() string

func (*PersesDashboardReconciler) MapResourceToHttpRequests

func (r *PersesDashboardReconciler) MapResourceToHttpRequests(
	preconditionChecksResult *preconditionValidationResult,
	action apiAction,
	logger *logr.Logger,
) (int, []HttpRequestWithItemName, []string, map[string][]string, map[string]string)

func (*PersesDashboardReconciler) Queue

func (*PersesDashboardReconciler) Reconcile

func (*PersesDashboardReconciler) SetControllerStopFunction

func (r *PersesDashboardReconciler) SetControllerStopFunction(controllerStopFunction *context.CancelFunc)

func (*PersesDashboardReconciler) ShortName

func (r *PersesDashboardReconciler) ShortName() string

func (*PersesDashboardReconciler) UpdateSynchronizationResultsInDash0MonitoringStatus

func (_ *PersesDashboardReconciler) UpdateSynchronizationResultsInDash0MonitoringStatus(
	monitoringResource *dash0v1beta1.Dash0Monitoring,
	qualifiedName string,
	status dash0common.ThirdPartySynchronizationStatus,
	_ int,
	_ []string,
	synchronizationErrors map[string]string,
	validationIssuesMap map[string][]string,
) interface{}

type PrometheusRuleCrdReconciler

type PrometheusRuleCrdReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func NewPrometheusRuleCrdReconciler

func NewPrometheusRuleCrdReconciler(
	k8sClient client.Client,
	queue *workqueue.Typed[ThirdPartyResourceSyncJob],
	leaderElectionAware util.LeaderElectionAware,
	httpClient *http.Client,
) *PrometheusRuleCrdReconciler

func (*PrometheusRuleCrdReconciler) ControllerName

func (r *PrometheusRuleCrdReconciler) ControllerName() string

func (*PrometheusRuleCrdReconciler) CreateThirdPartyResourceReconciler

func (r *PrometheusRuleCrdReconciler) CreateThirdPartyResourceReconciler(pseudoClusterUid types.UID)

func (*PrometheusRuleCrdReconciler) DoesCrdExist

func (r *PrometheusRuleCrdReconciler) DoesCrdExist() *atomic.Bool

func (*PrometheusRuleCrdReconciler) Group

func (*PrometheusRuleCrdReconciler) InitializeSelfMonitoringMetrics

func (r *PrometheusRuleCrdReconciler) InitializeSelfMonitoringMetrics(
	meter otelmetric.Meter,
	metricNamePrefix string,
	logger *logr.Logger,
)

func (*PrometheusRuleCrdReconciler) Kind

func (*PrometheusRuleCrdReconciler) KindDisplayName

func (r *PrometheusRuleCrdReconciler) KindDisplayName() string

func (*PrometheusRuleCrdReconciler) Manager

func (*PrometheusRuleCrdReconciler) OperatorManagerIsLeader

func (r *PrometheusRuleCrdReconciler) OperatorManagerIsLeader() bool

func (*PrometheusRuleCrdReconciler) QualifiedKind

func (r *PrometheusRuleCrdReconciler) QualifiedKind() string

func (*PrometheusRuleCrdReconciler) Reconcile

func (*PrometheusRuleCrdReconciler) RemoveApiEndpointAndDataset

func (r *PrometheusRuleCrdReconciler) RemoveApiEndpointAndDataset(ctx context.Context, logger *logr.Logger)

func (*PrometheusRuleCrdReconciler) RemoveAuthToken

func (r *PrometheusRuleCrdReconciler) RemoveAuthToken(ctx context.Context, logger *logr.Logger)

func (*PrometheusRuleCrdReconciler) SetApiEndpointAndDataset

func (r *PrometheusRuleCrdReconciler) SetApiEndpointAndDataset(
	ctx context.Context,
	apiConfig *ApiConfig,
	logger *logr.Logger)

func (*PrometheusRuleCrdReconciler) SetAuthToken

func (r *PrometheusRuleCrdReconciler) SetAuthToken(
	ctx context.Context,
	authToken string,
	logger *logr.Logger)

func (*PrometheusRuleCrdReconciler) SetCrdExists

func (r *PrometheusRuleCrdReconciler) SetCrdExists(exists bool)

func (*PrometheusRuleCrdReconciler) SetupWithManager

func (r *PrometheusRuleCrdReconciler) SetupWithManager(
	ctx context.Context,
	mgr ctrl.Manager,
	startupK8sClient client.Client,
	logger *logr.Logger,
) error

func (*PrometheusRuleCrdReconciler) SkipNameValidation

func (r *PrometheusRuleCrdReconciler) SkipNameValidation() bool

func (*PrometheusRuleCrdReconciler) ThirdPartyResourceReconciler

func (r *PrometheusRuleCrdReconciler) ThirdPartyResourceReconciler() ThirdPartyResourceReconciler

func (*PrometheusRuleCrdReconciler) Version

func (r *PrometheusRuleCrdReconciler) Version() string

type PrometheusRuleReconciler

type PrometheusRuleReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func (*PrometheusRuleReconciler) ControllerName

func (r *PrometheusRuleReconciler) ControllerName() string

func (*PrometheusRuleReconciler) ControllerStopFunctionLock

func (r *PrometheusRuleReconciler) ControllerStopFunctionLock() *sync.Mutex

func (*PrometheusRuleReconciler) CreateDeleteRequests

func (r *PrometheusRuleReconciler) CreateDeleteRequests(
	preconditionChecksResult *preconditionValidationResult,
	existingOriginsFromApi []string,
	originsInResource []string,
	logger *logr.Logger,
) ([]HttpRequestWithItemName, map[string]string)

func (*PrometheusRuleReconciler) FetchExistingResourceOriginsRequest

func (r *PrometheusRuleReconciler) FetchExistingResourceOriginsRequest(
	preconditionChecksResult *preconditionValidationResult,
) (*http.Request, error)

func (*PrometheusRuleReconciler) GetApiConfig

func (r *PrometheusRuleReconciler) GetApiConfig() *atomic.Pointer[ApiConfig]

func (*PrometheusRuleReconciler) GetAuthToken

func (r *PrometheusRuleReconciler) GetAuthToken() string

func (*PrometheusRuleReconciler) GetControllerStopFunction

func (r *PrometheusRuleReconciler) GetControllerStopFunction() *context.CancelFunc

func (*PrometheusRuleReconciler) GetHttpRetryDelay

func (r *PrometheusRuleReconciler) GetHttpRetryDelay() time.Duration

func (*PrometheusRuleReconciler) HttpClient

func (r *PrometheusRuleReconciler) HttpClient() *http.Client

func (*PrometheusRuleReconciler) InitializeSelfMonitoringMetrics

func (r *PrometheusRuleReconciler) InitializeSelfMonitoringMetrics(
	meter otelmetric.Meter,
	metricNamePrefix string,
	logger *logr.Logger,
)

func (*PrometheusRuleReconciler) IsSynchronizationEnabled

func (r *PrometheusRuleReconciler) IsSynchronizationEnabled(monitoringResource *dash0v1beta1.Dash0Monitoring) bool

func (*PrometheusRuleReconciler) IsWatching

func (r *PrometheusRuleReconciler) IsWatching() bool

func (*PrometheusRuleReconciler) K8sClient

func (r *PrometheusRuleReconciler) K8sClient() client.Client

func (*PrometheusRuleReconciler) KindDisplayName

func (r *PrometheusRuleReconciler) KindDisplayName() string

func (*PrometheusRuleReconciler) MapResourceToHttpRequests

func (r *PrometheusRuleReconciler) MapResourceToHttpRequests(
	preconditionChecksResult *preconditionValidationResult,
	action apiAction,
	logger *logr.Logger,
) (int, []HttpRequestWithItemName, []string, map[string][]string, map[string]string)

func (*PrometheusRuleReconciler) Queue

func (*PrometheusRuleReconciler) Reconcile

func (*PrometheusRuleReconciler) SetControllerStopFunction

func (r *PrometheusRuleReconciler) SetControllerStopFunction(controllerStopFunction *context.CancelFunc)

func (*PrometheusRuleReconciler) ShortName

func (r *PrometheusRuleReconciler) ShortName() string

func (*PrometheusRuleReconciler) UpdateSynchronizationResultsInDash0MonitoringStatus

func (_ *PrometheusRuleReconciler) UpdateSynchronizationResultsInDash0MonitoringStatus(
	monitoringResource *dash0v1beta1.Dash0Monitoring,
	qualifiedName string,
	status dash0common.ThirdPartySynchronizationStatus,
	itemsTotal int,
	successfullySynchronized []string,
	synchronizationErrorsPerItem map[string]string,
	validationIssuesPerItem map[string][]string,
) interface{}

type SyntheticCheckReconciler

type SyntheticCheckReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func NewSyntheticCheckReconciler

func NewSyntheticCheckReconciler(
	k8sClient client.Client,
	pseudoClusterUid types.UID,
	leaderElectionAware util.LeaderElectionAware,
	httpClient *http.Client,
) *SyntheticCheckReconciler

func (*SyntheticCheckReconciler) ControllerName

func (r *SyntheticCheckReconciler) ControllerName() string

func (*SyntheticCheckReconciler) GetApiConfig

func (r *SyntheticCheckReconciler) GetApiConfig() *atomic.Pointer[ApiConfig]

func (*SyntheticCheckReconciler) GetAuthToken

func (r *SyntheticCheckReconciler) GetAuthToken() string

func (*SyntheticCheckReconciler) GetHttpRetryDelay

func (r *SyntheticCheckReconciler) GetHttpRetryDelay() time.Duration

func (*SyntheticCheckReconciler) HttpClient

func (r *SyntheticCheckReconciler) HttpClient() *http.Client

func (*SyntheticCheckReconciler) InitializeSelfMonitoringMetrics

func (r *SyntheticCheckReconciler) InitializeSelfMonitoringMetrics(
	meter otelmetric.Meter,
	metricNamePrefix string,
	logger *logr.Logger,
)

func (*SyntheticCheckReconciler) K8sClient

func (r *SyntheticCheckReconciler) K8sClient() client.Client

func (*SyntheticCheckReconciler) KindDisplayName

func (r *SyntheticCheckReconciler) KindDisplayName() string

func (*SyntheticCheckReconciler) MapResourceToHttpRequests

func (r *SyntheticCheckReconciler) MapResourceToHttpRequests(
	preconditionChecksResult *preconditionValidationResult,
	action apiAction,
	logger *logr.Logger,
) (int, []HttpRequestWithItemName, []string, map[string][]string, map[string]string)

func (*SyntheticCheckReconciler) NotifiyOperatorManagerJustBecameLeader

func (r *SyntheticCheckReconciler) NotifiyOperatorManagerJustBecameLeader(ctx context.Context, logger *logr.Logger)

func (*SyntheticCheckReconciler) Reconcile

func (*SyntheticCheckReconciler) RemoveApiEndpointAndDataset

func (r *SyntheticCheckReconciler) RemoveApiEndpointAndDataset(_ context.Context, _ *logr.Logger)

func (*SyntheticCheckReconciler) RemoveAuthToken

func (r *SyntheticCheckReconciler) RemoveAuthToken(_ context.Context, _ *logr.Logger)

func (*SyntheticCheckReconciler) SetApiEndpointAndDataset

func (r *SyntheticCheckReconciler) SetApiEndpointAndDataset(
	ctx context.Context,
	apiConfig *ApiConfig,
	logger *logr.Logger)

func (*SyntheticCheckReconciler) SetAuthToken

func (r *SyntheticCheckReconciler) SetAuthToken(
	ctx context.Context,
	authToken string,
	logger *logr.Logger)

func (*SyntheticCheckReconciler) SetupWithManager

func (r *SyntheticCheckReconciler) SetupWithManager(mgr manager.Manager) error

func (*SyntheticCheckReconciler) ShortName

func (r *SyntheticCheckReconciler) ShortName() string

func (*SyntheticCheckReconciler) WriteSynchronizationResultToSynchronizedResource

func (r *SyntheticCheckReconciler) WriteSynchronizationResultToSynchronizedResource(
	ctx context.Context,
	synchronizedResource client.Object,
	status dash0common.Dash0ApiResourceSynchronizationStatus,
	validationIssues []string,
	synchronizationError string,
	logger *logr.Logger,
)

type ThirdPartyCrdReconciler

type ThirdPartyCrdReconciler interface {
	handler.TypedEventHandler[client.Object, reconcile.Request]
	reconcile.TypedReconciler[reconcile.Request]

	Manager() ctrl.Manager
	KindDisplayName() string
	Group() string
	Kind() string
	Version() string
	QualifiedKind() string
	ControllerName() string
	DoesCrdExist() *atomic.Bool
	SetCrdExists(bool)
	SkipNameValidation() bool
	OperatorManagerIsLeader() bool
	CreateThirdPartyResourceReconciler(types.UID)
	ThirdPartyResourceReconciler() ThirdPartyResourceReconciler
}

ThirdPartyCrdReconciler is an interface for reconcilers that act on CRDs of third-party resource types (i.e. when a particular CRD is deployed to the cluster or removed).

type ThirdPartyResourceReconciler

type ThirdPartyResourceReconciler interface {
	ApiSyncReconciler

	handler.TypedEventHandler[*unstructured.Unstructured, reconcile.Request]
	reconcile.TypedReconciler[reconcile.Request]

	IsSynchronizationEnabled(*dash0v1beta1.Dash0Monitoring) bool
	ControllerStopFunctionLock() *sync.Mutex
	GetControllerStopFunction() *context.CancelFunc
	SetControllerStopFunction(*context.CancelFunc)
	IsWatching() bool

	Queue() *workqueue.Typed[ThirdPartyResourceSyncJob]

	// FetchExistingResourceOriginsRequest creates an HTTP request for retrieving the existing origins from the Dash0
	// API for a given Kubernetes resource.
	// FetchExistingResourceOriginsRequest is only used for resource types where one Kubernetes resource (say, a
	// PrometheusRule) is potentially associated with multiple Dash0 api objects (multiple checks). Controllers
	// which manage objects with a one-to-one relation (like Perses dashboards) should return nil, nil.
	FetchExistingResourceOriginsRequest(*preconditionValidationResult) (*http.Request, error)

	// CreateDeleteRequests produces an HTTP DELETE requests for the resources that still exist in Dash0, but should
	// not. It does so by comparing the list of IDs of objects that exist in the Dash0 backend with the list
	// of IDs found in a given Kubernetes resource. This mechanism is only used for resource types where one Kubernetes
	// resource (say, a PrometheusRule) is potentially associated with multiple Dash0 api objects (multiple checks).
	// Controllers which manage objects with a one-to-one relation (like Perses dashboards, synthetic checks, view)
	// should return nil, nil.
	CreateDeleteRequests(*preconditionValidationResult, []string, []string, *logr.Logger) ([]HttpRequestWithItemName, map[string]string)

	// UpdateSynchronizationResultsInDash0MonitoringStatus Modifies the status of the provided Dash0Monitoring resource
	// to reflect the results of the synchronization operation for one third-party Kubernetes resource.
	UpdateSynchronizationResultsInDash0MonitoringStatus(
		monitoringResource *dash0v1beta1.Dash0Monitoring,
		qualifiedName string,
		status dash0common.ThirdPartySynchronizationStatus,
		itemsTotal int,
		successfullySynchronized []string,
		synchronizationErrorsPerItem map[string]string,
		validationIssuesPerItem map[string][]string,
	) interface{}
}

ThirdPartyResourceReconciler extends the ApiSyncReconciler interface with methods that are specific to reconcilers for third-party resource types (like Perses dashboards or Prometheus rules).

type ThirdPartyResourceSyncJob

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

type ViewReconciler

type ViewReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func NewViewReconciler

func NewViewReconciler(
	k8sClient client.Client,
	pseudoClusterUid types.UID,
	leaderElectionAware util.LeaderElectionAware,
	httpClient *http.Client,
) *ViewReconciler

func (*ViewReconciler) ControllerName

func (r *ViewReconciler) ControllerName() string

func (*ViewReconciler) GetApiConfig

func (r *ViewReconciler) GetApiConfig() *atomic.Pointer[ApiConfig]

func (*ViewReconciler) GetAuthToken

func (r *ViewReconciler) GetAuthToken() string

func (*ViewReconciler) GetHttpRetryDelay

func (r *ViewReconciler) GetHttpRetryDelay() time.Duration

func (*ViewReconciler) HttpClient

func (r *ViewReconciler) HttpClient() *http.Client

func (*ViewReconciler) InitializeSelfMonitoringMetrics

func (r *ViewReconciler) InitializeSelfMonitoringMetrics(
	meter otelmetric.Meter,
	metricNamePrefix string,
	logger *logr.Logger,
)

func (*ViewReconciler) K8sClient

func (r *ViewReconciler) K8sClient() client.Client

func (*ViewReconciler) KindDisplayName

func (r *ViewReconciler) KindDisplayName() string

func (*ViewReconciler) MapResourceToHttpRequests

func (r *ViewReconciler) MapResourceToHttpRequests(
	preconditionChecksResult *preconditionValidationResult,
	action apiAction,
	logger *logr.Logger,
) (int, []HttpRequestWithItemName, []string, map[string][]string, map[string]string)

func (*ViewReconciler) NotifiyOperatorManagerJustBecameLeader

func (r *ViewReconciler) NotifiyOperatorManagerJustBecameLeader(ctx context.Context, logger *logr.Logger)

func (*ViewReconciler) Reconcile

func (*ViewReconciler) RemoveApiEndpointAndDataset

func (r *ViewReconciler) RemoveApiEndpointAndDataset(_ context.Context, _ *logr.Logger)

func (*ViewReconciler) RemoveAuthToken

func (r *ViewReconciler) RemoveAuthToken(_ context.Context, _ *logr.Logger)

func (*ViewReconciler) SetApiEndpointAndDataset

func (r *ViewReconciler) SetApiEndpointAndDataset(
	ctx context.Context,
	apiConfig *ApiConfig,
	logger *logr.Logger)

func (*ViewReconciler) SetAuthToken

func (r *ViewReconciler) SetAuthToken(
	ctx context.Context,
	authToken string,
	logger *logr.Logger)

func (*ViewReconciler) SetupWithManager

func (r *ViewReconciler) SetupWithManager(mgr manager.Manager) error

func (*ViewReconciler) ShortName

func (r *ViewReconciler) ShortName() string

func (*ViewReconciler) WriteSynchronizationResultToSynchronizedResource

func (r *ViewReconciler) WriteSynchronizationResultToSynchronizedResource(
	ctx context.Context,
	synchronizedResource client.Object,
	status dash0common.Dash0ApiResourceSynchronizationStatus,
	validationIssues []string,
	synchronizationError string,
	logger *logr.Logger,
)

Jump to

Keyboard shortcuts

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