util

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyToFilesystem

func CopyToFilesystem(ctx context.Context, cred *credentials.Credentials, directory string, s v1.S3Storage) error

func DefaultContainerSecurityContexts

func DefaultContainerSecurityContexts(containers []corev1.Container) []corev1.Container

DefaultContainerSecurityContexts keeps user-provided container security contexts unchanged and only fills missing ones with the restricted defaults.

func DefaultPodSecurityContext

func DefaultPodSecurityContext(securityContext *corev1.PodSecurityContext) *corev1.PodSecurityContext

DefaultPodSecurityContext keeps CRD-provided values unchanged and only falls back to the restricted defaults when podSecurityContext is missing.

func GenerateDatabaseURLForGo

func GenerateDatabaseURLForGo(spec *DatabaseSpec) []byte

func GenerateDatabaseURLForShopware

func GenerateDatabaseURLForShopware(spec *DatabaseSpec) []byte

func GenerateOpensearchURLForShopware

func GenerateOpensearchURLForShopware(os *v1.OpensearchSpec, p []byte) []byte

func GetAdminDeploymentMatchLabel

func GetAdminDeploymentMatchLabel() map[string]string

func GetDefaultContainerAnnotations

func GetDefaultContainerAnnotations(defaultContainer string, store v1.Store, overwrite map[string]string) map[string]string

func GetDefaultContainerExecAnnotations

func GetDefaultContainerExecAnnotations(defaultContainer string, ex v1.StoreExec) map[string]string

func GetDefaultContainerSnapshotAnnotations

func GetDefaultContainerSnapshotAnnotations(defaultContainer string, sn v1.StoreSnapshotSpec) map[string]string

func GetDefaultContainerStoreLabels

func GetDefaultContainerStoreLabels(store v1.Store, extra map[string]string) map[string]string

func GetDefaultStoreExecLabels

func GetDefaultStoreExecLabels(store v1.Store, extra map[string]string, name, execType string) map[string]string

func GetDefaultStoreInstanceDebugLabels

func GetDefaultStoreInstanceDebugLabels(store v1.Store, storeDebugInstance v1.StoreDebugInstance) map[string]string

func GetDefaultStoreLabels

func GetDefaultStoreLabels(store v1.Store) map[string]string

func GetDefaultStoreSnapshotLabels

func GetDefaultStoreSnapshotLabels(store v1.Store, overwrite map[string]string, name, subCommand string) map[string]string

func GetMysqlShell

func GetMysqlShell(ctx context.Context, spec DatabaseSpec) *exec.Cmd

func GetStorefrontDeploymentMatchLabel

func GetStorefrontDeploymentMatchLabel() map[string]string

func GetWorkerDeploymentMatchLabel

func GetWorkerDeploymentMatchLabel() map[string]string

func Int64

func Int64(v int64) *int64

func MapEqual

func MapEqual(a, b map[string]string) bool

func MergeEnv

func MergeEnv(dst, src []corev1.EnvVar) []corev1.EnvVar

Copy returns a new slice where src is overwriting dst. When a env in src is already present in dst, the value in dst will be overwritten by the value associated with the value in src.

func RestoreFromFilesystem

func RestoreFromFilesystem(ctx context.Context, cred *credentials.Credentials, directory string, s v1.S3Storage, emptyBeforeRestore bool) error

func RestrictedContainerSecurityContext

func RestrictedContainerSecurityContext() *corev1.SecurityContext

RestrictedContainerSecurityContext returns the fixed container-level settings required by the restricted Pod Security Standard. The CRD default only covers podSecurityContext, but allowPrivilegeEscalation and capabilities live on each container's securityContext.

func RestrictedPodSecurityContext

func RestrictedPodSecurityContext() *corev1.PodSecurityContext

RestrictedPodSecurityContext mirrors the podSecurityContext default from the CRD for resources that were not API-server defaulted before reconciliation.

func ShopwareKey

func ShopwareKey(key string) string

func StrPtr

func StrPtr(s string) *string

func TestS3Connection

func TestS3Connection(ctx context.Context, s v1.S3Storage, c aws.Credentials) error

func TestSQLConnection

func TestSQLConnection(ctx context.Context, spec *DatabaseSpec) error

Types

type DatabaseSpec

type DatabaseSpec struct {
	Host     string
	Password []byte
	User     string
	Port     int32
	Name     string
	Version  string
	SSLMode  string
	Options  string
}

func GetDBSpec

func GetDBSpec(ctx context.Context, store v1.Store, r client.Client) (*DatabaseSpec, error)

type DumpInput

type DumpInput struct {
	DumpFilePath string
	DatabaseSpec
}

type DumpOutput

type DumpOutput struct {
	Duration         time.Duration
	UncompressedSize int64
	CompressedSize   int64
	CompressionRatio float64
}

type FileEntry

type FileEntry struct {
	Name string
	Size int64
	R    io.ReadCloser
}

type MySQLDump

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

func NewMySQLDump

func NewMySQLDump(binaryPath string) MySQLDump

func (MySQLDump) Dump

func (h MySQLDump) Dump(
	ctx context.Context,
	input DumpInput,
	writer io.WriteCloser,
) (*DumpOutput, error)

func (MySQLDump) Restore

func (h MySQLDump) Restore(
	ctx context.Context,
	input DumpInput,
	reader io.ReadCloser,
) error

type MySQLShell

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

func NewMySQLShell

func NewMySQLShell(binaryPath string) MySQLShell

func (MySQLShell) Dump

func (h MySQLShell) Dump(
	ctx context.Context,
	input DumpInput,
) (DumpOutput, error)

func (MySQLShell) RestoreDump

func (h MySQLShell) RestoreDump(
	ctx context.Context,
	input RestoreInput,
) error

type RestoreInput

type RestoreInput struct {
	DatabaseSpec
	DumpFilePath string
}

type S3Downloader

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

func NewS3Downloader

func NewS3Downloader(client *minio.Client, bucket string) *S3Downloader

func (*S3Downloader) DownloadBucket

func (s *S3Downloader) DownloadBucket(ctx context.Context, batchCount int, f func(minio.ObjectInfo, *minio.Object) error) error

DownloadBucket downloads all objects from the configured bucket and processes them with the provided function. The function is called for each object with the object's metadata and a reader for the object's content. The function is responsible for closing the reader after processing the object.

Jump to

Keyboard shortcuts

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