common

package
v1.0.43 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultGrafanaServiceName = "grafana"

	DefaultGrafanaDashboardsPath = "/etc/grafana/provisioning/dashboards"

	DefaultGrafanaPort = int64(3000)

	DefaultAdvertisedAlertingServiceHost = "alerting-service"

	DefaultAdvertisedAlertingServicePort = "6666"
)

Grafana Section

View Source
const (
	// DefaultDataviewerName is the default name for the dataviewer service
	DefaultDataviewerName = "dataviewer"
)

DataViewer Section

View Source
const (
	// DefaultPrometheusName should be a fixed name because it is used within the Grafana configuration.
	// Otherwise, we should find a way to replace the value.
	DefaultPrometheusName = "prometheus"
)

Prometheus Section

Variables

View Source
var DefaultBackoffForK8sEndpoint = wait.Backoff{
	Duration: 1 * time.Second,
	Factor:   5,
	Jitter:   0.1,
	Steps:    3,
}

DefaultBackoffForK8sEndpoint is the default backoff for controller-to-k8s communication.

View Source
var DefaultBackoffForServiceEndpoint = wait.Backoff{
	Duration: 5 * time.Second,
	Factor:   2,
	Jitter:   0.1,
	Steps:    6,
}

DefaultBackoffForServiceEndpoint is the default backoff for controller-to-pod communication

Functions

func Create

func Create(ctx context.Context, reconciler Reconciler, parent, child client.Object) error

Create ignores existing objects. if the next reconciliation cycle happens faster than the API update, it is possible to reschedule the creation of a Job. To avoid that, get if the Job is already submitted.

func Delete

func Delete(ctx context.Context, reconciler Reconciler, obj client.Object)

Delete removes a Kubernetes object, ignoring the NotFound error. If any error exists, it is recorded in the reconciler's logger.

func ExternalEndpoint

func ExternalEndpoint(name, planName string) string

ExternalEndpoint creates an endpoint for accessing the service outside the cluster.

func GenerateName added in v1.0.24

func GenerateName(group metav1.Object, jobIndex int) string

GenerateName names the children of a given resource. The instances will be named as Master-1, Master-2, ... see https://github.com/CARV-ICS-FORTH/frisbee/issues/339

func InternalEndpoint

func InternalEndpoint(name string, planName string, port int64) string

InternalEndpoint creates an endpoint for accessing the service within the cluster.

func IsManagedByThisController

func IsManagedByThisController(obj metav1.Object, controller schema.GroupVersionKind) bool

IsManagedByThisController returns true if the object is managed by the specified controller. If it is managed by another controller, or no controller is being resolved, it returns false.

func ListChildren

func ListChildren(ctx context.Context, cli client.Client, childJobs client.ObjectList, req types.NamespacedName) error

func Reconcile

func Reconcile(parentCtx context.Context, r Reconciler, req ctrl.Request, obj client.Object, requeue *bool) (ctrl.Result, error)

Reconcile provides the most common functions for all the Reconcilers. That includes acquisition of the CR object

and management of the CR (Custom Resource) finalizers.

Bool indicate whether the caller should return immediately (true) or continue (false). The reconciliation cycle is where the framework gives us back control after a watch has passed up an event.

func RequeueAfter

func RequeueAfter(r Reconciler, req ctrl.Request, delay time.Duration) (ctrl.Result, error)

RequeueAfter will place the request in a queue, but it will be dequeue after the specified period.

func RequeueWithError

func RequeueWithError(r Reconciler, req ctrl.Request, err error) (ctrl.Result, error)

RequeueWithError will place the request in a queue, and will be immediately dequeued. State dequeuing the request, the controller will report the error.

func Stop

func Stop(r Reconciler, req ctrl.Request) (ctrl.Result, error)

func Update

func Update(ctx context.Context, reconciler Reconciler, obj client.Object) error

Update will update the metadata and the spec of the Object. If there is a conflict, it will retry again.

func UpdateStatus

func UpdateStatus(ctx context.Context, reconciler Reconciler, obj client.Object) error

UpdateStatus will update the status of the Object. If there is a conflict, it will retry again.

Types

type Logger added in v1.0.34

type Logger interface {
	// Info logs a non-error message with the given key/value pairs as context.
	// The level argument is provided for optional logging.  This method will
	// only be called when Enabled(level) is true. See Logger.Info for more
	// details.
	Info(msg string, keysAndValues ...interface{})

	// Error logs an error, with the given message and key/value pairs as
	// context.  See Logger.Error for more details.
	Error(err error, msg string, keysAndValues ...interface{})

	// WithValues returns a new LogSink with additional key/value pairs.  See
	// Logger.WithValues for more details.
	WithValues(keysAndValues ...interface{}) logr.Logger

	// WithName returns a new LogSink with the specified name appended.  See
	// Logger.WithName for more details.
	WithName(name string) logr.Logger
}

type Reconciler

type Reconciler interface {
	GetClient() client.Client
	GetCache() cache.Cache

	GetEventRecorderFor(name string) record.EventRecorder

	Logger

	// Finalizer returns a list of finalizers associated with the controller.
	Finalizer() string

	// Finalize handles termination logic of the object, such as performing backups and deleting resources.
	Finalize(object client.Object) error
}

Reconciler implements basic functionality that is common to every solid reconciler (e.g, finalizers).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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