Documentation ¶
Index ¶
- func AddToWorkqueue(workqueue workqueue.Interface, req *generalpb.ResourceId) (*emptypb.Empty, error)
- func AppendDynamicScenariosByCategories(ctx context.Context, scenariosList []string, categories []string, ...) []string
- func ContainsFinalizer(finalizers []string, finalizer string) bool
- func ConvertIntMap[T, U IntegerType](input map[string]T) map[string]U
- func ConvertMapStruct[K comparable, V any, T any](input map[string]T, getMapFunc func(T) map[K]V) map[string]map[K]V
- func ConvertToStringMapSlice(stringMapSlice []*generalpb.StringMap) []map[string]string
- func ConvertToStringMapStructMap(in map[string]map[string]string) map[string]*generalpb.StringMap
- func CountMachinesPerTemplateAndEnvironment(ctx context.Context, vmClient vmpb.VMSvcClient, template string, ...) (int, error)
- func CountMachinesPerTemplateAndEnvironmentAndScheduledEvent(ctx context.Context, vmClient vmpb.VMSvcClient, template string, ...) (int, error)
- func DeleteHfCollection(ctx context.Context, listOptions *generalpb.ListOptions, ...) (*emptypb.Empty, error)
- func DeleteHfResource(ctx context.Context, req *generalpb.ResourceId, clientDelete HfClientDelete, ...) (*emptypb.Empty, error)
- func EnsureVMNotReady(hfClientset hfClientset.Interface, vmLister v1.VirtualMachineLister, ...) error
- func FilterByCourse(se *scheduledeventpb.ScheduledEvent, course string) bool
- func FilterByScenario[T ScenarioProvider](obj T, scenario string) bool
- func FilterScheduledEvents(objId string, seList *scheduledeventpb.ListScheduledEventsResponse, ...) []*scheduledeventpb.ScheduledEvent
- func FilterSessions(objId string, sessList *sessionpb.ListSessionsResponse, ...) []*sessionpb.Session
- func GenKeyPair() (string, string, error)
- func GenerateResourceName(prefix string, input string, hashlength int) string
- func GenericHfGetter[T metav1.Object, G HfClientGet[T], C GenericCacheRetriever[T]](ctx context.Context, req *generalpb.GetRequest, getter G, cacheGetter C, ...) (T, error)
- func GenericUnmarshal[T any](rawObj string, propName string) (T, error)
- func GetDurationWithDays(s string) (string, error)
- func GetHTTPErrorCode(httpStatus int) string
- func GetLock(lockName string, cfg *rest.Config) (resourcelock.Interface, error)
- func GetOwnerReferences[T metav1.Object, G HfClientGet[T], C GenericCacheRetriever[T]](ctx context.Context, req *generalpb.GetRequest, getter G, cacheGetter C, ...) (*generalpb.OwnerReferences, error)
- func GetProtoMarshaller() protojson.MarshalOptions
- func GetRawStringMap(val *generalpb.StringMap) map[string]string
- func GetRawVMTemplateCountMap(val *scheduledeventpb.VMTemplateCountMap) map[string]uint32
- func GetReleaseNamespace() string
- func GetVMConfig(env *environmentpb.Environment, vmt *vmtemplatepb.VMTemplate) map[string]string
- func IsSessionOfCourse(sess *sessionpb.Session, course string) bool
- func IsSessionOfScenario(sess *sessionpb.Session, scenario string) bool
- func ListByCache[T any, L GenericLister[T]](listOptions *generalpb.ListOptions, lister L, resourcename string, ...) ([]T, error)
- func ListByHfClient[T any, L HfClientList[T]](ctx context.Context, listOptions *generalpb.ListOptions, lister L, ...) (T, error)
- func MaxUint32(x, y uint32) uint32
- func RandStringRunes(n int) string
- func RemoveFinalizer(finalizers []string, finalizer string) []string
- func ResourceVersionAtLeast(curr, min string) bool
- func ReturnHTTPContent(w http.ResponseWriter, r *http.Request, httpStatus int, messageType string, ...)
- func ReturnHTTPMessage(w http.ResponseWriter, r *http.Request, httpStatus int, messageType string, ...)
- func ReturnHTTPRaw(w http.ResponseWriter, r *http.Request, content string)
- func StringPtr(s string) *string
- func UniqueStringSlice(stringSlice []string) []string
- func Verify[T metav1.Object, C GenericCacheRetriever[T]](getter C, object T, timeout time.Duration) error
- func VerifyDeletion(ctx context.Context, clientWatch HfClientWatch, resourceId string) error
- func VerifySession(sLister v1.SessionLister, s *hfv1.Session) error
- func VerifyTaskContent(vm_tasks []hfv1.VirtualMachineTasks, request proto.Message) error
- func VerifyVM(vmLister v1.VirtualMachineLister, vm *hfv1.VirtualMachine) error
- func VerifyVMClaim(vmClaimLister v1.VirtualMachineClaimLister, vmc *hfv1.VirtualMachineClaim) error
- func VerifyVMDeleted(vmLister v1.VirtualMachineLister, vm *hfv1.VirtualMachine) error
- func VerifyVMSet(vmSetLister v1.VirtualMachineSetLister, vms *hfv1.VirtualMachineSet) error
- func VirtualMachinesUsedDuringPeriod(eventClient scheduledeventpb.ScheduledEventSvcClient, environment string, ...) (map[time.Time]map[string]uint32, map[string]uint32, error)
- type ByTime
- type EventFilterfunc
- type GenericCacheRetriever
- type GenericLister
- type HTTPContent
- type HTTPMessage
- type HfClientDelete
- type HfClientGet
- type HfClientList
- type HfClientWatch
- type IntegerType
- type Range
- type ScenarioProvider
- type SessionFilterfunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToWorkqueue ¶ added in v3.2.0
func AppendDynamicScenariosByCategories ¶ added in v3.2.0
func AppendDynamicScenariosByCategories( ctx context.Context, scenariosList []string, categories []string, listScenariosFunc func(ctx context.Context, in *generalpb.ListOptions) (*scenariopb.ListScenariosResponse, error), ) []string
func ContainsFinalizer ¶ added in v3.2.0
ContainsFinalizer checks an Object that the provided finalizer is present.
func ConvertIntMap ¶ added in v3.2.0
func ConvertIntMap[T, U IntegerType](input map[string]T) map[string]U
A function that converts an integer type T to an integer type U
func ConvertMapStruct ¶ added in v3.2.0
func ConvertMapStruct[K comparable, V any, T any](input map[string]T, getMapFunc func(T) map[K]V) map[string]map[K]V
A helper function that converts nested maps containing a struct with a map field into raw nested maps. E. g., it can convert map[string]*generalpb.StringMap to map[string]map[string]string. To make this work generic, we additionally need to pass a function which retrieves the raw map from our struct value. E. g., GetRawStringMap retrieves the raw map[string]string from *generalpb.StringMap.
func ConvertToStringMapSlice ¶ added in v3.2.0
A function that converts []*generalpb.StringMap to []map[string]string
func ConvertToStringMapStructMap ¶ added in v3.2.0
A function that converts map[string]map[string]string to map[string]*generalpb.StringMap
func DeleteHfCollection ¶ added in v3.2.0
func DeleteHfCollection( ctx context.Context, listOptions *generalpb.ListOptions, clientDelete HfClientDelete, resourceName string, ) (*emptypb.Empty, error)
func DeleteHfResource ¶ added in v3.2.0
func DeleteHfResource( ctx context.Context, req *generalpb.ResourceId, clientDelete HfClientDelete, resourceName string, ) (*emptypb.Empty, error)
func EnsureVMNotReady ¶
func EnsureVMNotReady(hfClientset hfClientset.Interface, vmLister v1.VirtualMachineLister, vmName string, ctx context.Context) error
func FilterByCourse ¶ added in v3.2.0
func FilterByCourse(se *scheduledeventpb.ScheduledEvent, course string) bool
Specific filter function for courses
func FilterByScenario ¶ added in v3.2.0
func FilterByScenario[T ScenarioProvider](obj T, scenario string) bool
Specific filter function for scenarios
func FilterScheduledEvents ¶ added in v3.2.0
func FilterScheduledEvents( objId string, seList *scheduledeventpb.ListScheduledEventsResponse, filterFunc EventFilterfunc, ) []*scheduledeventpb.ScheduledEvent
Filter a ScheduledEventList to find SEs that are a) active and b) using the course/scenario specified
func FilterSessions ¶ added in v3.2.0
func FilterSessions( objId string, sessList *sessionpb.ListSessionsResponse, filterFunc SessionFilterfunc, ) []*sessionpb.Session
func GenKeyPair ¶
func GenerateResourceName ¶
func GenericHfGetter ¶ added in v3.2.0
func GenericHfGetter[T metav1.Object, G HfClientGet[T], C GenericCacheRetriever[T]]( ctx context.Context, req *generalpb.GetRequest, getter G, cacheGetter C, resourceName string, hasSynced bool, ) (T, error)
func GenericUnmarshal ¶ added in v3.2.0
func GetDurationWithDays ¶ added in v3.2.0
This Method converts a given duration into a valid duration for time.ParseDuration. time.ParseDuration does not accept "d" for days
func GetHTTPErrorCode ¶
func GetOwnerReferences ¶ added in v3.2.0
func GetOwnerReferences[T metav1.Object, G HfClientGet[T], C GenericCacheRetriever[T]]( ctx context.Context, req *generalpb.GetRequest, getter G, cacheGetter C, resourceName string, hasSynced bool, ) (*generalpb.OwnerReferences, error)
func GetProtoMarshaller ¶
func GetProtoMarshaller() protojson.MarshalOptions
func GetRawStringMap ¶ added in v3.2.0
func GetRawVMTemplateCountMap ¶ added in v3.2.0
func GetRawVMTemplateCountMap(val *scheduledeventpb.VMTemplateCountMap) map[string]uint32
func GetReleaseNamespace ¶
func GetReleaseNamespace() string
func GetVMConfig ¶
func GetVMConfig(env *environmentpb.Environment, vmt *vmtemplatepb.VMTemplate) map[string]string
func IsSessionOfCourse ¶ added in v3.2.0
Returns true if session is assigned to the provided course
func IsSessionOfScenario ¶ added in v3.2.0
Returns true if session is assigned to the provided scenario
func ListByCache ¶ added in v3.2.0
func ListByCache[T any, L GenericLister[T]](listOptions *generalpb.ListOptions, lister L, resourcename string, hasSynced bool) ([]T, error)
func ListByHfClient ¶ added in v3.2.0
func ListByHfClient[T any, L HfClientList[T]](ctx context.Context, listOptions *generalpb.ListOptions, lister L, resourcename string) (T, error)
func RandStringRunes ¶
func RemoveFinalizer ¶ added in v3.2.0
RemoveFinalizer accepts a slice of finalizers and removes the provided finalizer if present.
func ResourceVersionAtLeast ¶
borrowed from longhorn
func ReturnHTTPContent ¶
func ReturnHTTPMessage ¶
func ReturnHTTPRaw ¶
func ReturnHTTPRaw(w http.ResponseWriter, r *http.Request, content string)
func UniqueStringSlice ¶
func VerifyDeletion ¶ added in v3.2.0
func VerifyDeletion(ctx context.Context, clientWatch HfClientWatch, resourceId string) error
func VerifySession ¶
func VerifySession(sLister v1.SessionLister, s *hfv1.Session) error
func VerifyTaskContent ¶ added in v3.2.0
func VerifyTaskContent(vm_tasks []hfv1.VirtualMachineTasks, request proto.Message) error
func VerifyVM ¶
func VerifyVM(vmLister v1.VirtualMachineLister, vm *hfv1.VirtualMachine) error
func VerifyVMClaim ¶
func VerifyVMClaim(vmClaimLister v1.VirtualMachineClaimLister, vmc *hfv1.VirtualMachineClaim) error
func VerifyVMDeleted ¶
func VerifyVMDeleted(vmLister v1.VirtualMachineLister, vm *hfv1.VirtualMachine) error
func VerifyVMSet ¶
func VerifyVMSet(vmSetLister v1.VirtualMachineSetLister, vms *hfv1.VirtualMachineSet) error
func VirtualMachinesUsedDuringPeriod ¶
func VirtualMachinesUsedDuringPeriod(eventClient scheduledeventpb.ScheduledEventSvcClient, environment string, startString string, endString string, ctx context.Context) (map[time.Time]map[string]uint32, map[string]uint32, error)
Calculates available virtualMachineTemplates for a given period (startString, endString) and environment Returns a map with timestamps and corresponding availability of virtualmachines. Also returns the maximum available count of virtualmachinetemplates over the whole duration.
Types ¶
type EventFilterfunc ¶ added in v3.2.0
type EventFilterfunc func(se *scheduledeventpb.ScheduledEvent, objId string) bool
Implemented by FilterByScenario and FilterByCourse
type GenericCacheRetriever ¶ added in v3.2.0
type GenericLister ¶ added in v3.2.0
type HTTPContent ¶
type HTTPMessage ¶
type HfClientDelete ¶ added in v3.2.0
type HfClientDelete interface { Delete(ctx context.Context, id string, opts metav1.DeleteOptions) error DeleteCollection(ctx context.Context, deleteOptions metav1.DeleteOptions, listOptions metav1.ListOptions) error }
type HfClientGet ¶ added in v3.2.0
type HfClientList ¶ added in v3.2.0
type HfClientWatch ¶ added in v3.2.0
type IntegerType ¶ added in v3.2.0
type ScenarioProvider ¶ added in v3.2.0
type ScenarioProvider interface {
GetScenarios() []string
}
ScenarioProvider is an interface for any object that can provide scenarios. E. g. ScheduledEvents or Courses.