Documentation ¶
Index ¶
- 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 ContainsString(strings []string, t string) bool
- func CreateResource(ctx context.Context, object client.Object) error
- func CtxLogger(ctx context.Context) *zap.SugaredLogger
- func DeleteResource(ctx context.Context, object client.Object) error
- func EncodeToBase64(v interface{}) (string, error)
- func GetKubeSliceControllerRequestContext(ctx context.Context) *kubeSliceControllerRequestContext
- func GetObjectKind(obj runtime.Object) string
- func GetOwnerLabel(completeResourceName string) map[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 OverlapIP(ip1, ip2 string) bool
- func PrepareKubeSliceControllersRequestContext(ctx context.Context, client Client, scheme *runtime.Scheme, ...) context.Context
- func RemoveDuplicatesFromArray(duplicate []string) (nonDup []string)
- func RemoveFinalizer(ctx context.Context, object client.Object, finalizerName string) (ctrl.Result, error)
- func Resource(resource string) schema.GroupResource
- func UpdateResource(ctx context.Context, object client.Object) error
- func UpdateStatus(ctx context.Context, object client.Object) error
- type Client
Constants ¶
This section is empty.
Variables ¶
var ( LabelName = "kubeslice-controller-resource-name" LabelValue = "%s-%s" NamespacePrefix = "kubeslice-" )
var (
LabelsKubeSliceController = map[string]string{
"kubeslice-resource-owner": "controller",
}
)
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 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 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 EncodeToBase64 ¶
EncodeToBase64 is a function to to encode the string
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 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 PrepareKubeSliceControllersRequestContext ¶
func PrepareKubeSliceControllersRequestContext(ctx context.Context, client Client, scheme *runtime.Scheme, controllerName string) context.Context
PrepareKubeSliceControllersRequestContext is a function to create the context for kube slice
func RemoveDuplicatesFromArray ¶ added in v0.2.1
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 UpdateResource ¶
UpdateResource is a function to update resource
Types ¶
type Client ¶
type Client interface { Get(ctx context.Context, key client.ObjectKey, obj client.Object) error List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error Status() client.StatusWriter }
Client is interface for k8s