kronosapp

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfSecretContainsData

func CheckIfSecretContainsData(secret *corev1.Secret) error

func CheckIfSecretContainsDataOfKind

func CheckIfSecretContainsDataOfKind(secret *corev1.Secret, kind string) bool

func FetchAndFilter

func FetchAndFilter(ctx context.Context, Client client.Client, objectList *ObjectList, apiVersion, kind, includeRef, excludeRef, namespace string) error

func IsInArray

func IsInArray(arr []string, target string) bool

func IsItHoliday

func IsItHoliday(schedule SleepSchedule) (bool, time.Duration)

func IsTimeToSleep

func IsTimeToSleep(schedule SleepSchedule, kronosapp *v1alpha1.KronosApp) (bool, bool, time.Duration, error)

func SaveObjectsData

func SaveObjectsData(ctx context.Context, Client client.Client, secret *corev1.Secret, kind string, resourceList []object.ResourceInt) error

func ValidateIncludedObjects

func ValidateIncludedObjects(includedObjects []v1alpha1.IncludedObject) (map[int][]bool, error)

func WakeUpResources

func WakeUpResources(ctx context.Context, Client client.Client, secret *corev1.Secret) error

func WriteChanges

func WriteChanges(ctx context.Context, Client client.Client, secret *corev1.Secret, list []object.ResourceInt, resourceKind string, failedObjects []string, failedObjectsSleepActions map[string][]string) error

Types

type APIVersionKindMap

type APIVersionKindMap struct {
	Mapping map[string][]string
}

func NewAPIVersionKindMap

func NewAPIVersionKindMap(input map[string][]string) *APIVersionKindMap

func NewEmptyAPIVersionKindMap

func NewEmptyAPIVersionKindMap() *APIVersionKindMap

func (*APIVersionKindMap) Add

func (m *APIVersionKindMap) Add(apiVersion, kind string)

func (*APIVersionKindMap) GetAPIVersion

func (m *APIVersionKindMap) GetAPIVersion(kind string) string

func (*APIVersionKindMap) GetKind

func (m *APIVersionKindMap) GetKind(apiVersion string) []string

func (*APIVersionKindMap) KindExists

func (m *APIVersionKindMap) KindExists(kind string) bool

type KronosAppReconciler

type KronosAppReconciler struct {
	client.Client
	Scheme  *runtime.Scheme
	Metrics Metrics
}

KronosAppReconciler reconciles a KronosApp object

func (*KronosAppReconciler) Reconcile

func (r *KronosAppReconciler) 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. TODO(user): Modify the Reconcile function to compare the state specified by the KronosApp object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile

func (*KronosAppReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type Metrics

type Metrics struct {
	ScheduleInfo        *prometheus.GaugeVec
	InDepthScheduleInfo *prometheus.GaugeVec
}

func RegisterMetrics

func RegisterMetrics() Metrics

func (Metrics) MustRegister

func (additionalMetrics Metrics) MustRegister(registry metrics.RegistererGatherer) Metrics

type ObjectList

type ObjectList struct {
	Deployments  *appsv1.DeploymentList
	StatefulSets *appsv1.StatefulSetList
	ReplicaSets  *appsv1.ReplicaSetList
	CronJobs     *batchv1.CronJobList
}

func FetchIncludedObjects

func FetchIncludedObjects(ctx context.Context, Client client.Client, includedObjects []v1alpha1.IncludedObject, inclusive map[int][]bool) (ObjectList, error)

func (*ObjectList) GetObjectsCount

func (objectList *ObjectList) GetObjectsCount() map[string]int

func (*ObjectList) GetObjectsNames

func (objectList *ObjectList) GetObjectsNames() map[string][]string

func (*ObjectList) GetObjectsTotalCount

func (objectList *ObjectList) GetObjectsTotalCount() int

type Set

type Set map[string]struct{}

func (Set) Add

func (s Set) Add(element string)

func (Set) Contains

func (s Set) Contains(element string) bool

type SleepSchedule

type SleepSchedule struct {
	StartSleep time.Time
	EndSleep   time.Time
	Weekdays   []time.Weekday
	Timezone   *time.Location
	Holidays   map[string][]time.Time
	// contains filtered or unexported fields
}

func NewSleepSchedule

func NewSleepSchedule(startSleep, endSleep string, weekDays string, timezone string, holidays []v1alpha1.Holiday) (*SleepSchedule, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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