shared

package
v0.0.0-...-e6a4ad4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Arango constants
	ArangoPort           = 8529
	ArangoSyncMasterPort = 8629
	ArangoSyncWorkerPort = 8729
	ArangoExporterPort   = 9101

	ArangoExporterStatusEndpoint        = "/_api/version"
	ArangoExporterClusterHealthEndpoint = "/_admin/cluster/health"
	ArangoExporterInternalEndpoint      = "/_admin/metrics"
	ArangoExporterInternalEndpointV2    = "/_admin/metrics/v2"
	ArangoExporterUsageEndpoint         = "/_admin/usage-metrics"
	ArangoExporterDefaultEndpoint       = "/metrics"

	ArangoSyncStatusEndpoint = "/_api/version"

	// K8s constants
	ClusterIPNone       = "None"
	TopologyKeyHostname = "kubernetes.io/hostname"

	NodeArchAffinityLabel     = "kubernetes.io/arch"
	NodeArchAffinityLabelBeta = "beta.kubernetes.io/arch"

	// Pod constants
	ServerContainerName             = "server"
	ExporterContainerName           = "exporter"
	OperatorContainerName           = "operator"
	ArangodVolumeName               = "arangod-data"
	TlsKeyfileVolumeName            = "tls-keyfile"
	ClientAuthCAVolumeName          = "client-auth-ca"
	ClusterJWTSecretVolumeName      = "cluster-jwt"
	MasterJWTSecretVolumeName       = "master-jwt"
	LifecycleVolumeName             = "lifecycle"
	FoxxAppEphemeralVolumeName      = "ephemeral-apps"
	TMPEphemeralVolumeName          = "ephemeral-tmp"
	ArangoDTimezoneVolumeName       = "arangod-timezone"
	RocksdbEncryptionVolumeName     = "rocksdb-encryption"
	ExporterJWTVolumeName           = "exporter-jwt"
	ArangodVolumeMountDir           = "/data"
	RocksDBEncryptionVolumeMountDir = "/secrets/rocksdb/encryption"
	TLSKeyfileVolumeMountDir        = "/secrets/tls"
	TLSSNIKeyfileVolumeMountDir     = "/secrets/sni"
	ClientAuthCAVolumeMountDir      = "/secrets/client-auth/ca"
	ClusterJWTSecretVolumeMountDir  = "/secrets/cluster/jwt"
	ExporterJWTVolumeMountDir       = "/secrets/exporter/jwt"
	MasterJWTSecretVolumeMountDir   = "/secrets/master/jwt"

	// Security constants
	DefaultRunAsUser  = 1000
	DefaultRunAsGroup = 2000
	DefaultFSGroup    = 3000

	ServerPortName   = "server"
	ExporterPortName = "exporter"
)
View Source
const (
	ServiceTypeNone core.ServiceType = "None"
)

Variables

This section is empty.

Functions

func CreatePersistentVolumeClaimName

func CreatePersistentVolumeClaimName(deploymentName, role, id string) string

CreatePersistentVolumeClaimName returns the name of the persistent volume claim for a member with a given id in a deployment with a given name.

func CreatePodHostName

func CreatePodHostName(deploymentName, role, id string) string

CreatePodHostName returns the hostname of the pod for a member with a given id in a deployment with a given name.

func FixupResourceName

func FixupResourceName(name string) string

FixupResourceName ensures that the given name complies with kubernetes name requirements. If the name is too long or contains invalid characters, it will be adjusted and a hash will be added.

func PrefixResourceError

func PrefixResourceError(prefix string, err error) error

PrefixResourceError creates new prefixed error. If error is already prefixed then current key is appended

func PrefixResourceErrors

func PrefixResourceErrors(prefix string, errs ...error) error

PrefixResourceErrors creates new prefixed errors. If error is already prefixed then current key is appended

func RenderResourceName

func RenderResourceName(in string, keys map[string]string) string

func StripArangodPrefix

func StripArangodPrefix(id string) string

StripArangodPrefix removes well know arangod ID prefixes from the given id.

func Validate

func Validate[T interface{}](in T) error

func ValidateAnyNotNil

func ValidateAnyNotNil[T any](msg string, obj ...*T) error

ValidateAnyNotNil Validates if any of the specified objects is not nil

func ValidateImage

func ValidateImage(image string) error

ValidateImage Validates if provided image is valid

func ValidateList

func ValidateList[T interface{}](in []T, validator func(T) error) error

ValidateList validates all elements on the list

func ValidateOptional

func ValidateOptional[T interface{}](in *T, validator func(T) error) error

ValidateOptional Validates object if is not nil

func ValidateOptionalResourceName

func ValidateOptionalResourceName(name string) error

ValidateOptionalResourceName validates a kubernetes resource name. If not empty and not valid, an error is returned.

func ValidatePullPolicy

func ValidatePullPolicy(in core.PullPolicy) error

ValidatePullPolicy Validates core.PullPolicy

func ValidateRequired

func ValidateRequired[T interface{}](in *T, validator func(T) error) error

ValidateRequired Validates object and required not nil value

func ValidateResourceName

func ValidateResourceName(name string) error

ValidateResourceName validates a kubernetes resource name. If not valid, an error is returned. See https://kubernetes.io/docs/concepts/overview/working-with-objects/names/

func ValidateServiceType

func ValidateServiceType(st core.ServiceType) error

ValidateServiceType checks that service type is supported

func ValidateUID

func ValidateUID(uid types.UID) error

ValidateUID validates if it is valid Kubernetes UID

func WithErrors

func WithErrors(errs ...error) error

WithErrors filter out nil errors

Types

type MergedErrors

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

func (MergedErrors) Error

func (m MergedErrors) Error() string

func (MergedErrors) Errors

func (m MergedErrors) Errors() []error

type ResourceError

type ResourceError struct {
	Prefix string
	Err    error
}

func (ResourceError) Error

func (p ResourceError) Error() string

Error return string representation of error

func (*ResourceError) Format

func (p *ResourceError) Format(s fmt.State, verb rune)

Format formats error with verbs

type ValidateInterface

type ValidateInterface interface {
	Validate() error
}

Directories

Path Synopsis
+k8s:deepcopy-gen=package
+k8s:deepcopy-gen=package

Jump to

Keyboard shortcuts

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