mon

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package mon provides methods for creating clusters of Ceph mons in Kubernetes, for monitoring the cluster's status, for taking corrective actions if the status is non-ideal, and for reporting mon cluster failures.

Index

Constants

View Source
const (
	// EndpointConfigMapName is the name of the configmap with mon endpoints
	EndpointConfigMapName = "rook-ceph-mon-endpoints"
	// EndpointDataKey is the name of the key inside the mon configmap to get the endpoints
	EndpointDataKey = "data"
	// MaxMonIDKey is the name of the max mon id used
	MaxMonIDKey = "maxMonId"
	// MappingKey is the name of the mapping for the mon->node and node->port
	MappingKey = "mapping"

	// AppName is the name of the secret storing cluster mon.admin key, fsid and name
	AppName = "rook-ceph-mon"

	// DefaultMonCount Default mon count for a cluster
	DefaultMonCount = 3
	// MaxMonCount Maximum allowed mon count for a cluster
	MaxMonCount = 9

	// DefaultMsgr1Port is the default port Ceph mons use to communicate amongst themselves prior
	// to Ceph Nautilus.
	DefaultMsgr1Port int32 = 6789
	// DefaultMsgr2Port is the listening port of the messenger v2 protocol introduced in Ceph
	// Nautilus. In Nautilus and a few Ceph releases after, Ceph can use both v1 and v2 protocols.
	DefaultMsgr2Port int32 = 3300
)

Variables

View Source
var (
	// HealthCheckInterval is the interval to check if the mons are in quorum
	HealthCheckInterval = 45 * time.Second
	// MonOutTimeout is the duration to wait before removing/failover to a new mon pod
	MonOutTimeout = 600 * time.Second
)

Functions

func AdminSecretEnvVar

func AdminSecretEnvVar() v1.EnvVar

AdminSecretEnvVar is the admin secret environment var

func ClusterNameEnvVar

func ClusterNameEnvVar(name string) v1.EnvVar

ClusterNameEnvVar is the cluster name environment var

func EndpointEnvVar

func EndpointEnvVar() v1.EnvVar

EndpointEnvVar is the mon endpoint environment var

func FlattenMonEndpoints added in v1.0.0

func FlattenMonEndpoints(mons map[string]*cephconfig.MonInfo) string

FlattenMonEndpoints returns a comma-delimited string of all mons and endpoints in the form <mon-name>=<mon-endpoint>

func ParseMonEndpoints added in v1.0.0

func ParseMonEndpoints(input string) map[string]*cephconfig.MonInfo

ParseMonEndpoints parses a flattened representation of mons and endpoints in the form <mon-name>=<mon-endpoint> and returns a list of Ceph mon configs.

func PodSecurityContext added in v1.1.0

func PodSecurityContext() *v1.SecurityContext

PodSecurityContext detects if the pod needs privileges to run

func SecretEnvVar

func SecretEnvVar() v1.EnvVar

SecretEnvVar is the mon secret environment var

func UpdateCephDeploymentAndWait added in v1.1.0

func UpdateCephDeploymentAndWait(context *clusterd.Context, deployment *apps.Deployment, namespace, daemonType, daemonName string, cephVersion cephver.CephVersion, isUpgrade, skipUpgradeChecks bool) error

UpdateCephDeploymentAndWait verifies a deployment can be stopped or continued

func WriteConnectionConfig

func WriteConnectionConfig(context *clusterd.Context, clusterInfo *cephconfig.ClusterInfo) error

WriteConnectionConfig save monitor connection config to disk

Types

type Cluster

type Cluster struct {
	ClusterInfo *cephconfig.ClusterInfo

	Namespace string
	Keyring   string

	Port    int32
	Network cephv1.NetworkSpec
	// contains filtered or unexported fields
}

Cluster represents the Rook and environment configuration settings needed to set up Ceph mons.

func New

func New(context *clusterd.Context, namespace, dataDirHostPath string, network cephv1.NetworkSpec, ownerRef metav1.OwnerReference, csiConfigMutex *sync.Mutex, isUpgrade bool) *Cluster

New creates an instance of a mon cluster

func (*Cluster) Start

func (c *Cluster) Start(clusterInfo *cephconfig.ClusterInfo, rookVersion string, cephVersion cephver.CephVersion, spec cephv1.ClusterSpec, isUpgrade bool) (*cephconfig.ClusterInfo, error)

Start begins the process of running a cluster of Ceph mons.

type HealthChecker

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

HealthChecker aggregates the mon/cluster info needed to check the health of the monitors

func NewHealthChecker

func NewHealthChecker(monCluster *Cluster, clusterSpec *cephv1.ClusterSpec) *HealthChecker

NewHealthChecker creates a new HealthChecker object

func (*HealthChecker) Check

func (hc *HealthChecker) Check(stopCh chan struct{})

Check periodically checks the health of the monitors

type Mapping

type Mapping struct {
	Node map[string]*NodeInfo `json:"node"`
}

Mapping is mon node and port mapping

func CreateOrLoadClusterInfo

func CreateOrLoadClusterInfo(context *clusterd.Context, namespace string, ownerRef *metav1.OwnerReference) (*cephconfig.ClusterInfo, int, *Mapping, error)

CreateOrLoadClusterInfo constructs or loads a clusterinfo and returns it along with the maxMonID

func LoadClusterInfo

func LoadClusterInfo(context *clusterd.Context, namespace string) (*cephconfig.ClusterInfo, int, *Mapping, error)

LoadClusterInfo constructs or loads a clusterinfo and returns it along with the maxMonID

type NodeInfo

type NodeInfo struct {
	Name     string
	Hostname string
	Address  string
}

NodeInfo contains name and address of a node

type NodeUsage added in v1.1.0

type NodeUsage struct {
	Node *v1.Node
	// The number of monitor pods assigned to the node
	MonCount int
	// The node is available for scheduling monitor pods. This is equivalent to
	// evaluating k8sutil.ValidNode(node, cephv1.GetMonPlacement(c.spec.Placement))
	MonValid bool
}

NodeUsage is a mapping between a Node and computed metadata about the node that is used in monitor pod scheduling.

type SchedulingResult added in v1.1.0

type SchedulingResult struct {
	Node             *v1.Node
	CanaryDeployment string
	CanaryPVC        string
}

Jump to

Keyboard shortcuts

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