config

package
v0.0.0-...-6f3db3d Latest Latest
Warning

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

Go to latest
Published: Feb 26, 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 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 PopulateMonHostMembers

func PopulateMonHostMembers(monitors map[string]*MonInfo) ([]string, []string)

PopulateMonHostMembers extracts a list of just the monitor names, which will populate the "mon initial members" and "mon hosts" global config field

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

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 {
	FSID                string `ini:"fsid,omitempty"`
	MonMembers          string `ini:"mon initial members,omitempty"`
	MonHost             string `ini:"mon host"`
	PublicAddr          string `ini:"public addr,omitempty"`
	PublicNetwork       string `ini:"public network,omitempty"`
	ClusterAddr         string `ini:"cluster addr,omitempty"`
	ClusterNetwork      string `ini:"cluster network,omitempty"`
	MonAllowPoolDelete  bool   `ini:"mon_allow_pool_delete"`
	MonAllowPoolSizeOne bool   `ini:"mon_allow_pool_size_one"`
}

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