common

package
v0.0.0-...-2f11636 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabelCrName    = "app.kubernetes.io/name"
	LabelComponent = "app.kubernetes.io/component"
	LabelManagedBy = "app.kubernetes.io/managed-by"
)
View Source
const (
	INIT_LIMIT = "initLimit"
	SYNC_LIMIT = "syncLimit"
	TICK_TIME  = "tickTime"
	DATA_DIR   = "dataDir"

	MyIdOffset     = "MYID_OFFSET"
	ServerJvmFlags = "SERVER_JVMFLAGS"
	ZKServerHeap   = "ZK_SERVER_HEAP"

	DefaultServerGrace = 120
	DefaultInitLimit   = 5
	DefaultSyncLimit   = 2
	DefaultTickTime    = 3000
	DefaultMyidOffset  = 1
)
View Source
const (
	ZkServerContainerName = "zookeeper"
)

Variables

This section is empty.

Functions

func ClusterServiceName

func ClusterServiceName(instanceName string) string

func CreateClientConnectionString

func CreateClientConnectionString(statefulSetName string, replicates, clientPort int32, svcName string, ns string) string

func DefautlSercurityProperties

func DefautlSercurityProperties() map[string]string

│ networkaddress.cache.negative.ttl=0 │ networkaddress.cache.ttl=5

func HeapLimit

func HeapLimit(resource *commonsv1alpha1.ResourcesSpec) *string

HeapLimit returns the heap limit for the JVM based on the memory limit

func NewDiscoverConfigmapBuilder

func NewDiscoverConfigmapBuilder(
	client *client.Client,
	name string,
	discovery Discoverer,
	options ...builder.Option,
) builder.ConfigBuilder

func NewDiscoveryReconcilers

func NewDiscoveryReconcilers(
	ctx context.Context,
	client *client.Client,
	zkCluster *zkv1alpha1.ZookeeperCluster,
	zkSecurity *security.ZookeeperSecurity,
	znodeInfo *ZNodeInfo,
	options ...builder.Option,
) []reconciler.ResourceReconciler[builder.ConfigBuilder]

func PodFQDN

func PodFQDN(podName, svcName, namespace string) string

func RoleGroupConfigMapName

func RoleGroupConfigMapName(roleGroupInfo *reconciler.RoleGroupInfo) string

func RoleGroupServiceName

func RoleGroupServiceName(roleGroupInfo *reconciler.RoleGroupInfo) string

func StatefulsetName

func StatefulsetName(roleGroupInfo *reconciler.RoleGroupInfo) string

Types

type AffinityBuilder

type AffinityBuilder struct {
	PodAffinity []PodAffinity
}

func NewAffinityBuilder

func NewAffinityBuilder(
	podAffinity ...PodAffinity,
) *AffinityBuilder

func (*AffinityBuilder) AddPodAffinity

func (a *AffinityBuilder) AddPodAffinity(podAffinity PodAffinity) *AffinityBuilder

func (*AffinityBuilder) Build

func (a *AffinityBuilder) Build() *corev1.Affinity

type DiscoverConfigmapBuilder

type DiscoverConfigmapBuilder struct {
	builder.ConfigMapBuilder
	// contains filtered or unexported fields
}

func (*DiscoverConfigmapBuilder) Build

type Discoverer

type Discoverer interface {
	GetZookeeperConnection(ctx context.Context) (*ZookeeperConnection, error)
}

func NewDiscoverer

func NewDiscoverer(
	client *client.Client,
	zkCluster *zkv1alpha1.ZookeeperCluster,
	zkSecurity *security.ZookeeperSecurity,
	znodeInfo *ZNodeInfo,
	listenerClass zkv1alpha1.ListenerClass,
) Discoverer

type GeneralNodeConfig

type GeneralNodeConfig struct {
	Affinity *corev1.Affinity
	// contains filtered or unexported fields
}

func (*GeneralNodeConfig) GetgracefulShutdownTimeoutSeconds

func (G *GeneralNodeConfig) GetgracefulShutdownTimeoutSeconds() *string

type NodeAffinity

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

func (*NodeAffinity) Weight

func (n *NodeAffinity) Weight(weight int32) *NodeAffinity

type PodAffinity

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

func NewPodAffinity

func NewPodAffinity(labels map[string]string, affinityRequired, anti bool) *PodAffinity

func (*PodAffinity) Weight

func (p *PodAffinity) Weight(weight int32) *PodAffinity

type Role

type Role string
const (
	Server Role = "server"
)

type RoleLabels

type RoleLabels[T client.Object] struct {
	Cr   T
	Name string
}

func (*RoleLabels[T]) GetLabels

func (r *RoleLabels[T]) GetLabels() map[string]string

type ZNodeInfo

type ZNodeInfo struct {
	Name      string
	Namespace string
	ZNodePath string
}

type ZookeeperConfig

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

ZookeeperConfig defines the desired state of ZookeeperServer

func DefaultServerConfig

func DefaultServerConfig(clusterName string) ZookeeperConfig

func (*ZookeeperConfig) MergeDefaultConfig

func (n *ZookeeperConfig) MergeDefaultConfig(
	mergedCfg *zkv1alpha1.ConfigSpec,
	overrides *commonsv1alpha1.OverridesSpec,
) error

type ZookeeperConnection

type ZookeeperConnection struct {
	URI   string
	Hosts []string
	Port  int32
	ZNode string
}

Jump to

Keyboard shortcuts

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