utils

package
v0.1.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Operator auto-created flat-network service name suffix
	FlatNetworkServiceNameSuffix = "-flat-network"

	NetAttatchDefName = "rancher-flat-network"
)

Variables

View Source
var (
	Version   = "v0.1.0"
	GitCommit = ""
)

Functions

func CheckFileExistsPrompt

func CheckFileExistsPrompt(
	ctx context.Context, name string, autoYes bool,
) error

func GID

func GID() uint64

GID returns current go routine ID

func Hostname

func Hostname() string

Hostname returns current hostname.

func IsFlatNetworkService

func IsFlatNetworkService(svc *corev1.Service) bool

Check if this service is a flat-network service.

Specification: A Flat-Network Service is a ClusterIP typed headless service, name ends with '-flat-network' suffix. And should have 'k8s.v1.cni.cncf.io/networks: rancher-flat-network' annotation.

func IsPodEnabledFlatNetwork

func IsPodEnabledFlatNetwork(pod *corev1.Pod) bool

IsPodEnabledFlatNetwork returns true if the pod enables flatnetwork

func Print

func Print(a any) string

func PromptUser

func PromptUser(ctx context.Context, text string, autoYes bool) error

func Ptr

func Ptr[T valueTypes](i T) *T

Ptr gets the pointer of the variable.

func Scanf

func Scanf(ctx context.Context, format string, a ...any) (int, error)

func SetupLogrus

func SetupLogrus(debug bool)

func Value

func Value[T valueTypes](p *T) T

A safe function to get the value from the pointer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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