config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package config provides methods for generating the Ceph config for a Ceph cluster and for producing a "ceph.conf" compatible file from the config as well as Ceph command line-compatible flags.

Package config provides a shared way of referring to data storage locations for Ceph Daemons, including both the in-container location and on-host location as well as whether the data is persisted to the host.

Package config provides default configurations which Rook will set in Ceph clusters.

Package config allows a ceph config file to be stored in Kubernetes and mounted as volumes into Ceph daemon containers.

Index

Constants

View Source
const (

	// Msgr2port is the listening port of the messenger v2 protocol
	Msgr2port = 3300
)

Variables

View Source
var (
	// VarLibCephDir is simply "/var/lib/ceph". It is made overwriteable only for unit tests where it
	// may be needed to send data intended for /var/lib/ceph to a temporary test dir.
	VarLibCephDir = "/var/lib/ceph"

	// EtcCephDir is simply "/etc/ceph". It is made overwriteable only for unit tests where it
	// may be needed to send data intended for /etc/ceph to a temporary test dir.
	EtcCephDir = "/etc/ceph"

	// VarLogCephDir defines Ceph logging directory. It is made overwriteable only for unit tests where it
	// may be needed to send data intended for /var/log/ceph to a temporary test dir.
	VarLogCephDir = "/var/log/ceph"
)

Functions

func DefaultFlags

func DefaultFlags(fsid, mountedKeyringPath string, cephVersion version.CephVersion) []string

DefaultFlags returns the default configuration flags Rook will set on the command line for all calls to Ceph daemons and tools. Values specified here will not be able to be overridden using the mon's central KV store, and that is (and should be) by intent.

func NewFlag

func NewFlag(key, value string) string

NewFlag returns the key-value pair in the format of a Ceph command line-compatible flag.

func StoredFileVolume

func StoredFileVolume() v1.Volume

StoredFileVolume returns a pod volume sourced from the stored config file.

func StoredFileVolumeMount

func StoredFileVolumeMount() v1.VolumeMount

StoredFileVolumeMount returns a container volume mount that mounts the stored config from StoredFileVolume into the container at `/etc/ceph/ceph.conf`.

func StoredMonHostEnvVars

func StoredMonHostEnvVars() []v1.EnvVar

StoredMonHostEnvVars returns a container environment variable defined by the most updated stored "mon_host" and "mon_initial_members" information.

Types

type Config

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

Config is a Ceph config struct containing zero or more Ceph config sections.

func DefaultCentralizedConfigs

func DefaultCentralizedConfigs(cephVersion version.CephVersion) *Config

DefaultCentralizedConfigs returns the default configuration options Rook will set in Ceph's centralized config store. If the version of Ceph does not support the centralized config store, these will be set in a shared config file instead.

func DefaultLegacyConfigs

func DefaultLegacyConfigs() *Config

DefaultLegacyConfigs need to be added to the Ceph config file until the integration tests can be made to override these options for the Ceph clusters it creates.

func NewConfig

func NewConfig() *Config

NewConfig returns a new, blank Ceph Config.

func StoredMonHostEnvVarReferences

func StoredMonHostEnvVarReferences() *Config

StoredMonHostEnvVarReferences returns a small Ceph Config which references "mon_host" and "mon_initial_members" information from the StoredMonHostEnvVars. This config can be used to generate flags referencing the env vars or to generate the string representation of a Config.

func (*Config) GlobalFlags

func (c *Config) GlobalFlags() []string

GlobalFlags converts the Config's 'global' Section to a list of command line flag strings which can be used with Kubernetes container specs for Ceph daemons.

It should never be necessary to get flags for anything but the 'global' config section, otherwise, Rook will have to determine which sections apply for a given Ceph daemon. Does 'mon.a' apply to 'mon.b'? 'mon.aa'? 'osd.0'? The logic would be prone to errors, so only allow the 'global' section to be converted to flags.

func (*Config) IniFile

func (c *Config) IniFile() (*ini.File, error)

IniFile converts the Ceph Config to an *ini.File.

func (*Config) Merge

func (c *Config) Merge(overrides *Config)

Merge modifies the Config in-place, adding Sections from the overrides config, and overriding existing Sections with Section values from overrides.

func (*Config) Section

func (c *Config) Section(name string) *Section

Section returns a Ceph config Section with the given name from the Config. If the section does not exist, a new empty section is created and returned for the caller's use.

