configmanager

package
v0.7.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KBScriptVolumePath = "/opt/kb-tools/reload"
	KBConfigVolumePath = "/opt/kb-tools/config"

	KBTOOLSScriptsPathEnv  = "TOOLS_SCRIPTS_PATH"
	KBConfigManagerPathEnv = "TOOLS_PATH"
)
View Source
const (
	DefaultRetryCount     = 3
	DefaultSleepRetryTime = 10
)
View Source
const KBConfigSpecLazyRenderedYamlFile = "lazy-rendered-config.yaml"

Variables

This section is empty.

Functions

func BuildConfigManagerContainerParams added in v0.6.0

func BuildConfigManagerContainerParams(cli client.Client, ctx context.Context, managerParams *CfgManagerBuildParams, volumeDirs []corev1.VolumeMount) error

func FindVolumeMount added in v0.6.0

func FindVolumeMount(volumeDirs []corev1.VolumeMount, volumeName string) *corev1.VolumeMount

func FromReloadTypeConfig added in v0.6.0

func FromReloadTypeConfig(reloadOptions *appsv1alpha1.ReloadOptions) appsv1alpha1.CfgReloadType

func GetConfigMountPoint added in v0.6.0

func GetConfigMountPoint(configSpec appsv1alpha1.ComponentConfigSpec) string

func GetConfigVolumeName added in v0.6.0

func GetConfigVolumeName(configSpec appsv1alpha1.ComponentConfigSpec) string

func GetScriptsMountPoint added in v0.6.0

func GetScriptsMountPoint(configSpec appsv1alpha1.ComponentConfigSpec) string

func GetScriptsVolumeName added in v0.6.0

func GetScriptsVolumeName(configSpec appsv1alpha1.ComponentConfigSpec) string

func IsSupportReload

func IsSupportReload(reload *appsv1alpha1.ReloadOptions) bool

func IsValidUnixSignal

func IsValidUnixSignal(sig appsv1alpha1.SignalType) bool

func NeedSharedProcessNamespace added in v0.6.0

func NeedSharedProcessNamespace(configSpecs []ConfigSpecMeta) bool

func ScanConfigVolume added in v0.6.0

func ScanConfigVolume(mountPoint string) ([]string, error)

func SetLogger

func SetLogger(zapLogger *zap.Logger)

func ValidateReloadOptions

func ValidateReloadOptions(reloadOptions *appsv1alpha1.ReloadOptions, cli client.Client, ctx context.Context) error

Types

type CfgManagerBuildParams

type CfgManagerBuildParams struct {
	ManagerName string          `json:"name"`
	Image       string          `json:"sidecarImage"`
	Args        []string        `json:"args"`
	Envs        []corev1.EnvVar `json:"envs"`

	ShareProcessNamespace bool `json:"shareProcessNamespace"`

	Volumes       []corev1.VolumeMount `json:"volumes"`
	ComponentName string               `json:"componentName"`
	CharacterType string               `json:"characterType"`
	SecreteName   string               `json:"secreteName"`
	EnvConfigName string               `json:"envConfigName"`

	// add volume to pod
	ScriptVolume           []corev1.Volume
	Cluster                *appsv1alpha1.Cluster
	ConfigSpecsBuildParams []ConfigSpecMeta

	// init tools container
	ToolsContainers           []corev1.Container
	DownwardAPIVolumes        []corev1.VolumeMount
	CMConfigVolumes           []corev1.Volume
	ConfigLazyRenderedVolumes map[string]corev1.VolumeMount
}

CfgManagerBuildParams is the params for building config manager sidecar

type ConfigHandler added in v0.6.0

type ConfigHandler interface {
	OnlineUpdate(ctx context.Context, name string, updatedParams map[string]string) error
	VolumeHandle(ctx context.Context, event fsnotify.Event) error
	MountPoint() []string
}

func CreateCombinedHandler added in v0.6.0

func CreateCombinedHandler(config string, backupPath string) (ConfigHandler, error)

func CreateExecHandler

func CreateExecHandler(command []string, mountPoint string, configMeta *ConfigSpecInfo, backupPath string) (ConfigHandler, error)

func CreateSignalHandler

func CreateSignalHandler(sig appsv1alpha1.SignalType, processName string, mountPoint string) (ConfigHandler, error)

func CreateTPLScriptHandler

