psmdb

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: Apache-2.0 Imports: 29 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoIngressPoints = errors.New("ingress points not found")
View Source
var ErrServiceNotExists = errors.New("service doesn't exist")

Functions

func BuildMongoDBURI added in v1.21.0

func BuildMongoDBURI(ctx context.Context, tlsEnabled bool, sslSecret *corev1.Secret) string

func EntrypointInitContainer added in v1.5.0

func EntrypointInitContainer(cr *api.PerconaServerMongoDB, name, image string, pullPolicy corev1.PullPolicy, command []string) corev1.Container

func ExternalService

func ExternalService(cr *api.PerconaServerMongoDB, replset *api.ReplsetSpec, podName string) *corev1.Service

ExternalService returns a Service object needs to serve external connections

func GetAddr added in v1.6.0

func GetAddr(cr *api.PerconaServerMongoDB, pod, replset string, port int32) string

GetAddr returns replicaSet pod address in cluster

func GetExportedServices added in v1.12.0

func GetMCSAddr added in v1.12.0

func GetMCSAddr(cr *api.PerconaServerMongoDB, pod string, port int32) string

GetMCSAddr returns ReplicaSet pod address using MultiCluster FQDN

func GetMongosAddrs added in v1.12.0

func GetMongosAddrs(ctx context.Context, cl client.Client, cr *api.PerconaServerMongoDB, useInternalAddr bool) ([]string, error)

GetMongosAddrs returns a slice of mongos addresses

func GetMongosPods added in v1.12.0

func GetMongosPods(ctx context.Context, cl client.Client, cr *api.PerconaServerMongoDB) (corev1.PodList, error)

func GetMongosServices added in v1.12.0

func GetMongosServices(ctx context.Context, cl client.Client, cr *api.PerconaServerMongoDB) (*corev1.ServiceList, error)

func GetMongosSts added in v1.19.0

func GetNodeLabels added in v1.16.0

func GetNodeLabels(ctx context.Context, cl client.Client, cr *api.PerconaServerMongoDB, pod corev1.Pod) (map[string]string, error)

func GetOutdatedRSPods added in v1.15.0

func GetOutdatedRSPods(ctx context.Context, k8sclient client.Client, cr *api.PerconaServerMongoDB, rsName string) (corev1.PodList, error)

GetOutdatedRSPods does the same as GetRSPods but doesn't truncate the list of pods

func GetPrimaryPod added in v1.10.0

func GetPrimaryPod(ctx context.Context, mgoClient mongo.Client) (string, error)

func GetRSPods added in v1.10.0

func GetRSPods(ctx context.Context, k8sclient client.Client, cr *api.PerconaServerMongoDB, rsName string) (corev1.PodList, error)

GetRSPods returns truncated list of replicaset pods to the size of `rs.Size`.

func GetReplsetAddrs added in v1.4.0

func GetReplsetAddrs(ctx context.Context, cl client.Client, cr *api.PerconaServerMongoDB, dnsMode api.DNSMode, rs *api.ReplsetSpec, rsExposed bool, pods []corev1.Pod) ([]string, error)

GetReplsetAddrs returns a slice of replset host:port addresses

func GetServiceMeshAddr added in v1.12.0

func GetServiceMeshAddr(cr *api.PerconaServerMongoDB, pod string, port int32) string

GetServiceMeshAddr returns replicaSet pod address in a service mesh

func InitContainers added in v1.6.0

func InitContainers(cr *api.PerconaServerMongoDB, initImage string) []corev1.Container

func IsServiceImported added in v1.12.0

func IsServiceImported(ctx context.Context, k8sclient client.Client, cr *api.PerconaServerMongoDB, svcName string) (bool, error)

func MongoClient added in v1.10.0

func MongoClient(ctx context.Context, k8sClient client.Client, cr *api.PerconaServerMongoDB, rs *api.ReplsetSpec, c Credentials) (mongo.Client, error)

func MongoHost added in v1.4.0

func MongoHost(ctx context.Context, cl client.Client, cr *api.PerconaServerMongoDB, dnsMode api.DNSMode, replset *api.ReplsetSpec, rsExposed bool, pod corev1.Pod) (string, error)

