util

package
v1.104.7 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 26 Imported by: 8

Documentation

Index

Constants

View Source
const (
	PasswordSecretName = "kotsadm-password"
	SessionsSecretName = "kotsadm-sessions"
)

Variables

View Source
var (
	PodNamespace           string = os.Getenv("POD_NAMESPACE")
	KotsadmTargetNamespace string = os.Getenv("KOTSADM_TARGET_NAMESPACE")
)

Functions

func AppNamespace

func AppNamespace() string

func Base64DecodeInterface added in v1.82.0

func Base64DecodeInterface(d interface{}) ([]byte, error)

func CommonSlicePrefix

func CommonSlicePrefix(first []string, second []string) []string

func CompareStringArrays

func CompareStringArrays(arr1, arr2 []string) bool

CompareStringArrays returns true if all elements in arr1 are present in arr2 and the other way around. it does not check for equal counts of duplicates, or for ordering.

func ConvertToSingleDocs

func ConvertToSingleDocs(doc []byte) [][]byte

func DecryptConfigValue added in v1.98.0

func DecryptConfigValue(input string) (string, error)

func ExtractTGZArchive

func ExtractTGZArchive(tgzFile string, destDir string) error

func FilesToTGZ added in v1.103.2

func FilesToTGZ(files map[string]string) ([]byte, error)

func GenPassword

func GenPassword(length int) string

generates a [0-9a-zA-Z] password of the specified length

func GetFileFromTGZArchive added in v1.84.0

func GetFileFromTGZArchive(archive *bytes.Buffer, fileName string) (*bytes.Buffer, error)

func GetFilesMap added in v1.96.0

func GetFilesMap(dir string) (map[string][]byte, error)

func GetReplicatedAPIEndpoint

func GetReplicatedAPIEndpoint() string

func GetValueFromMapPath added in v1.82.0

func GetValueFromMapPath(m interface{}, path []string) interface{}

func GunzipData added in v1.104.0

func GunzipData(input []byte) ([]byte, error)

func GzipData added in v1.104.0

func GzipData(input []byte) ([]byte, error)

func HomeDir

func HomeDir() string

func IntPointer

func IntPointer(x int) *int64

func IsHelmManaged

func IsHelmManaged() bool

func IsURL

func IsURL(str string) bool

func MarshalIndent

func MarshalIndent(indent int, in interface{}) ([]byte, error)

func NewRequest

func NewRequest(method string, url string, body io.Reader) (*http.Request, error)

NewRequest returns a http.Request object with kots defaults set, including a User-Agent header.

func NewThrottle

func NewThrottle(after time.Duration) func(f func())

func PromptForNewPassword added in v1.91.0

func PromptForNewPassword() (string, error)

func SplitStringOnLen

func SplitStringOnLen(str string, maxLength int) ([]string, error)

func SplitYAML added in v1.98.1

func SplitYAML(input []byte) (map[string][]byte, error)

func StrPointer added in v1.91.2

func StrPointer(s string) *string

func TGZArchive added in v1.96.0

func TGZArchive(dir string) ([]byte, error)

func TGZToFiles added in v1.103.2

func TGZToFiles(tgzBytes []byte) (map[string]string, error)

func TestGetenv

func TestGetenv(key string) string

func ThisImage added in v1.103.3

func ThisImage(ctx context.Context, client kubernetes.Interface) (string, error)

ThisImage looks for either a deployment 'kotsadm' or a statefulset 'kotsadm' in the current namespace it returns the image of the first container in the pod template

Types

type ActionableError

type ActionableError struct {
	NoRetry bool
	Message string
}

func (ActionableError) Error

func (e ActionableError) Error() string

type OverlySimpleGVK added in v1.98.1

type OverlySimpleGVK struct {
	APIVersion string               `yaml:"apiVersion"`
	Kind       string               `yaml:"kind"`
	Metadata   OverlySimpleMetadata `yaml:"metadata"`
}

type OverlySimpleMetadata added in v1.98.1

type OverlySimpleMetadata struct {
	Name      string `yaml:"name"`
	Namespace string `yaml:"namespace"`
}

Jump to

Keyboard shortcuts

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