func CreateTPLScriptHandler(name, configPath string, dirs []string, backupPath string) (ConfigHandler, error)

type ConfigLazyRenderedMeta added in v0.6.0

type ConfigLazyRenderedMeta struct {
	*appsv1alpha1.ComponentConfigSpec `json:",inline"`

	// secondary template path
	Templates       []string                     `json:"templates"`
	FormatterConfig appsv1alpha1.FormatterConfig `json:"formatterConfig"`
}

type ConfigMapVolumeWatcher

type ConfigMapVolumeWatcher struct {
	// contains filtered or unexported fields
}

func NewVolumeWatcher

func NewVolumeWatcher(volume []string, ctx context.Context, logger *zap.SugaredLogger) *ConfigMapVolumeWatcher

func (*ConfigMapVolumeWatcher) AddFilter

func (*ConfigMapVolumeWatcher) AddHandler

func (*ConfigMapVolumeWatcher) Close

func (w *ConfigMapVolumeWatcher) Close() error

func (*ConfigMapVolumeWatcher) Run

func (w *ConfigMapVolumeWatcher) Run() error

func (*ConfigMapVolumeWatcher) SetRetryCount

func (w *ConfigMapVolumeWatcher) SetRetryCount(count int) *ConfigMapVolumeWatcher

type ConfigSpecInfo added in v0.6.0

type ConfigSpecInfo struct {
	*appsv1alpha1.ReloadOptions `json:",inline"`

	ReloadType      appsv1alpha1.CfgReloadType       `json:"reloadType"`
	ConfigSpec      appsv1alpha1.ComponentConfigSpec `json:"configSpec"`
	FormatterConfig appsv1alpha1.FormatterConfig     `json:"formatterConfig"`

	DownwardAPIOptions []appsv1alpha1.DownwardAPIOption `json:"downwardAPIOptions"`

	// config volume mount path
	MountPoint string `json:"mountPoint"`
	TPLConfig  string `json:"tplConfig"`
}

type ConfigSpecMeta added in v0.6.0

type ConfigSpecMeta struct {
	ConfigSpecInfo `json:",inline"`

	ScriptConfig   []appsv1alpha1.ScriptConfig
	ToolsImageSpec *appsv1alpha1.ToolsImageSpec
}

func FilterSubPathVolumeMount added in v0.6.0

func FilterSubPathVolumeMount(metas []ConfigSpecMeta, volumes []corev1.VolumeMount) []ConfigSpecMeta

func GetSupportReloadConfigSpecs added in v0.6.0

func GetSupportReloadConfigSpecs(configSpecs []appsv1alpha1.ComponentConfigSpec, cli client.Client, ctx context.Context) ([]ConfigSpecMeta, error)

type DynamicParamUpdater

type DynamicParamUpdater interface {
	ExecCommand(ctx context.Context, command string, args ...string) (string, error)
	Close()
}

DynamicParamUpdater is designed to adapt to the dapper implementation.

func NewCommandChannel

func NewCommandChannel(ctx context.Context, dataType, dsn string) (DynamicParamUpdater, error)

type DynamicUpdater

type DynamicUpdater = func(ctx context.Context, configSpec string, updatedParams map[string]string) error

func OnlineUpdateParamsHandle

func OnlineUpdateParamsHandle(tplScriptPath string, formatConfig *appsv1alpha1.FormatterConfig, dataType, dsn string) (DynamicUpdater, error)

type NotifyEventFilter

type NotifyEventFilter func(event fsnotify.Event) (bool, error)

func CreateCfgRegexFilter

func CreateCfgRegexFilter(regexString string) (NotifyEventFilter, error)

func CreateValidConfigMapFilter

func CreateValidConfigMapFilter() NotifyEventFilter

CreateValidConfigMapFilter processes configmap volume https://github.com/ossrs/srs/issues/1635

type PID

type PID int32
const (
	InvalidPID PID = 0
)

type TPLScriptConfig added in v0.6.0

type TPLScriptConfig struct {
	Scripts   string `json:"scripts"`
	FileRegex string `json:"fileRegex"`
	DataType  string `json:"dataType"`
	DSN       string `json:"dsn"`

	FormatterConfig appsv1alpha1.FormatterConfig `json:"formatterConfig"`
}

type WatchEventHandler

type WatchEventHandler func(ctx context.Context, event fsnotify.Event) error

Jump to

Keyboard shortcuts

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