config

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package config provides methods for creating and formatting Ceph configuration files for daemons.

Index

Constants

View Source
const (
	// DefaultKeyringFile is the default name of the file where Ceph stores its keyring info
	DefaultKeyringFile = "keyring"
	// Msgr2port is the listening port of the messenger v2 protocol
	Msgr2port = 3300
)
View Source
const (
	// AdminKeyringTemplate is a string template of Ceph keyring settings which allow connection
	// as admin. The key value must be filled in by the admin auth key for the cluster.
	AdminKeyringTemplate = `
[client.admin]
	key = %s
	caps mds = "allow *"
	caps mon = "allow *"
	caps osd = "allow *"
	caps mgr = "allow *"
`
)

Variables

View Source
var (
	// DefaultConfigDir is the default dir where Ceph stores its configs. Can be overridden for unit
	// tests.
	DefaultConfigDir = "/etc/ceph"

	// DefaultConfigFile is the default name of the file where Ceph stores its configs. Can be
	// overridden for unit tests.
	DefaultConfigFile = "ceph.conf"
)

Functions

func AdminKeyring

func AdminKeyring(c *ClusterInfo) string

AdminKeyring returns the filled-out admin keyring

func CreateKeyring

func CreateKeyring(context *clusterd.Context, clusterName, username, keyringPath string, access []string, generateContents func(string) string) error

CreateKeyring creates a keyring for access to the cluster with the desired set of privileges and writes it to disk at the keyring path

func DefaultConfigFilePath

func DefaultConfigFilePath() string

DefaultConfigFilePath returns the full path to Ceph's default config file

func DefaultKeyringFilePath

func DefaultKeyringFilePath() string

DefaultKeyringFilePath returns the full path to Ceph's default keyring file

func GenerateAdminConnectionConfig

func GenerateAdminConnectionConfig(context *clusterd.Context, cluster *ClusterInfo) (string, error)

GenerateAdminConnectionConfig calls GenerateAdminConnectionConfigWithSettings with no settings overridden.

func GenerateAdminConnectionConfigWithSettings

func GenerateAdminConnectionConfigWithSettings(context *clusterd.Context, cluster *ClusterInfo, settings *CephConfig) (string, error)

GenerateAdminConnectionConfigWithSettings generates a Ceph config and keyring which will allow the daemon to connect as an admin. Default config file settings can be overridden by specifying some subset of settings.

func GenerateConfigFile

func GenerateConfigFile(context *clusterd.Context, cluster *ClusterInfo, pathRoot, user, keyringPath string, globalConfig *CephConfig, clientSettings map[string]string) (string, error)

GenerateConfigFile generates and writes a config file to disk.

func GetConfFilePath

func GetConfFilePath(root, clusterName string) string

GetConfFilePath gets the path of a given cluster's config file

func WriteKeyring

func WriteKeyring(keyringPath, authKey string, generateContents func(string) string) error

WriteKeyring calls the generate contents function with auth key as an argument then saves the output of the generateContents function to disk at the keyring path TODO: Kludgey; can keyring files be generated w/ go-ini package or using the '-o' option to 'ceph auth get-or-create ...'?

Types

type CephConfig

type CephConfig struct {
	*GlobalConfig `ini:"global,omitempty"`
}

CephConfig represents an entire Ceph config including all sections.

func CreateDefaultCephConfig

func CreateDefaultCephConfig(context *clusterd.Context, cluster *ClusterInfo) (*CephConfig, error)

CreateDefaultCephConfig creates a default ceph config file.

type ClusterInfo

type ClusterInfo struct {
	FSID          string
	MonitorSecret string
	AdminSecret   string
	Name          string
	Monitors      map[string]*MonInfo
	CephVersion   cephver.CephVersion
}

ClusterInfo is a collection of information about a particular Ceph cluster. Rook uses information about the cluster to configure daemons to connect to the desired cluster.

func (*ClusterInfo) IsInitialized added in v1.0.0

func (c *ClusterInfo) IsInitialized() bool

IsInitialized returns true if the critical information in the ClusterInfo struct has been filled in. This method exists less out of necessity than the desire to be explicit about the lifecycle of the ClusterInfo struct during startup, specifically that it is expected to exist after the Rook operator has started up or connected to the first components of the Ceph cluster.

func (*ClusterInfo) Log

func (c *ClusterInfo) Log(logger *capnslog.PackageLogger)

Log writes the cluster info struct to the logger

type GlobalConfig

type GlobalConfig struct {
	EnableExperimental       string `ini:"enable experimental unrecoverable data corrupting features,omitempty"`
	FSID                     string `ini:"fsid,omitempty"`
	MonMembers               string `ini:"mon initial members,omitempty"`
	MonHost                  string `ini:"mon host"`
	LogFile                  string `ini:"log file,omitempty"`
	MonClusterLogFile        string `ini:"mon cluster log file,omitempty"`
	PublicAddr               string `ini:"public addr,omitempty"`
	PublicNetwork            string `ini:"public network,omitempty"`
	ClusterAddr              string `ini:"cluster addr,omitempty"`
	ClusterNetwork           string `ini:"cluster network,omitempty"`
	MonKeyValueDb            string `ini:"mon keyvaluedb"`
	MonAllowPoolDelete       bool   `ini:"mon_allow_pool_delete"`
	MaxPgsPerOsd             int    `ini:"mon_max_pg_per_osd"`
	DebugLogDefaultLevel     int    `ini:"debug default"`
	DebugLogRadosLevel       int    `ini:"debug rados"`
	DebugLogMonLevel         int    `ini:"debug mon"`
	DebugLogOSDLevel         int    `ini:"debug osd"`
	DebugLogBluestoreLevel   int    `ini:"debug bluestore"`
	DebugLogFilestoreLevel   int    `ini:"debug filestore"`
	DebugLogJournalLevel     int    `ini:"debug journal"`
	DebugLogLevelDBLevel     int    `ini:"debug leveldb"`
	FileStoreOmapBackend     string `ini:"filestore_omap_backend"`
	OsdPgBits                int    `ini:"osd pg bits,omitempty"`
	OsdPgpBits               int    `ini:"osd pgp bits,omitempty"`
	OsdPoolDefaultSize       int    `ini:"osd pool default size,omitempty"`
	OsdPoolDefaultPgNum      int    `ini:"osd pool default pg num,omitempty"`
	OsdPoolDefaultPgpNum     int    `ini:"osd pool default pgp num,omitempty"`
	OsdMaxObjectNameLen      int    `ini:"osd max object name len,omitempty"`
	OsdMaxObjectNamespaceLen int    `ini:"osd max object namespace len,omitempty"`
	OsdObjectStore           string `ini:"osd objectstore,omitempty"`
	RbdDefaultFeatures       int    `ini:"rbd_default_features,omitempty"`
	FatalSignalHandlers      string `ini:"fatal signal handlers"`
}

GlobalConfig represents the [global] sections of Ceph's config file.

type MonInfo

type MonInfo struct {
	Name     string `json:"name"`
	Endpoint string `json:"endpoint"`
}

MonInfo is a collection of information about a Ceph mon.

func NewMonInfo

func NewMonInfo(name, ip string, port int32) *MonInfo

NewMonInfo returns a new Ceph mon info struct from the given inputs.

Jump to

Keyboard shortcuts

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