utils

package
v0.0.0-...-b67a8fc Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyEndPointSliceWithRetry

func ApplyEndPointSliceWithRetry(client kubernetes.Interface, slice *discoveryv1.EndpointSlice) error

ApplyEndPointSliceWithRetry create or update existed slices.

func ContainsPrefix

func ContainsPrefix(slice []string, s string) bool

ContainsPrefix checks if a given slice of strings start with the provided string.

func ContainsString

func ContainsString(slice []string, s string) bool

ContainsString checks if a given slice of strings contains the provided string.

func CopyStrings

func CopyStrings(s []string) []string

CopyStrings copies the contents of the specified string slice into a new slice.

func CreateKubeConfigWithToken

func CreateKubeConfigWithToken(serverURL, token string, caCert []byte) *clientcmdapi.Config

CreateKubeConfigWithToken creates a KubeConfig object with access to the API server with a token

func DerivedName

func DerivedName(clusterID, namespace, seName string) string

func GenerateKubeConfigFromToken

func GenerateKubeConfigFromToken(serverURL, token string, caCert []byte) (*rest.Config, error)

GenerateKubeConfigFromToken composes a kubeconfig from token

func MaxInt

func MaxInt(a, b int) int

func MaxInt32

func MaxInt32(a, b int32) int32

func MinInt

func MinInt(a, b int) int

func MinInt32

func MinInt32(a, b int32) int32

func RemoveNonexistentEndpointslice

func RemoveNonexistentEndpointslice(
	srcLister discoverylisterv1.EndpointSliceLister,
	srcClusterID string,
	srcNamespace string,
	labelMap labels.Set,
	targetClient kubernetes.Interface,
	targetNamespace string,
	dstLabelMap labels.Set,
) ([]*discoveryv1.EndpointSlice, error)

func RemoveString

func RemoveString(slice []string, s string) []string

RemoveString returns a newly created []string that contains all items from slice that are not equal to s.

func ResourceNeedResync

func ResourceNeedResync(current pkgruntime.Object, modified pkgruntime.Object, ignoreAdd bool) bool

current is deployed resource, modified is changed resource. ignoreAdd is true if you want to ignore add action. The function will return the bool value to indicate whether to sync back the current object.

func SortStrings

func SortStrings(s []string) []string

SortStrings sorts the specified string slice in place. It returns the same slice that was provided in order to facilitate method chaining.

func SumArrayInt32

func SumArrayInt32(array []int32) (sum int32)

Types

This section is empty.

Jump to

Keyboard shortcuts

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