utils

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationsPrefix       = "cloudscaler.io"
	AnnotationsOrigValue    = "original-value"
	AnnotationsMinOrigValue = "min-original-value"
	AnnotationsMaxOrigValue = "max-original-value"
	PeriodType              = "period-type"
	PeriodStartTime         = "period-start-time"
	PeriodEndTime           = "period-end-time"
	PeriodTimezone          = "period-timezone"
)

Variables

View Source
var (
	DefaultExcludeNamespaces = []string{"kube-system"}
)

Functions

func AddBoolAnnotations added in v1.2.0

func AddBoolAnnotations(annot map[string]string, curPeriod *periodPkg.Period, value bool) map[string]string

func AddIntAnnotations added in v1.2.0

func AddIntAnnotations(annot map[string]string, curPeriod *periodPkg.Period, value *int32) map[string]string

func AddMinMaxAnnotations added in v1.2.1

func AddMinMaxAnnotations(annot map[string]string, curPeriod *periodPkg.Period, min *int32, max int32) map[string]string

func PrepareSearch

func PrepareSearch(ctx context.Context, config *Config) ([]string, metaV1.ListOptions, error)

func RemoveAnnotations

func RemoveAnnotations(annotations map[string]string) map[string]string

func RestoreBoolAnnotations added in v1.2.1

func RestoreBoolAnnotations(annot map[string]string) (bool, *bool, map[string]string, error)

func RestoreIntAnnotations added in v1.2.1

func RestoreIntAnnotations(annot map[string]string) (bool, *int32, map[string]string, error)

func RestoreMinMaxAnnotations added in v1.2.1

func RestoreMinMaxAnnotations(annot map[string]string) (bool, *int32, int32, map[string]string, error)

func SetNamespaceList

func SetNamespaceList(ctx context.Context, config *Config) ([]string, error)

We set namespaces into resources to be able to use k8s client

Types

type Config

type Config struct {
	Namespaces                   []string              `json:"namespaces,omitempty"`
	ExcludeNamespaces            []string              `json:"excludeNamespaces,omitempty"`
	Client                       *kubernetes.Clientset `json:"client"`
	LabelSelector                *metaV1.LabelSelector `json:"labelSelector,omitempty"`
	Period                       *periodPkg.Period     `json:"period,omitempty"`
	ForceExcludeSystemNamespaces bool                  `json:"forceExcludeSystemNamespaces,omitempty"`
}

type K8sResource

type K8sResource struct {
	NsList      []string
	ListOptions metaV1.ListOptions
	Period      *periodPkg.Period `json:"period,omitempty"`
}

func InitConfig added in v1.0.3

func InitConfig(ctx context.Context, config *Config) (*K8sResource, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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