Documentation
¶
Index ¶
- Constants
- func AddHashWithKeyToAnnotations(obj client.Object, key string, specHash string)
- func AddObjectConfigHash(obj client.Object, hash string)
- func AppRequirements(namespace, app string) *client.ListOptions
- func ApplyDefault[T any](source *T, defaults T) error
- func DeepHashObject(objectToWrite any) (string, error)
- func DeepHashResource(obj client.Object, specFields []string) (string, error)
- func ExecuteParallel[Item any, Id comparable, Tasks ~[]Item, Result any](tasks Tasks, f func(Item) (Id, Result, error)) map[Id]ExecutionResult[Id, Result]
- func GeneratePassword() string
- func GetConfigHashFromObject(found client.Object) string
- func GetFunctionName(temp any) string
- func GetSpecHashFromObject(found client.Object) string
- func MergeMaps[Value any](mapsToMerge ...map[string]Value) map[string]Value
- func PathToName(path string) string
- func Sha256Hash(password []byte) string
- func ShouldEmitEvent(err error) bool
- func SortKey[T any, V cmp.Ordered](slice []T, key func(T) V)
- func UpdateResult(result *ctrl.Result, update *ctrl.Result)
- type ExecutionResult
- type Logger
- func (l Logger) Debug(msg string, keysAndVals ...any)
- func (l Logger) Error(err error, msg string, keysAndVals ...any)
- func (l Logger) Fatal(err error, msg string, keysAndVals ...any)
- func (l Logger) Info(msg string, keysAndVals ...any)
- func (l Logger) Named(name string) Logger
- func (l Logger) Panic(err error, msg string, keysAndVals ...any)
- func (l Logger) Warn(msg string, keysAndVals ...any)
- func (l Logger) With(keysAndVals ...any) Logger
- func (l Logger) WithContext(ctx context.Context, object client.Object) Logger
Constants ¶
const ( AnnotationSpecHash = "checksum/spec" AnnotationConfigHash = "checksum/configuration" AnnotationRestartedAt = "kubectl.kubernetes.io/restartedAt" AnnotationStatefulSetVersion = "clickhouse.com/statefulset-version" )
const ( LabelAppKey = "app" LabelAppK8sKey = "app.kubernetes.io/name" LabelInstanceK8sKey = "app.kubernetes.io/instance" LabelRoleKey = "clickhouse.com/role" LabelKeeperReplicaID = "clickhouse.com/keeper-replica-id" LabelClickHouseShardID = "clickhouse.com/shard-id" LabelClickHouseReplicaID = "clickhouse.com/replica-id" )
Contains common labels keys and helpers to work with.
const ( LabelKeeperValue = "clickhouse-keeper" LabelKeeperAllReplicas = "all-replicas" LabelClickHouseValue = "clickhouse-server" )
Variables ¶
This section is empty.
Functions ¶
func AddHashWithKeyToAnnotations ¶
AddHashWithKeyToAnnotations adds given spec hash to object's annotations with given key.
func AddObjectConfigHash ¶
AddObjectConfigHash adds given config hash to object's annotations.
func AppRequirements ¶
func AppRequirements(namespace, app string) *client.ListOptions
AppRequirements returns ListOptions to list resources of the given app.
func ApplyDefault ¶
ApplyDefault recursively applies default values from the 'defaults' struct to the zero-values 'source' struct fields.
func DeepHashObject ¶
DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes. (copied from Kubernetes, with changes).
func DeepHashResource ¶
DeepHashResource writes specified resource's labels, annotations and spec fields to hash.
func ExecuteParallel ¶
func ExecuteParallel[Item any, Id comparable, Tasks ~[]Item, Result any]( tasks Tasks, f func(Item) (Id, Result, error), ) map[Id]ExecutionResult[Id, Result]
ExecuteParallel executes the given function 'f' in parallel for each item in 'tasks'. It does not use context, caller should ensure proper cancellation in the task.
func GeneratePassword ¶
func GeneratePassword() string
GeneratePassword generates a random password of fixed length using a predefined alphabet.
func GetConfigHashFromObject ¶
GetConfigHashFromObject retrieves config hash from object's annotations.
func GetFunctionName ¶
GetFunctionName returns the name of the function passed as an argument.
func GetSpecHashFromObject ¶
GetSpecHashFromObject retrieves spec hash from object's annotations.
func MergeMaps ¶
MergeMaps merges multiple maps into a single map. If the same key exists in multiple maps, the value from the last map will be used.
func PathToName ¶
PathToName converts a filesystem-like path to a name by replacing '/' and '.' with '-'.
func Sha256Hash ¶
Sha256Hash returns the SHA-256 hash of the given password as a hexadecimal string.
func ShouldEmitEvent ¶
ShouldEmitEvent returns whether an error should trigger an event emission.
Types ¶
type ExecutionResult ¶
type ExecutionResult[Id comparable, Result any] struct { Result Result Err error }
ExecutionResult holds the result of task execution along with any error encountered.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a Logger implementation using zap.Logger.