type DaemonType

type DaemonType string

DaemonType defines the type of a daemon. e.g., mon, mgr, osd, mds, rgw

const (
	// MonType defines the mon DaemonType
	MonType DaemonType = "mon"

	// MgrType defines the mgr DaemonType
	MgrType DaemonType = "mgr"

	// OsdType defines the osd DaemonType
	OsdType DaemonType = "osd"

	// MdsType defines the mds DaemonType
	MdsType DaemonType = "mds"

	// RgwType defines the rgw DaemonType
	RgwType DaemonType = "rgw"

	// RbdMirrorType defines the rbd-mirror DaemonType
	RbdMirrorType DaemonType = "rbd-mirror"
)

type DataPathMap

type DataPathMap struct {
	// PersistData is true if the daemon's data should be persisted to the host.
	PersistData bool

	// If PersistData is true, HostDataDIr should be set to the path on the host where the specific
	// daemon's data is stored.
	HostDataDir string

	// If NoData is true, the daemon has no data to store.
	NoData bool

	// ContainerDataDir should be set to the path in the container where the specific daemon's data
	// is stored.
	ContainerDataDir string

	// HostLogDir represents Ceph's logging directory on the host
	HostLogDir string

	// ContainerLogDir represents Ceph's logging directory
	ContainerLogDir string
}

A DataPathMap is a struct which contains information about where Ceph daemon data is stored in containers and whether the data should be persisted to the host. If it is persisted to the host, directory on the host where the specific daemon's data is stored is given.

func NewDatalessDaemonDataPathMap

func NewDatalessDaemonDataPathMap(namespace, dataDirHostPath string) *DataPathMap

NewDatalessDaemonDataPathMap returns a new DataPathMap for a daemon which does not utilize a data dir in the container as the mon, mgr, osd, mds, and rgw daemons do

func NewStatefulDaemonDataPathMap

func NewStatefulDaemonDataPathMap(
	dataDirHostPath, daemonDataDirHostRelativePath string,
	daemonType DaemonType, daemonID, namespace string,
) *DataPathMap

NewStatefulDaemonDataPathMap returns a new DataPathMap for a daemon which requires a persistent config (mons, osds). daemonDataDirHostRelativePath is the path relative to the dataDirHostPath where the daemon's data is stored on the host's filesystem. Daemons which use a DataPathMap created by this method will only have access to their own data and not the entire dataDirHostPath which may include data from other daemons.

func NewStatelessDaemonDataPathMap

func NewStatelessDaemonDataPathMap(
	daemonType DaemonType, daemonID, namespace, dataDirHostPath string,
) *DataPathMap

NewStatelessDaemonDataPathMap returns a new DataPathMap for a daemon which does not persist data to the host (mgrs, mdses, rgws)

type Section

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

A Section is a collection of zero or more Ceph config key-value pairs.

func (*Section) Merge

func (s *Section) Merge(overrides *Section)

Merge modifies the Section in-place adding values from the overrides Section and overriding existing values with the new value in overrides.

func (*Section) Set

func (s *Section) Set(key, value string) *Section

Set sets the Ceph config key to the given value. Set accepts Ceph keys in both space-separated-words and underscore-separated-words formats. Set modifies the section in-place and also returns the same modified-in-place Section to give flexibility of usage.

NOTE that if a config item in a map should have quotes around it, they will have to be added to the string explicitly. e.g., a Value of " test " will be interpreted as as 'Key = test', whereas a Value of "\" test \"" will be interpreted as 'Key = " test "'

type Store

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

Store manages storage of the Ceph config file shared by all daemons (if applicable) as well as an updated 'mon_host' which can be mapped to daemon containers and referenced in daemon command line arguments.

func GetStore

func GetStore(context *clusterd.Context, namespace string, ownerRef *metav1.OwnerReference) *Store

GetStore returns the Store for the cluster.

func (*Store) CreateOrUpdate

func (s *Store) CreateOrUpdate(clusterInfo *cephconfig.ClusterInfo) error

CreateOrUpdate creates or updates the stored Ceph config based on the cluster info.

Directories

Path Synopsis
Package keyring provides methods for accessing keyrings for Ceph daemons stored securely in Kubernetes secrets.
Package keyring provides methods for accessing keyrings for Ceph daemons stored securely in Kubernetes secrets.

Jump to

Keyboard shortcuts

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