Documentation ¶
Index ¶
- Constants
- func ApplyConfigPatch(baseCfg []byte, updatedParameters map[string]*string, ...) (string, error)
- func FromCMKeysSelector(keys []string) *set.LinkedHashSetString
- func FromConfigObject(name, config string, formatConfig *appsv1beta1.FileFormatConfig) (unstructured.ConfigObject, error)
- func FromStringMap(m map[string]*string) map[string]interface{}
- func FromStringPointerMap(m map[string]string) map[string]*string
- func FromValueToString(val interface{}) string
- func GenerateComponentConfigurationName(clusterName, componentName string) string
- func GenerateConstraintsUniqLabelKeyWithConfig(configKey string) string
- func GenerateEnvFromName(originName string) string
- func GenerateRevisionPhaseKey(revision string) string
- func GenerateTPLUniqLabelKeyWithConfig(configKey string) string
- func GenerateUniqKeyWithConfig(label string, configKey string) string
- func GetComponentCfgName(clusterName, componentName, tplName string) string
- func GetInstanceCMName(obj client.Object, tpl *appsv1.ComponentTemplateSpec) string
- func GetParameterFromConfiguration(configMap *corev1.ConfigMap, allFiles bool, fieldPath ...string) ([]string, error)
- func GetReloadOptions(cli client.Client, ctx context.Context, ...) (*appsv1beta1.ReloadAction, *appsv1beta1.FileFormatConfig, error)
- func GetValidFieldName(key string) string
- func IsDynamicParameter(paramName string, cc *appsv1beta1.ConfigConstraintSpec) bool
- func IsNotUserReconfigureOperation(cm *corev1.ConfigMap) bool
- func IsParametersUpdateFromManager(cm *corev1.ConfigMap) bool
- func IsSchedulableConfigResource(object client.Object) bool
- func IsUpdateDynamicParameters(cc *appsv1beta1.ConfigConstraintSpec, cfg *ConfigPatchInfo) (bool, error)
- func IsValidLabelKeyOrValue(label string) bool
- func IsWatchModuleForShellTrigger(trigger *appsv1beta1.ShellTrigger) bool
- func IsWatchModuleForTplTrigger(trigger *appsv1beta1.TPLScriptTrigger) bool
- func LoadRawConfigObject(data map[string]string, formatConfig *appsv1beta1.FileFormatConfig, ...) (map[string]unstructured.ConfigObject, error)
- func MakeError(formatMsg string, args ...interface{}) error
- func MergeUpdatedConfig(baseMap, updatedMap map[string]string) map[string]string
- func NeedReloadVolume(config appsv1.ComponentConfigSpec) bool
- func NestedPrefixField(formatConfig *appsv1beta1.FileFormatConfig) string
- func NewConfigLoader(option CfgOption) (*dataConfig, error)
- func SetParametersUpdateSource(cm *corev1.ConfigMap, source string)
- func TransformConfigFileToKeyValueMap(fileName string, formatterConfig *appsv1beta1.FileFormatConfig, ...) (map[string]string, error)
- func ValidateConfigPatch(patch *ConfigPatchInfo, formatCfg *appsv1beta1.FileFormatConfig) error
- func WrapError(err error, formatMsg string, args ...interface{}) error
- type CfgOpOption
- type CfgOption
- type ConfigLoaderProvider
- type ConfigOperator
- type ConfigPatchInfo
- func CreateConfigPatch(oldVersion, newVersion map[string]string, format appsv1beta1.CfgFileFormat, ...) (*ConfigPatchInfo, bool, error)
- func CreateMergePatch(oldVersion, newVersion interface{}, option CfgOption) (*ConfigPatchInfo, error)
- func TransformConfigPatchFromData(data map[string]string, format appsv1beta1.CfgFileFormat, keys []string) (*ConfigPatchInfo, error)
- type ConfigResource
- type ConfigType
- type GetResourceFn
- type IniContext
- type Option
- type ParamPairs
- type ParameterPair
- type ParameterUpdateType
- type PolicyExecStatus
- type RawConfig
- type ReconfiguringProgress
- type VisualizedParam
- type XMLContext
Constants ¶
const ( Unconfirmed int32 = -1 NotStarted int32 = 0 )
const ( ReconfigureCreatedPhase = "created" ReconfigureNoChangeType = "noChange" ReconfigureAutoReloadPhase = string(appsv1alpha1.AsyncDynamicReloadPolicy) ReconfigureSimplePhase = string(appsv1alpha1.NormalPolicy) ReconfigureParallelPhase = string(appsv1alpha1.RestartPolicy) ReconfigureRollingPhase = string(appsv1alpha1.RollingPolicy) )
const ArrayFieldPrefix = "@"
Variables ¶
This section is empty.
Functions ¶
func ApplyConfigPatch ¶
func ApplyConfigPatch(baseCfg []byte, updatedParameters map[string]*string, formatConfig *appsv1beta1.FileFormatConfig) (string, error)
func FromCMKeysSelector ¶
func FromCMKeysSelector(keys []string) *set.LinkedHashSetString
func FromConfigObject ¶
func FromConfigObject(name, config string, formatConfig *appsv1beta1.FileFormatConfig) (unstructured.ConfigObject, error)
func FromStringMap ¶
FromStringMap converts a map[string]string to a map[string]interface{}
func FromStringPointerMap ¶
FromStringPointerMap converts a map[string]string to a map[string]interface{}
func FromValueToString ¶
func FromValueToString(val interface{}) string
func GenerateComponentConfigurationName ¶
GenerateComponentConfigurationName generates configuration name for component
func GenerateConstraintsUniqLabelKeyWithConfig ¶
GenerateConstraintsUniqLabelKeyWithConfig generates uniq key for configure template reference: docs/img/reconfigure-cr-relationship.drawio.png
func GenerateEnvFromName ¶
GenerateEnvFromName generates env configmap name
func GenerateTPLUniqLabelKeyWithConfig ¶
GenerateTPLUniqLabelKeyWithConfig generates uniq key for configuration template reference: docs/img/reconfigure-cr-relationship.drawio.png
func GenerateUniqKeyWithConfig ¶
GenerateUniqKeyWithConfig is similar to getInstanceCfgCMName, generates uniq label/annotations for configuration template
func GetComponentCfgName ¶
GetComponentCfgName is similar to getInstanceCfgCMName, while without statefulSet object.
func GetInstanceCMName ¶
func GetInstanceCMName(obj client.Object, tpl *appsv1.ComponentTemplateSpec) string
func GetParameterFromConfiguration ¶
func GetParameterFromConfiguration(configMap *corev1.ConfigMap, allFiles bool, fieldPath ...string) ([]string, error)
GetParameterFromConfiguration gets configure parameter ctx: apiserver context cli: apiserver client cluster: appsv1.Cluster component: component name
func GetReloadOptions ¶
func GetReloadOptions(cli client.Client, ctx context.Context, configSpecs []appsv1.ComponentConfigSpec) (*appsv1beta1.ReloadAction, *appsv1beta1.FileFormatConfig, error)
func GetValidFieldName ¶ added in v0.8.2
func IsDynamicParameter ¶ added in v0.8.2
func IsDynamicParameter(paramName string, cc *appsv1beta1.ConfigConstraintSpec) bool
IsDynamicParameter checks if the parameter supports hot update
func IsNotUserReconfigureOperation ¶
IsNotUserReconfigureOperation checks if the parameters are updated from operation
func IsParametersUpdateFromManager ¶
IsParametersUpdateFromManager checks if the parameters are updated from manager
func IsUpdateDynamicParameters ¶
func IsUpdateDynamicParameters(cc *appsv1beta1.ConfigConstraintSpec, cfg *ConfigPatchInfo) (bool, error)
IsUpdateDynamicParameters checks if the changed parameters require a restart
func IsValidLabelKeyOrValue ¶ added in v0.8.2
IsValidLabelKeyOrValue checks if the input string is a valid label key or value https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
func IsWatchModuleForShellTrigger ¶
func IsWatchModuleForShellTrigger(trigger *appsv1beta1.ShellTrigger) bool
func IsWatchModuleForTplTrigger ¶
func IsWatchModuleForTplTrigger(trigger *appsv1beta1.TPLScriptTrigger) bool
func LoadRawConfigObject ¶
func LoadRawConfigObject(data map[string]string, formatConfig *appsv1beta1.FileFormatConfig, keys []string) (map[string]unstructured.ConfigObject, error)
func MergeUpdatedConfig ¶
MergeUpdatedConfig replaces the file content of the changed key. baseMap is the original configuration file, updatedMap is the updated configuration file
func NeedReloadVolume ¶
func NeedReloadVolume(config appsv1.ComponentConfigSpec) bool
func NestedPrefixField ¶
func NestedPrefixField(formatConfig *appsv1beta1.FileFormatConfig) string
func NewConfigLoader ¶
func SetParametersUpdateSource ¶
SetParametersUpdateSource sets the parameters' update source manager: parameter only updated from manager external-template: parameter only updated from template ops: parameter updated from operation
func TransformConfigFileToKeyValueMap ¶
func TransformConfigFileToKeyValueMap(fileName string, formatterConfig *appsv1beta1.FileFormatConfig, configData []byte) (map[string]string, error)
TransformConfigFileToKeyValueMap transforms a config file in appsv1alpha1.CfgFileFormat format to a map in which the key is config name and the value is config value sectionName means the desired section of config file, such as [mysqld] section. If config file has no section structure, sectionName should be default to get all values in this config file.
func ValidateConfigPatch ¶
func ValidateConfigPatch(patch *ConfigPatchInfo, formatCfg *appsv1beta1.FileFormatConfig) error
ValidateConfigPatch Verifies if the changed parameters have been removed
Types ¶
type CfgOpOption ¶
type CfgOpOption struct { // optional VolumeName string // optional FileName string // option // for all configuration AllSearch bool // optional IniContext *IniContext // optional XMLContext *XMLContext }
func NewCfgOptions ¶
func NewCfgOptions(filename string, options ...Option) CfgOpOption
type CfgOption ¶
type CfgOption struct { Type ConfigType Log logr.Logger // formatter CfgType appsv1beta1.CfgFileFormat // Path for CfgLocalType test Path string RawData []byte // ConfigResource for k8s resource ConfigResource *ConfigResource }
type ConfigLoaderProvider ¶
type ConfigOperator ¶
type ConfigOperator interface { // MergeFrom updates parameter in key-value MergeFrom(params map[string]interface{}, option CfgOpOption) error // Query gets parameter Query(jsonpath string, option CfgOpOption) ([]byte, error) // ToCfgContent to configuration file content ToCfgContent() (map[string]string, error) }
type ConfigPatchInfo ¶
type ConfigPatchInfo struct { IsModify bool // new config AddConfig map[string]interface{} // delete config DeleteConfig map[string]interface{} // update config // patch json UpdateConfig map[string][]byte Target *cfgWrapper LastVersion *cfgWrapper }
func CreateConfigPatch ¶
func CreateConfigPatch(oldVersion, newVersion map[string]string, format appsv1beta1.CfgFileFormat, keys []string, comparableAllFiles bool) (*ConfigPatchInfo, bool, error)
CreateConfigPatch creates a patch for configuration files with different version.
func CreateMergePatch ¶
func CreateMergePatch(oldVersion, newVersion interface{}, option CfgOption) (*ConfigPatchInfo, error)
func TransformConfigPatchFromData ¶
func TransformConfigPatchFromData(data map[string]string, format appsv1beta1.CfgFileFormat, keys []string) (*ConfigPatchInfo, error)
type ConfigResource ¶
type ConfigResource struct { CfgKey client.ObjectKey ResourceReader GetResourceFn // configmap data ConfigData map[string]string CMKeys *set.LinkedHashSetString }
func FromConfigData ¶
func FromConfigData(data map[string]string, cmKeys *set.LinkedHashSetString) *ConfigResource
type ConfigType ¶
type ConfigType string
const ( CfgCmType ConfigType = "configmap" CfgTplType ConfigType = "configConstraint" CfgLocalType ConfigType = "local" CfgRawType ConfigType = "raw" )
type IniContext ¶
type IniContext struct {
SectionName string
}
type Option ¶
type Option func(ctx *CfgOpOption)
Option for operator
func WithFormatterConfig ¶
func WithFormatterConfig(formatConfig *appsv1beta1.FileFormatConfig) Option
type ParamPairs ¶
type ParameterPair ¶
type ParameterUpdateType ¶
type ParameterUpdateType string
ParameterUpdateType describes how to update the parameters. +enum
const ( AddedType ParameterUpdateType = "add" DeletedType ParameterUpdateType = "delete" UpdatedType ParameterUpdateType = "update" )
type PolicyExecStatus ¶
type RawConfig ¶
type RawConfig struct { // formatter Type appsv1beta1.CfgFileFormat RawData string }
type ReconfiguringProgress ¶
type ReconfiguringProgress int32
ReconfiguringProgress defines the progress percentage. range: 0~100 Unconfirmed(-1) describes an uncertain progress, e.g: fsm is failed. +enum
type VisualizedParam ¶
type VisualizedParam struct { Key string UpdateType ParameterUpdateType Parameters []ParameterPair }
func GenerateVisualizedParamsList ¶
func GenerateVisualizedParamsList(configPatch *ConfigPatchInfo, formatConfig *appsv1beta1.FileFormatConfig, sets *set.LinkedHashSetString) []VisualizedParam