utils

package
v1.9.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// DefaultKubeClusterDomain is the default value of KubeClusterDomain.
	DefaultKubeClusterDomain = "cluster.local"
)
View Source
const (
	// HostIPEnvVar is the environment variable to override host's chosen IP address.
	HostIPEnvVar = "DAPR_HOST_IP"
)

Variables

View Source
var (
	KubeConfigVar = "KUBE_CONFIG"
)

Functions

func Contains added in v1.9.0

func Contains[T comparable](s []T, v T) bool

Contains reports whether v is present in s. Similar to https://pkg.go.dev/golang.org/x/exp/slices#Contains.

func GetConfig

func GetConfig() *rest.Config

GetConfig gets a kubernetes rest config.

func GetEnvOrElse added in v1.9.0

func GetEnvOrElse(name, orElse string) string

GetEnvOrElse get the value from the OS environment or use the else value if variable is not present.

func GetHostAddress added in v0.8.0

func GetHostAddress() (string, error)

GetHostAddress selects a valid outbound IP address for the host.

func GetKubeClient

func GetKubeClient() *kubernetes.Clientset

GetKubeClient gets a kubernetes client.

func GetKubeClusterDomain added in v1.3.0

func GetKubeClusterDomain() (string, error)

GetKubeClusterDomain search KubeClusterDomain value from /etc/resolv.conf file.

func IsSocket added in v1.9.0

func IsSocket(f fs.FileInfo) bool

IsSocket returns if the given file is a unix socket.

func IsTruthy added in v1.8.0

func IsTruthy(val string) bool

IsTruthy returns true if a string is a truthy value. Truthy values are "y", "yes", "true", "t", "on", "1" (case-insensitive); everything else is false.

func IsYaml added in v1.8.0

func IsYaml(fileName string) bool

IsYaml checks whether the file is yaml or not.

func SetEnvVariables added in v1.8.0

func SetEnvVariables(variables map[string]string) error

SetEnvVariables set variables to environment.

func SocketExists added in v1.9.0

func SocketExists(socketPath string) bool

SocketExists returns true if the file in that path is an unix socket.

func ToISO8601DateTimeString added in v0.5.0

func ToISO8601DateTimeString(dateTime time.Time) string

ToISO8601DateTimeString converts dateTime to ISO8601 Format ISO8601 Format: 2020-01-01T01:01:01.10101Z.

Types

This section is empty.

Jump to

Keyboard shortcuts

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