config

package
v0.0.0-...-331d270 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 19 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.

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 (
	// MonType defines the mon DaemonType
	MonType = "mon"

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

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

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

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

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

	// FilesystemMirrorType defines the fs-mirror DaemonType
	FilesystemMirrorType = "fs-mirror"

	// CrashType defines the crash collector DaemonType
	CrashType = "crashcollector"

	// CephUser is the Linux Ceph username
	CephUser = "ceph"

	// CephGroup is the Linux Ceph groupname
	CephGroup = "ceph"
)
View Source
const (
	// StoreName is the name of the configmap containing ceph configuration options
	StoreName = "rook-ceph-config"

	// 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 overwritable 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 overwritable 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 overwritable 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"

	// VarLibCephCrashDir defines Ceph crash reports directory.
	VarLibCephCrashDir = path.Join(VarLibCephDir, "crash")
)

Functions

func ConfigureLivenessProbe

func ConfigureLivenessProbe(container v1.Container, livenessProbe *cephv1.ProbeSpec) v1.Container

ConfigureLivenessProbe returns the desired liveness probe for a given daemon

func ConfigureStartupProbe

func ConfigureStartupProbe(container v1.Container, startupProbe *cephv1.ProbeSpec) v1.Container

ConfigureStartupProbe returns the desired startup probe for a given daemon

func DefaultCentralizedConfigs

func DefaultCentralizedConfigs(cephVersion version.CephVersion) map[string]string

DefaultCentralizedConfigs returns the default configuration options Rook will set in Ceph's centralized config store.

func DefaultFlags

func DefaultFlags(fsid, mountedKeyringPath string) []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 DisableInsecureGlobalID

func DisableInsecureGlobalID(context *clusterd.Context, clusterInfo *cephclient.ClusterInfo)

func GetProbeWithDefaults

func GetProbeWithDefaults(desiredProbe, currentProbe *v1.Probe) *v1.Probe

func LoggingFlags

func LoggingFlags() []string

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 SetOrRemoveDefaultConfigs

func SetOrRemoveDefaultConfigs(
	context *clusterd.Context,
	clusterInfo *cephclient.ClusterInfo,
	clusterSpec cephv1.ClusterSpec,
) error

SetOrRemoveDefaultConfigs sets Rook's desired default configs in the centralized monitor database. This cannot be called before at least one monitor is established. Also, legacy options will be removed

func StoredMonHostEnvVarFlags

func StoredMonHostEnvVarFlags() []string

StoredMonHostEnvVarFlags returns Ceph commandline flag references to "mon_host" and "mon_initial_members" sourced from the StoredMonHostEnvVars.

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 CephConfigOptionsMap

type CephConfigOptionsMap = map[string]map[string]string

Alias for cluster CRD ceph config options map

type DataPathMap

type DataPathMap struct {
	// HostDataDir should be set to the path on the host where the specific daemon's data is stored.
	// If this is empty, the daemon does not persist data to the host, but data may still be shared
	// between containers in a pod via an empty dir.
	HostDataDir string

	// ContainerDataDir should be set to the path in the container where the specific daemon's data
	// is stored. If this is empty, the daemon does not store data at all, even in the container,
	// and data is not shared between container in a pod via empty dir.
	ContainerDataDir string

	// HostLogAndCrashDir dir represents Ceph's logging and crash dump dir on the host.
	// Logs are stored in the "log" subdir and crash dumps in the "crash" subdir of this directory.
	// If this is empty logs are not persisted to the host.
	// The log dir is always /var/log/ceph. If logs are not persisted to the
	// host, logs are not shared between containers via empty dir or any other mechanism.
	HostLogAndCrashDir 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, 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, daemonID, namespace, dataDirHostPath string,
) *DataPathMap

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

func (*DataPathMap) ContainerCrashDir

func (d *DataPathMap) ContainerCrashDir() string

ContainerCrashDir returns the directory of the crash collector

func (*DataPathMap) ContainerLogDir

