utils

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AnnotationsPrefix    = "cloudscaler.io"
	AnnotationsOrigValue = "original-value"
	NominalMinReplicas   = "nominal-min-replicas"
	NominalMaxReplicas   = "nominal-max-replicas"
	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 PrepareSearch

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

func RemoveAnnotations

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

func RestoreBool added in v1.2.0

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

func RestoreInt added in v1.2.0

func RestoreInt(annot map[string]string) (*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