Documentation
¶
Index ¶
- Constants
- Variables
- func AddFinalizer(ctx context.Context, object client.Object, finalizerName string) (ctrl.Result, error)
- func AppendHyphenAndPercentageSToString(stringToAppend string) string
- func AppendHyphenToString(stringToAppend string) string
- func ArrayToString(arr []string) string
- func CheckDuplicateInArray(data []string) (bool, []string)
- func CheckForProjectNamespace(namespace *corev1.Namespace) bool
- func CleanupDeleteResource(ctx context.Context, object client.Object) error
- func CleanupUpdateResource(ctx context.Context, object client.Object) error
- func CleanupUpdateStatus(ctx context.Context, object client.Object) error
- func CompareAnnotations(annotations1 map[string]string, annotations2 map[string]string) bool
- func CompareLabels(label1 map[string]string, label2 map[string]string) bool
- func ContainsString(strings []string, t string) bool
- func CreateResource(ctx context.Context, object client.Object) error
- func CtxClient(ctx context.Context) client.Client
- func CtxEventRecorder(ctx context.Context) events.EventRecorder
- func CtxLogger(ctx context.Context) *zap.SugaredLogger
- func CtxScheme(ctx context.Context) *runtime.Scheme
- func DeleteResource(ctx context.Context, object client.Object) error
- func DifferenceOfArray(a, b []string) (diff []string)
- func EncodeToBase64(v interface{}) (string, error)
- func FilterLabelsAndAnnotations(data map[string]string) map[string]string
- func FindCIDRByMaxClusters(maxCluster int) string
- func GetClusterPrefixPool(sliceSubnet string, ipamInt int, subnetCidr string) string
- func GetKubeSliceControllerRequestContext(ctx context.Context) *kubeSliceControllerRequestContext
- func GetObjectKind(obj runtime.Object) string
- func GetOwnerLabel(completeResourceName string) map[string]string
- func GetProjectName(namespace string) string
- func GetResourceIfExist(ctx context.Context, namespacedName client.ObjectKey, object client.Object) (bool, error)
- func GetZapLogLevel(userLogLevel string) zapcore.Level
- func HasLastTwoOctetsZero(subnet string) bool
- func HasPrefix(subnet string, prefix string) bool
- func IsDNSCompliant(name string) bool
- func IsInSlice(slice []string, element string) bool
- func IsPrivateSubnet(subnet string) bool
- func IsReconciled(object ctrl.Result, err error) (bool, ctrl.Result, error)
- func ListResources(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
- func NewLogger() *uzap.SugaredLogger
- func OverlapIP(ip1, ip2 string) bool
- func PrepareKubeSliceControllersRequestContext(ctx context.Context, client client.Client, scheme *runtime.Scheme, ...) context.Context
- func RecordEvent(ctx context.Context, recorder events.EventRecorder, object runtime.Object, ...)
- func RemoveDuplicatesFromArray(duplicate []string) (nonDup []string)
- func RemoveElementFromArray(slice []string, element string) (arr []string)
- func RemoveFinalizer(ctx context.Context, object client.Object, finalizerName string) (ctrl.Result, error)
- func Resource(resource string) schema.GroupResource
- func Retry(ctx context.Context, backoffLimit int, sleep time.Duration, f func() error) (err error)
- func UpdateResource(ctx context.Context, object client.Object) error
- func UpdateStatus(ctx context.Context, object client.Object) error
- func ValidateCoOrdinates(latitude string, longitude string) bool
- type WorkerSliceGatewayNetworkAddresses
Constants ¶
const ( Tick = string(rune(0x2705)) Err = string(rune(0x1F6AB)) Sad = string(rune(0x1F613)) Wait = string(rune(0x23F3)) Watch = string(rune(0x1F440)) Find = string(rune(0x1F50D)) Bin = string(rune(0x1F5D1)) Recycle = string(rune(0x267D)) Party = string(rune(0x1F389)) )
const ( ComponentController = "controller" InstanceController = "controller" ClusterController = "controller" )
const ( DefaultSliceQOSConfigName = "default" DefaultProjectSliceName = "%s-default-slice" )
const ( LabelProjectName = "kubeslice.io/project" LabelProjectNamespace = "kubeslice-project-namespace" // LabelProjectNamespace = "kubeslice.io/project-namespace" // TODO: implement this later LabelManagedBy = "kubeslice-controller-resource-name" // LabelManagedBy = "kubeslice.io/managed-by" // TODO: implement this later LabelResourceOwner = "kubeslice-resource-owner" )
const (
LabelValueResourceOwner = "kubeslice-controller"
)
const (
NotApplicable = "NA"
)
const ProjectKind = "Project"
Variables ¶
var ( LabelName = LabelManagedBy LabelValue = "%s-%s" NamespacePrefix = "kubeslice-" )
var ( LabelsKubeSliceController = map[string]string{ LabelResourceOwner: LabelValueResourceOwner, } )
var Loglevel zapcore.Level
var LoglevelString string
Functions ¶
func AddFinalizer ¶
func AddFinalizer(ctx context.Context, object client.Object, finalizerName string) (ctrl.Result, error)
AddFinalizer is a function to add specific conditions before deleting the resource
func AppendHyphenAndPercentageSToString ¶
AppendHyphenAndPercentageSToString is a function to add hyphen and % at the end of string
func AppendHyphenToString ¶
AppendHyphenToString is a function add hyphen at the end of string
func ArrayToString ¶ added in v0.2.1
func CheckDuplicateInArray ¶
CheckDuplicateInArray check duplicate data in array
func CheckForProjectNamespace ¶ added in v0.5.3
CheckForProjectNamespace is a function to check namespace is in decided format
func CleanupDeleteResource ¶ added in v0.6.3
DeleteResource is a function to delete the resource of given kind
func CleanupUpdateResource ¶ added in v0.6.3
UpdateResource is a function to update resource
func CleanupUpdateStatus ¶ added in v0.6.3
UpdateStatus is a function to update the status of given resource
func CompareAnnotations ¶ added in v1.7.0
CompareAnnotations is a function to compare the annotations
func CompareLabels ¶ added in v1.5.7
CompareLabels is a function to compare the labels
func ContainsString ¶
ContainsString is a function to check if the given string is in given array
func CreateResource ¶
CreateResource is a function to create the given kind of resource if not exist in namepscae
func CtxEventRecorder ¶ added in v0.8.4
func CtxEventRecorder(ctx context.Context) events.EventRecorder
CtxEventRecorder is a function to get the EventRecorder
func CtxLogger ¶
func CtxLogger(ctx context.Context) *zap.SugaredLogger
CtxLogger is a function to get the logs
func DeleteResource ¶
DeleteResource is a function to delete the resource of given kind
func DifferenceOfArray ¶ added in v0.11.0
Set Difference: A - B
func EncodeToBase64 ¶
EncodeToBase64 is a function to encode the string
func FilterLabelsAndAnnotations ¶ added in v1.7.0
func FindCIDRByMaxClusters ¶ added in v0.5.3
FindCIDRByMaxClusters is a function to find the CIDR by max clusters
func GetClusterPrefixPool ¶ added in v0.5.3
func GetKubeSliceControllerRequestContext ¶
GetKubeSliceControllerRequestContext is a function to get the request context
func GetObjectKind ¶
GetObjectKindis a function which return the kind of existing resource
func GetOwnerLabel ¶
GetOwnerLabel is a function returns the label of object
func GetProjectName ¶ added in v0.7.1
GetProjectName is function to get the project name from the namespace
func GetResourceIfExist ¶
func GetResourceIfExist(ctx context.Context, namespacedName client.ObjectKey, object client.Object) (bool, error)
GetResourceIfExist is a function to get the given resource is in namespace
func GetZapLogLevel ¶
GetZapLogLevel is function to add the layer of debug, error, info in logging
func HasLastTwoOctetsZero ¶
HasLastTwoOctetsZero is a function to check if the subnet address's last octet is 0
func IsDNSCompliant ¶
IsDNSCompliant is a function to check if the given string/name is DNS compliant
func IsPrivateSubnet ¶
IsPrivateSubnet function for check if prefix matches any item in a slice
func IsReconciled ¶
IsReconciled is a function to requeue the reconcilation process
func ListResources ¶
func ListResources(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
ListResources is a function to list down the resources/objects of given kind
func NewLogger ¶ added in v0.6.0
func NewLogger() *uzap.SugaredLogger
NewLogger Creates a new SugaredLogger instance with predefined standard fields SugaredLogger makes it easy to use structured logging with logging levels and additional fields
func PrepareKubeSliceControllersRequestContext ¶
func PrepareKubeSliceControllersRequestContext(ctx context.Context, client client.Client, scheme *runtime.Scheme, controllerName string, er *events.EventRecorder) context.Context
PrepareKubeSliceControllersRequestContext is a function to create the context for kube slice
func RecordEvent ¶ added in v0.7.1
func RecordEvent(ctx context.Context, recorder events.EventRecorder, object runtime.Object, relatedObject runtime.Object, name events.EventName)
RecordEvent is a function to record the event
func RemoveDuplicatesFromArray ¶ added in v0.2.1
func RemoveElementFromArray ¶ added in v1.6.0
func RemoveFinalizer ¶
func RemoveFinalizer(ctx context.Context, object client.Object, finalizerName string) (ctrl.Result, error)
RemoveFinalizer is a function to discard the condition to delete the resource
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource is a function returns the resource for testing
func Retry ¶ added in v0.6.3
Retry tries to execute the funtion, If failed reattempts till backoffLimit
func UpdateResource ¶
UpdateResource is a function to update resource
func UpdateStatus ¶
UpdateStatus is a function to update the status of given resource