core

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NamespaceEnv      = "NAMESPACE"
	ApiKeyEnv         = "API_KEY"
	CronJobVerboseEnv = "EXPORT_CRON_VERBOSE"
	CronJobEnv        = "EXPORT_CRON"
)

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, message string)

func Decode

func Decode[T any](r *http.Request) (T, error)

func ErrorResponse

func ErrorResponse(w http.ResponseWriter, status int, message string)

func Health

func Health(w http.ResponseWriter, r *http.Request)

func InternalServerErrorResponse added in v0.0.2

func InternalServerErrorResponse(w http.ResponseWriter, err error)

func JSON

func JSON[T any](w http.ResponseWriter, status int, v T)

func NewAuthMiddleware

func NewAuthMiddleware(config *Configuration) func(next http.HandlerFunc) http.HandlerFunc

func Unauthorized

func Unauthorized(w http.ResponseWriter, message string)

Types

type ApiError

type ApiError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type BackupSchedule added in v0.0.2

type BackupSchedule struct {
	Name     string `json:"name"`
	Schedule string `json:"schedule"`
}

type BackupScheduleRuntimeClient added in v0.0.2

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

BackupScheduleRuntimeClient contains the RuntimeClient to query custom resources and is used to query the backup schedule custom resource

func NewBackupScheduleRuntimeClient added in v0.0.2

func NewBackupScheduleRuntimeClient(rclient RuntimeClient, namespace string) *BackupScheduleRuntimeClient

NewBackupScheduleRuntimeClient creates a new NewBackupScheduleRuntimeClient instance

func (*BackupScheduleRuntimeClient) ListBackupSchedules added in v0.0.2

func (b *BackupScheduleRuntimeClient) ListBackupSchedules(ctx context.Context) (*bup.BackupScheduleList, error)

ListBackupSchedules returns a list of all backup schedule custom resources

type Configuration

type Configuration struct {
	// LogLevel controls the granularity and amount of issued log output. Valid values are (always in
	// uppercase) `ERROR`, `WARN`, `INFO`, `DEBUG`. Defaults to `ERROR` if left empty.
	LogLevel string
	// BasePath is the context path of the application, usually "/ces-exporter"
	BasePath string
	// ApiKey is the api key which is required to access the api
	ApiKey string
	// Namespace is the namespace in the cluster where the application runs in (only used in multinode ces)
	Namespace string
	// CronExp is the cron expression for the interval to enable the export mode (only used in multinode ces)
	CronExp string
	// VerboseCron defines whether the export mode cronjob should log verbose (only used in multinode ces)
	VerboseCron bool
	// IsClassic defines if the application should start with classic ces configuration or multinode ces configuration
	IsClassic bool
	// Exporter Port in classic mode
	ClassicExportPort int
	// VolumesBasePath defines the base directory path for storing volume-related data.
	VolumesBasePath string
}

Configuration holds all possible configurations of the exporter app

func ReadConfigFromEnv

func ReadConfigFromEnv() (Configuration, error)

type DoguConfig added in v0.0.2

type DoguConfig struct {
	Name            string     `json:"name"`
	NormalConfig    []KeyValue `json:"normal"`
	LocalConfig     []KeyValue `json:"local"`
	SensitiveConfig []KeyValue `json:"sensitive"`
}

type ExportResponse added in v0.0.2

type ExportResponse struct {
	GlobalConfig    GlobalConfig     `json:"global"`
	DoguConfigs     []DoguConfig     `json:"dogus"`
	BackupSchedules []BackupSchedule `json:"backupSchedules"`
}

type FilterOption added in v0.0.2

type FilterOption func(kvs []KeyValue) []KeyValue

type GlobalConfig added in v0.0.2

type GlobalConfig []KeyValue

type KeyValue added in v0.0.2

type KeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type RuntimeClient added in v0.0.2

type RuntimeClient interface {
	rclient.Reader
}

RuntimeClient wraps sigs.k8s.io/controller-runtime/pkg/client and is used to query custom resources

Jump to

Keyboard shortcuts

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