util

package
v1.14.5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppGitState  = ""
	AppGitCommit = ""
	AppVersion   = "canary"
)

This variable block holds information used to build up the version string

Functions

func Contains deprecated

func Contains(ss []string, s string) bool

Contains returns true if a string is contained in a string slice

Deprecated: Use slices#Contains instead

func EqualIPsUnsorted added in v1.8.0

func EqualIPsUnsorted(s1, s2 []net.IP) bool

EqualIPsUnsorted checks if the given slices of IP addresses contain the same elements, even if in a different order

func EqualKeyUsagesUnsorted added in v1.8.0

func EqualKeyUsagesUnsorted(s1, s2 []cmapi.KeyUsage) bool

Test for equal KeyUsage slices even if unsorted

func EqualOtherNamesUnsorted added in v1.14.0

func EqualOtherNamesUnsorted(s1, s2 []cmapi.OtherName) bool

Test for equal cmapi.OtherName slices even if unsorted. Panics if any element is nil

func EqualSorted deprecated added in v1.8.0

func EqualSorted(s1, s2 []string) bool

Deprecated: use slices#Equal instead

func EqualURLsUnsorted added in v1.8.0

func EqualURLsUnsorted(s1, s2 []*url.URL) bool

Test for equal URL slices even if unsorted. Panics if any element is nil

func EqualUnsorted

func EqualUnsorted(s1 []string, s2 []string) bool

func JoinWithEscapeCSV added in v1.12.0

func JoinWithEscapeCSV(in []string) (string, error)

JoinWithEscapeCSV returns the given list as a single line of CSV that is escaped with quotes if necessary

func OnlyOneNotNil deprecated

func OnlyOneNotNil(items ...interface{}) (any bool, one bool)

Deprecated: this function is no longer supported and will be removed in the future

func PrefixFromUserAgent added in v1.8.0

func PrefixFromUserAgent(u string) string

PrefixFromUserAgent takes the characters preceding the first /, quote unprintable character and then trim what's beyond the FieldManagerMaxLength limit. Taken from https://github.com/kubernetes/kubernetes/blob/9a75e7b0fd1b567f774a3373be640e19b33e7ef1/staging/src/k8s.io/apiserver/pkg/endpoints/handlers/create.go#L252

func RandStringRunes deprecated

func RandStringRunes(n int) string

RandStringRunes generates a pseudo-random string of length `n`.

Deprecated: Use k8s.io/apimachinery/pkg/util/rand#String instead

func RestConfigWithUserAgent added in v1.8.0

func RestConfigWithUserAgent(restConfig *rest.Config, component ...string) *rest.Config

RestConfigWithUserAgent returns a copy of the Kubernetes REST config with the User Agent set which includes the optional component strings given.

func SplitWithEscapeCSV added in v1.12.0

func SplitWithEscapeCSV(in string) ([]string, error)

SplitWithEscapeCSV parses the given input as a single line of CSV, which allows a comma-separated list of strings to be parsed while allowing commas to be present in each field. For example, a user can specify: "10 Downing Street, Westminster",Manchester to produce []string{"10 Downing Street, Westminster", "Manchester"}, keeping the comma in the first address. Empty lines or multiple CSV records are both rejected.

func Subset deprecated added in v1.8.0

func Subset(set, subset []string) bool

Subset returns true if one slice is an unsorted subset of the first.

Deprecated: Use k8s.io/apimachinery/pkg/util/sets#IsSuperset instead

Types

type Version added in v1.8.0

type Version struct {
	GitVersion   string `json:"gitVersion"`
	GitCommit    string `json:"gitCommit"`
	GitTreeState string `json:"gitTreeState"`
	GoVersion    string `json:"goVersion"`
	Compiler     string `json:"compiler"`
	Platform     string `json:"platform"`
}

func VersionInfo added in v1.8.0

func VersionInfo() Version

Directories

Path Synopsis
This file contains some code copied from the Go standard library under the following license: https://github.com/golang/go/blob/c95fe91d0715dc0a8d55ac80a80f383c3635548b/LICENSE
This file contains some code copied from the Go standard library under the following license: https://github.com/golang/go/blob/c95fe91d0715dc0a8d55ac80a80f383c3635548b/LICENSE

Jump to

Keyboard shortcuts

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