MongoHost returns the mongo host for given pod

func MongosClient added in v1.10.0

func MongosClient(ctx context.Context, k8sclient client.Client, cr *api.PerconaServerMongoDB, c Credentials) (mongo.Client, error)

func MongosHost added in v1.12.0

func MongosHost(ctx context.Context, cl client.Client, cr *api.PerconaServerMongoDB, pod *corev1.Pod, useInternalAddr bool) (string, error)

MongosHost returns the mongos host for given pod

func MongosService added in v1.6.0

func MongosService(cr *api.PerconaServerMongoDB, name string) corev1.Service

func MongosServiceSpec added in v1.6.0

func MongosServiceSpec(cr *api.PerconaServerMongoDB, podName string) corev1.ServiceSpec

func MongosStatefulset added in v1.12.0

func MongosStatefulset(cr *api.PerconaServerMongoDB) *appsv1.StatefulSet

func MongosStatefulsetSpec added in v1.12.0

func MongosStatefulsetSpec(cr *api.PerconaServerMongoDB, template corev1.PodTemplateSpec) appsv1.StatefulSetSpec

func MongosTemplateSpec added in v1.12.0

func MongosTemplateSpec(cr *api.PerconaServerMongoDB, initImage string, log logr.Logger, customConf config.CustomConfig, cfgInstances []string) (corev1.PodTemplateSpec, error)

func NewStatefulSet

func NewStatefulSet(name, namespace string) *appsv1.StatefulSet

NewStatefulSet returns a StatefulSet object configured for a name

func PersistentVolumeClaim

func PersistentVolumeClaim(name, namespace string, spec *api.VolumeSpec) corev1.PersistentVolumeClaim

PersistentVolumeClaim returns a Persistent Volume Claims for Mongod pod

func PodAffinity

func PodAffinity(cr *api.PerconaServerMongoDB, af *api.PodAffinity, labels map[string]string) *corev1.Affinity

PodAffinity returns podAffinity options for the pod

func PodDisruptionBudget

func PodDisruptionBudget(spec *api.PodDisruptionBudgetSpec, labels map[string]string, namespace string) *policyv1.PodDisruptionBudget

func PodTopologySpreadConstraints added in v1.15.0

func PodTopologySpreadConstraints(cr *api.PerconaServerMongoDB, tscs []corev1.TopologySpreadConstraint, ls map[string]string) []corev1.TopologySpreadConstraint

func Service

func Service(cr *api.PerconaServerMongoDB, replset *api.ReplsetSpec) *corev1.Service

Service returns a core/v1 API Service

func StandaloneClient added in v1.12.0

func StandaloneClient(ctx context.Context, k8sclient client.Client, cr *api.PerconaServerMongoDB, c Credentials, host string, tlsEnabled bool) (mongo.Client, error)

func StatefulSpec

func StatefulSpec(ctx context.Context, cr *api.PerconaServerMongoDB, replset *api.ReplsetSpec,
	ls map[string]string, initImage string, configs StatefulConfigParams, secrets StatefulSpecSecretParams,
) (appsv1.StatefulSetSpec, error)

StatefulSpec returns spec for stateful set TODO: Unify Arbiter and Node. Shoudn't be 100500 parameters

Types

type Credentials added in v1.10.0

type Credentials struct {
	Username string
	Password string
}

type ServiceAddr

type ServiceAddr struct {
	Host string
	Port int
}

func GetServiceAddr

func GetServiceAddr(ctx context.Context, svc corev1.Service, pod corev1.Pod, cl client.Client) (*ServiceAddr, error)

func (ServiceAddr) String

func (s ServiceAddr) String() string

type StatefulConfigParams added in v1.21.0

type StatefulConfigParams struct {
	MongoDConf        config.CustomConfig
	LogCollectionConf config.CustomConfig
}

type StatefulSpecSecretParams added in v1.20.0

type StatefulSpecSecretParams struct {
	UsersSecret *corev1.Secret
	SSLSecret   *corev1.Secret
}

StatefulSpecSecretParams contains secrets params for the StatefulSpec.

Directories

Path Synopsis
tls

Jump to

Keyboard shortcuts

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