util

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const (
	VectorLogDir = "_vector/"

	// File to signal that Vector should be gracefully shut down
	ShutdownFile = "shutdown"
)

Subdirectory of the log directory containing files to control the Vector instance

View Source
const (
	InvokePrepareSignalHandlers = "prepare_signal_handlers"
	InvokeWaitForTermination    = "wait_for_termination $!"
)
View Source
const CommonBashTrapFunctions = `` /* 540-byte string literal not displayed */

Variables

View Source
var DefaultImagePullPolicy = corev1.PullIfNotPresent
View Source
var DefaultRepository = "quay.io/zncdatadev"

Functions

func CreateVectorShutdownFileCommand added in v0.8.7

func CreateVectorShutdownFileCommand() string

Command to create a shutdown file for the vector container. Please delete it before starting your application using `RemoveVectorShutdownFileCommand` .

func ExportPodAddress added in v0.8.7

func ExportPodAddress() string

ExportPodAddress fetch the pod address from the default-address directory and export it as POD_ADDRESS the listener was provided by listener operator

func GenerateRandomStr

func GenerateRandomStr(length int, useLetters bool, useSpecial bool, useNum bool) string

GenerateRandomStr generates a random string of the specified length. The string can contain letters, special characters, and numbers based on the flags provided.

func GenerateSimplePassword added in v0.8.1

func GenerateSimplePassword(length int) string

GenerateSimplePassword generates a simple password of the specified length. The password will contain only letters and numbers.

func Indent2SpacesToTab

func Indent2SpacesToTab(code string) string

func Indent4SpacesToTab

func Indent4SpacesToTab(code string) string

func IndentSpacesToTab

func IndentSpacesToTab(code string, spacesPerTab int) string

IndentSpacesToTab converts leading spaces in a string to tabs, optimized for 2 or 4 spaces per tab.

func IndentTab2Spaces

func IndentTab2Spaces(code string) string

func IndentTab4Spaces

func IndentTab4Spaces(code string) string

func IndentTabToSpaces

func IndentTabToSpaces(code string, spacesPerTab int) string

IndentTabToSpaces converts leading tabs in a string to a specified number of spaces per tab.

func NewEnvVarsFromMap added in v0.8.1

func NewEnvVarsFromMap(envs map[string]string) []corev1.EnvVar

func RemoveSpecialCharacter

func RemoveSpecialCharacter(str string) string

RemoveSpecialCharacter - remove special character

func RemoveVectorShutdownFileCommand added in v0.8.7

func RemoveVectorShutdownFileCommand() string

Use this command to remove the shutdown file (if it exists) created by [`create_vector_shutdown_file_command`]. You should execute this command before starting your application.

Types

type Base64

type Base64[T []byte | string] struct {
	Data T
}

func (Base64[T]) Decode

func (b Base64[T]) Decode() (T, error)

func (Base64[T]) Encode

func (b Base64[T]) Encode() T

type Image added in v0.6.0

type Image struct {
	Custom          string
	Repo            string
	ProductName     string
	KubedoopVersion string
	ProductVersion  string
	PullPolicy      corev1.PullPolicy
	PullSecretName  string
}

Image represents a container image Required fields:

  • ProductName
  • KubeoopVersion
  • ProductVersion

If Custom is set, it will be used as the image tag, so the Custom field must be a valid image tag, eg. "my.repo.company.org/namespace/image:tag"

func NewImage added in v0.8.0

func NewImage(
	productName string,
	kubedoopVersion string,
	productVersion string,
	opts ...ImageOption,
) *Image

NewImage creates a new Image object

Example:

image := util.NewImage(
	"myproduct",
	"1.0",
	"1.0.0",
)

image := util.NewImage(
	"myproduct",
	"1.0",
	"1.0.0",
	func (options *util.ImageOptions) {
		options.Custom = "myrepo/myimage:latest"
	}
)

func (*Image) GetImageWithTag added in v0.8.4

func (i *Image) GetImageWithTag() (string, error)

func (*Image) GetPullPolicy added in v0.6.0

func (i *Image) GetPullPolicy() corev1.PullPolicy

func (*Image) String added in v0.6.0

func (i *Image) String() string

type ImageOption added in v0.8.0

type ImageOption func(*ImageOptions)

type ImageOptions added in v0.8.0

type ImageOptions struct {
	Custom         string
	Repo           string
	PullPolicy     corev1.PullPolicy
	PullSecretName string
}

type ResourceNameGenerator

type ResourceNameGenerator struct {
	InstanceName string
	RoleName     string
	GroupName    string
}

func NewResourceNameGenerator

func NewResourceNameGenerator(instanceName, roleName, groupName string) *ResourceNameGenerator

NewResourceNameGenerator new a ResourceNameGenerator

func NewResourceNameGeneratorOneRole

func NewResourceNameGeneratorOneRole(instanceName, groupName string) *ResourceNameGenerator

NewResourceNameGeneratorOneRole new a ResourceNameGenerator without roleName

func (*ResourceNameGenerator) GenerateResourceName

func (r *ResourceNameGenerator) GenerateResourceName(extraSuffix string) string

GenerateResourceName generate resource Name

Jump to

Keyboard shortcuts

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