func (d *DataPathMap) ContainerLogDir() string

ContainerLogDir returns the directory of the Ceph logs

func (*DataPathMap) HostCrashDir

func (d *DataPathMap) HostCrashDir() string

HostCrashDir returns the directory path on the host for Ceph crashes

func (*DataPathMap) HostLogDir

func (d *DataPathMap) HostLogDir() string

HostLogDir returns the directory path on the host for Ceph logs

type MonStore

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

MonStore provides methods for setting Ceph configurations in the centralized mon configuration database.

func GetMonStore

func GetMonStore(context *clusterd.Context, clusterInfo *client.ClusterInfo) *MonStore

GetMonStore returns a new MonStore for the cluster.

func (*MonStore) Delete

func (m *MonStore) Delete(who, option string) error

Delete a config in the centralized mon configuration database.

func (*MonStore) DeleteAll

func (m *MonStore) DeleteAll(options ...Option) error

DeleteAll deletes all provided configs from the overrides in the centralized mon configuration database. See MonStore.Delete for more.

func (*MonStore) DeleteDaemon

func (m *MonStore) DeleteDaemon(who string) error

DeleteDaemon delete all configs for a specific daemon in the centralized mon configuration database.

func (*MonStore) Get

func (m *MonStore) Get(who, option string) (string, error)

Get retrieves a config in the centralized mon configuration database. https://docs.ceph.com/docs/master/rados/configuration/ceph-conf/#monitor-configuration-database

func (*MonStore) GetDaemon

func (m *MonStore) GetDaemon(who string) ([]Option, error)

GetDaemon retrieves all configs for a specific daemon in the centralized mon configuration database.

func (*MonStore) Set

func (m *MonStore) Set(who, option, value string) error

Set sets a config in the centralized mon configuration database. https://docs.ceph.com/docs/master/rados/configuration/ceph-conf/#monitor-configuration-database

func (*MonStore) SetAll

func (m *MonStore) SetAll(who string, settings map[string]string) error

func (*MonStore) SetAllMultiple

func (m *MonStore) SetAllMultiple(settings map[string]map[string]string) error

func (*MonStore) SetIfChanged

func (m *MonStore) SetIfChanged(who, option, value string) (bool, error)

SetIfChanged sets a config in the centralized mon configuration database if the config has changed value. https://docs.ceph.com/docs/master/rados/configuration/ceph-conf/#monitor-configuration-database

There is a bug through at least Ceph v18 where `ceph config get global <option>` does not work. As a workaround it is possible to use `ceph config get client <option>` as long as the config option won't be overridden by clients. SetIfChanged uses this workaround assuming it is valid. Any new uses of this function should take extreme care when using `who="global"` to check that the workaround is valid for usage with the given option. Options validated for workaround by Ceph devs: public_network, cluster_network

func (*MonStore) SetKeyValue

func (m *MonStore) SetKeyValue(key, value string) error

SetKeyValue sets an arbitrary key/value pair in Ceph's general purpose (as opposed to configuration-specific) key/value store. Keys and values can be any arbitrary string including spaces, underscores, dashes, and slashes. See: https://docs.ceph.com/en/quincy/man/8/ceph/#config-key

func (*MonStore) UpdateConfigStoreFromMap

func (m *MonStore) UpdateConfigStoreFromMap(cfg CephConfigOptionsMap) error

type Option

type Option struct {
	// Who is the entity(-ies) the option should apply to.
	Who string

	// Option is the option key
	Option string

	// Value is the value for the option
	Value string
}

Option defines the pieces of information relevant to Ceph configuration options.

func LegacyConfigs

func LegacyConfigs() []Option

LegacyConfigs represents old configuration that were applied to a cluster and not needed anymore

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, ownerInfo *k8sutil.OwnerInfo) *Store

GetStore returns the Store for the cluster.

func (*Store) CreateOrUpdate

func (s *Store) CreateOrUpdate(clusterInfo *cephclient.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