core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PasswordLen    = 8
	DefaultPort    = 27017
	DefaultPortStr = "27017"
	DefaultDBPath  = "/data/db"
	ContainerName  = "mongo"

	SuffixSecretName    = "-keyfile-secret"
	SuffixKeyfileVolume = "-keyfile-secret-volume"
	KeyfileMountPath    = "/etc/keyfile-secret"
	KeyfileSecretKey    = "mongo-keyfile"

	SuffixConfigVolume = "-config-volume"
	ConfigMountPath    = "/etc/mongo-config"
	ConfigMongodKey    = "mongod.yaml"

	LabelKeyInstance     = "app.kubernetes.io/instance"
	LabelKeyClusterVIP   = "app.multicloudmongodb.io/vip"
	LabelKeyApp          = "app"
	LabelKeyRole         = "role"
	LabelKeyReplsetName  = "replSetName"
	LabelKeyArbiter      = "arbiter"
	LabelKeyData         = "data"
	LabelKeyRevisionHash = "mongodb.k8s.io/revision-hash"

	LabelValIndex      = "index"
	LabelValStandalone = "standalone"
	LabelValReplset    = "replset"
	LabelValConfigsvr  = "configsvr"
	LabelValShardsvr   = "shardsvr"
	LabelValMongos     = "mongos"

	LabelValTrue     = "true"
	LabelValExporter = "exporter"
	// exporter default value
	DefaultMetricsPort     = 9216
	DefaultMetricsPortName = "metrics"
	ExporterContainerName  = "metrics-exporter"

	HostnameTopologyKey = "kubernetes.io/hostname"
)

Variables

View Source
var (
	DefaultLabels = map[string]string{
		"app.kubernetes.io/managed-by": "multicloud-mongo-operator",
	}
)
View Source
var (
	PodSorterById podSorter = func(i, j *corev1.Pod) bool {
		return StaticPodUtil.GetOrdinal(i) < StaticPodUtil.GetOrdinal(j)
	}
)
View Source
var StaticConfigMapUtil = new(configMapUtil)
View Source
var StaticLabelUtil = new(labelUtil)
View Source
var StaticMongoInfoUtil = new(mongoInfo)
View Source
var StaticPodUtil = new(podUtil)
View Source
var StaticReplSetUtil = new(replSetUtil)
View Source
var StaticSecretUtil = new(secretUtil)
View Source
var StaticStatusUtil = &statusUtil{

	ConditionCheckerExistAndTrue: func(c *middlewarev1alpha1.MongoCondition) bool {
		return c != nil && c.Status == middlewarev1alpha1.ConditionStatusTrue
	},

	ConditionCheckerExistAndFalse: func(c *middlewarev1alpha1.MongoCondition) bool {
		return c != nil && c.Status == middlewarev1alpha1.ConditionStatusFalse
	},
}

Functions

func NewResourceBuilder

func NewResourceBuilder(cr *middlewarev1alpha1.MongoDB) *resourceBuilder

Types

type ConditionChecker

type ConditionChecker func(c *middlewarev1alpha1.MongoCondition) bool

type MongoBase

type MongoBase struct {
	Base *base // 封装通用逻辑,区别interface方法
}

func (*MongoBase) EnsureSecret

func (s *MongoBase) EnsureSecret() error

创建secret

func (*MongoBase) GetBase

func (s *MongoBase) GetBase() *MongoBase

func (*MongoBase) GetCr

func (s *MongoBase) GetCr() *middlewarev1alpha1.MongoDB

type PodBucket

type PodBucket struct {
	Miss      []int         // 缺失的id
	Ok        []*corev1.Pod // 正常的pod
	Pending   []*corev1.Pod // 等待中的pod
	Failed    []*corev1.Pod // 失败的pod
	Redundant []*corev1.Pod // 多余的pod
}

pod分类桶

type PodController

type PodController struct {
	Ensure func(ids []int) error
	Delete func(pods []*corev1.Pod) error
}

Jump to

Keyboard shortcuts

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