Documentation ¶
Index ¶
- Constants
- func ClickHouseCloudPassword(s int) string
- func GetEnv(key, fallback string) string
- func InferTimelines(refTime time.Time, statsPeriod string) (int64, int64, int64, string)
- func IsIngressReady(ingress *netv1.Ingress) bool
- func LookupEnvOrBool(key string, defaultVal bool) bool
- func LookupEnvOrString(key string, defaultVal string) string
- func MergeMap(base map[string]string, overrides map[string]string) map[string]string
- func MustParse(in string) *url.URL
- func NewCustomJobStatusReader(mapper meta.RESTMapper) engine.StatusReader
- func ParseFeatureAsBool(features map[string]string, k string) (bool, error)
- func ParseYaml(yamlString string) ([]client.Object, error)
- func PatchBytes(defaults, overrides []byte) ([]byte, error)
- func PatchObject(base, overrides interface{}) error
- func Ptr[T any](v T) *T
- func RBACObjectMutator(current, desired client.Object) error
- func RandStringASCIIBytes(n int) (string, error)
- func RandStringRunes(s int) string
- func RandStringRunesRaw(s int) string
- func ReadyHandler(isReady *atomic.Bool) http.HandlerFunc
- func RenderTemplate(t *template.Template, tmpl string, values map[string]interface{}) (string, error)
- func RouteMetricsOtel(m metric.Meter) gin.HandlerFunc
- func RouteMetricsPrometheus(registry prometheus.Registerer) gin.HandlerFunc
- func ServeWithGracefulShutdown(ctx context.Context, logger simpleLogger, srvs ...*http.Server) error
- func SeverityTextToNumber(severityText string) plog.SeverityNumber
- func ValidateServiceName(string string) bool
- type Action
- type ActionOperation
- type ActionRunner
- type CheckGoneAction
- type ClickHouseAction
- type ClickHouseCloudMigrationAction
- type ClickHouseMigrationAction
- type DNSLookupFailAction
- type DeploymentReadyAction
- type DesiredState
- type EnvironmentTarget
- type GenericCreateAction
- type GenericCreateOrUpdateAction
- type GenericDeleteAction
- type GenericUpdateAction
- type GetInventoryFunc
- type GracefulServer
- type IngressReadyAction
- type LogAction
- type ManifestsEnsureAction
- type ManifestsPruneAction
- type SetInventoryFunc
- type StatefulSetReadyAction
Constants ¶
const ( // ReconciliationSucceededReason represents the fact that the reconciliation of // the resource has succeeded. ReconciliationSuccessReason string = "Success" // ReconciliationSuccessReason represents the fact that the reconciliation of // the resource has succeeded and is ready. Expectation is that the resource // checks itself for readiness before attaching this condition. ConditionTypeReady string = "Ready" // comes into play to catch something that is taking too long to become Ready // ReconciliationFailedReason represents the fact that the reconciliation of // the resource has failed. ReconciliationFailedReason string = "Reconciling" )
const ( Period1m = "1m" // 1 minute Period5m = "5m" // 5 minutes Period15m = "15m" // 15 minutes Period30m = "30m" // 30 minutes Period1h = "1h" // 1 hour Period4h = "4h" // 4 hours Period12h = "12h" // 12 hours Period24h = "24h" // 24 hours Period7d = "7d" // 7 days Period14d = "14d" // 14 days Period30d = "30d" // 30 days )
const (
ConditionStatusSuccess = "True"
)
Variables ¶
This section is empty.
Functions ¶
func ClickHouseCloudPassword ¶
ClickHouseCloudPassword generates ClickHouse Cloud specific password which requires special characters. We already use secure random generated string which is then appended by special chars.
func InferTimelines ¶
func IsIngressReady ¶
func LookupEnvOrBool ¶
func LookupEnvOrString ¶
func NewCustomJobStatusReader ¶
func NewCustomJobStatusReader(mapper meta.RESTMapper) engine.StatusReader
func ParseFeatureAsBool ¶
func ParseYaml ¶
Parses a file with multiple yaml declarations and decodes the declarations into kubernetes client.Objects.
func PatchBytes ¶
patch the default spec (as defined in code) with the overrides (as provided by an SRE).
func PatchObject ¶
func PatchObject(base, overrides interface{}) error
func RBACObjectMutator ¶
func RandStringASCIIBytes ¶
func RandStringRunes ¶
func RandStringRunesRaw ¶
func ReadyHandler ¶
func ReadyHandler(isReady *atomic.Bool) http.HandlerFunc
func RenderTemplate ¶
func RenderTemplate(t *template.Template, tmpl string, values map[string]interface{}) (string, error)
Helper to render a go template.
func RouteMetricsOtel ¶
func RouteMetricsOtel(m metric.Meter) gin.HandlerFunc
Use set gin metrics middleware.
func RouteMetricsPrometheus ¶
func RouteMetricsPrometheus(registry prometheus.Registerer) gin.HandlerFunc
Use set gin metrics middleware.
func SeverityTextToNumber ¶
func SeverityTextToNumber(severityText string) plog.SeverityNumber
func ValidateServiceName ¶
Types ¶
type Action ¶
type Action interface {
Run(runner ActionRunner) (string, ActionOperation, error)
}
type ActionOperation ¶
type ActionOperation string
const ( OperationCreated ActionOperation = "(created)" OperationUpdated ActionOperation = "(updated)" OperationDeleted ActionOperation = "(deleted)" OperationNoop ActionOperation = "(unchanged)" OperationLog ActionOperation = "(log)" )
type ActionRunner ¶
type ActionRunner struct {
// contains filtered or unexported fields
}
func NewActionRunner ¶
func NewActionRunner( ctx context.Context, client client.Client, scheme *k8s_runtime.Scheme, cr client.Object, resourceManager *ssa.ResourceManager, t trace.Tracer, ) ActionRunner
func (*ActionRunner) RunAll ¶
func (i *ActionRunner) RunAll(ctx context.Context, desiredState DesiredState) error
type CheckGoneAction ¶
func (CheckGoneAction) Run ¶
func (i CheckGoneAction) Run(runner ActionRunner) (string, ActionOperation, error)
type ClickHouseAction ¶
type ClickHouseAction struct { URL url.URL SQL string Msg string Database string ForgetErrorIfContains string }
func (ClickHouseAction) Run ¶
func (i ClickHouseAction) Run(_ ActionRunner) (string, ActionOperation, error)
type ClickHouseCloudMigrationAction ¶
type ClickHouseCloudMigrationAction struct { Msg string ClickHouseDSN string GoMigrationsToRun []*goose.Migration MigrationsToRun fs.FS SetLastMigrationApplied func(string) }
func (ClickHouseCloudMigrationAction) Run ¶
func (i ClickHouseCloudMigrationAction) Run(runner ActionRunner) (string, ActionOperation, error)
type ClickHouseMigrationAction ¶
type ClickHouseMigrationAction struct { Msg string ClickHouseDSN string MigrationsToRun fs.FS GoMigrationsToRun []*goose.Migration SetLastMigrationApplied func(string) }
func (ClickHouseMigrationAction) Run ¶
func (i ClickHouseMigrationAction) Run(runner ActionRunner) (string, ActionOperation, error)
type DNSLookupFailAction ¶
func (DNSLookupFailAction) Run ¶
func (i DNSLookupFailAction) Run(_ ActionRunner) (string, ActionOperation, error)
type DeploymentReadyAction ¶
func (DeploymentReadyAction) Run ¶
func (i DeploymentReadyAction) Run(_ ActionRunner) (string, ActionOperation, error)
Note(Arun): I'm not sure what would be best to statisfy unparam linter
type DesiredState ¶
type DesiredState []Action
The desired state is defined by a list of actions that have to be run to get from the current state to the desired state.
func (*DesiredState) AddAction ¶
func (d *DesiredState) AddAction(action Action) DesiredState
func (*DesiredState) AddActions ¶
func (d *DesiredState) AddActions(actions []Action) DesiredState
type EnvironmentTarget ¶
type EnvironmentTarget string
var ( AWS EnvironmentTarget = "aws" GCP EnvironmentTarget = "gcp" KIND EnvironmentTarget = "kind" DEVVM EnvironmentTarget = "devvm" )
Supported platform targets.
type GenericCreateAction ¶
An action to create generic kubernetes resources.
func (GenericCreateAction) Run ¶
func (i GenericCreateAction) Run(runner ActionRunner) (string, ActionOperation, error)
type GenericCreateOrUpdateAction ¶
type GenericCreateOrUpdateAction struct { Ref client.Object Msg string Mutator controllerutil.MutateFn SkipOwnerRef bool }
An action to create generic kubernetes resources (resources that don't require special treatment).
func (GenericCreateOrUpdateAction) Run ¶
func (i GenericCreateOrUpdateAction) Run(runner ActionRunner) (string, ActionOperation, error)
type GenericDeleteAction ¶
An action to delete generic kubernetes resources (resources that don't require special treatment).
func (GenericDeleteAction) Run ¶
func (i GenericDeleteAction) Run(runner ActionRunner) (string, ActionOperation, error)
type GenericUpdateAction ¶
An action to update generic kubernetes resources.
func (GenericUpdateAction) Run ¶
func (i GenericUpdateAction) Run(runner ActionRunner) (string, ActionOperation, error)
type GetInventoryFunc ¶
type GetInventoryFunc func() *v1beta2.ResourceInventory
We use closures, as Actions are type-agnostic and the cr object that is accessible in the runner is of type Object. TODO(prozlach): Is there a better way to approach this?
type GracefulServer ¶
type GracefulServer struct {
// contains filtered or unexported fields
}
func NewGracefulServer ¶
func (*GracefulServer) Start ¶
func (g *GracefulServer) Start()
func (*GracefulServer) Stop ¶
func (g *GracefulServer) Stop()
type IngressReadyAction ¶
func (IngressReadyAction) Run ¶
func (i IngressReadyAction) Run(runner ActionRunner) (string, ActionOperation, error)
type LogAction ¶
type LogAction struct { Msg string // if error is set, the runner will immediately stop at this action and // enqueue another reconciliation Error error }
Log a message and optionally an error. If an error is present, the runner will immediately stop at this action and enqueue another reconciliation.
func (LogAction) Run ¶
func (i LogAction) Run(_ ActionRunner) (string, ActionOperation, error)
type ManifestsEnsureAction ¶
type ManifestsEnsureAction struct { HealthcheckTimeout time.Duration ComponentName string Manifests []*unstructured.Unstructured GetInventory GetInventoryFunc SetInventory SetInventoryFunc Msg string Log logr.Logger }
func (ManifestsEnsureAction) Run ¶
func (r ManifestsEnsureAction) Run(runner ActionRunner) (string, ActionOperation, error)
type ManifestsPruneAction ¶
type ManifestsPruneAction struct { ComponentName string GetInventory GetInventoryFunc Msg string Log logr.Logger }
func (ManifestsPruneAction) Run ¶
func (r ManifestsPruneAction) Run(runner ActionRunner) (string, ActionOperation, error)
type SetInventoryFunc ¶
type SetInventoryFunc func(*v1beta2.ResourceInventory)
type StatefulSetReadyAction ¶
func (StatefulSetReadyAction) Run ¶
func (i StatefulSetReadyAction) Run(_ ActionRunner) (string, ActionOperation, error)