settings

package
v2.316.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: Apache-2.0 Imports: 9 Imported by: 502

Documentation

Index

Constants

View Source
const (
	RootUsername        = "root"
	VCAPUsername        = "vcap"
	AdminGroup          = "admin"
	SudoersGroup        = "bosh_sudoers"
	SshersGroup         = "bosh_sshers"
	EphemeralUserPrefix = "bosh_"
)

Variables

This section is empty.

Functions

func NetmaskToCIDR

func NetmaskToCIDR(netmask string, ipv6 bool) (string, error)

Types

type AgentEnv

type AgentEnv struct {
	Settings AgentSettings `json:"settings"`
}

type AgentSettings

type AgentSettings struct {
	TmpFS bool `json:"tmpfs"`
}

type Blobstore

type Blobstore struct {
	Type    string                 `json:"provider"`
	Options map[string]interface{} `json:"options"`
}

type BoshEnv

type BoshEnv struct {
	Agent                 AgentEnv    `json:"agent"`
	Password              string      `json:"password"`
	KeepRootPassword      bool        `json:"keep_root_password"`
	RemoveDevTools        bool        `json:"remove_dev_tools"`
	RemoveStaticLibraries bool        `json:"remove_static_libraries"`
	AuthorizedKeys        []string    `json:"authorized_keys"`
	SwapSizeInMB          *uint64     `json:"swap_size"`
	Mbus                  MBus        `json:"mbus"`
	IPv6                  IPv6        `json:"ipv6"`
	JobDir                JobDir      `json:"job_dir"`
	Blobstores            []Blobstore `json:"blobstores"`
	NTP                   []string    `json:"ntp"`
	Parallel              *int        `json:"parallel"`
}

type CertKeyPair

type CertKeyPair struct {
	CA          string `json:"ca"`
	PrivateKey  string `json:"private_key"`
	Certificate string `json:"certificate"`
}

type DNSRecords

type DNSRecords struct {
	Version uint64      `json:"Version"`
	Records [][2]string `json:"records"`
}

type DefaultNetworkResolver

type DefaultNetworkResolver interface {
	// Ideally we would find a network based on a MAC address
	// but current CPI implementations do not include it
	GetDefaultNetwork() (Network, error)
}

type DiskAssociation

type DiskAssociation struct {
	Name    string `json:"name"`
	DiskCID string `json:"cid"`
}

type DiskAssociations

type DiskAssociations []DiskAssociation

type DiskSettings

type DiskSettings struct {
	ID           string
	DeviceID     string
	VolumeID     string
	Lun          string
	HostDeviceID string
	Path         string

	// iscsi related
	ISCSISettings ISCSISettings

	FileSystemType disk.FileSystemType
	MountOptions   []string

	Partitioner string
}

type Disks

type Disks struct {
	// e.g "/dev/sda", "1"
	System string `json:"system"`

	// Older CPIs returned disk settings as string
	// e.g "/dev/sdb", "2"
	// Newer CPIs will populate it in a hash
	// e.g {"path" => "/dev/sdc", "volume_id" => "3"}
	//     {"lun" => "0", "host_device_id" => "{host-device-id}"}
	Ephemeral interface{} `json:"ephemeral"`

	// Older CPIs returned disk settings as strings
	// e.g {"disk-3845-43758-7243-38754" => "/dev/sdc"}
	//     {"disk-3845-43758-7243-38754" => "3"}
	// Newer CPIs will populate it in a hash:
	// e.g {"disk-3845-43758-7243-38754" => {"path" => "/dev/sdc"}}
	//     {"disk-3845-43758-7243-38754" => {"volume_id" => "3"}}
	//     {"disk-3845-43758-7243-38754" => {"lun" => "0", "host_device_id" => "{host-device-id}"}}
	Persistent map[string]interface{} `json:"persistent"`

	RawEphemeral []DiskSettings `json:"raw_ephemeral"`
}

type Env

type Env struct {
	Bosh                       BoshEnv             `json:"bosh"`
	PersistentDiskFS           disk.FileSystemType `json:"persistent_disk_fs"`
	PersistentDiskMountOptions []string            `json:"persistent_disk_mount_options"`
	PersistentDiskPartitioner  string              `json:"persistent_disk_partitioner"`
}

func (Env) GetAuthorizedKeys

func (e Env) GetAuthorizedKeys() []string

func (Env) GetKeepRootPassword

func (e Env) GetKeepRootPassword() bool

func (Env) GetParallel

func (e Env) GetParallel() *int

func (Env) GetPassword

func (e Env) GetPassword() string

func (Env) GetRemoveDevTools

func (e Env) GetRemoveDevTools() bool

func (Env) GetRemoveStaticLibraries

func (e Env) GetRemoveStaticLibraries() bool

func (Env) GetSwapSizeInBytes

func (e Env) GetSwapSizeInBytes() *uint64

func (Env) IsNATSMutualTLSEnabled

func (e Env) IsNATSMutualTLSEnabled() bool

type IPv6

type IPv6 struct {
	Enable bool `json:"enable"`
}

type ISCSISettings

type ISCSISettings struct {
	InitiatorName string
	Username      string
	Target        string
	Password      string
}

type JobDir

type JobDir struct {
	TmpFS bool `json:"tmpfs"`

	// Passed to mount directly
	TmpFSSize string `json:"tmpfs_size"`
}

type MBus

type MBus struct {
	Cert CertKeyPair `json:"cert"`
	URLs []string    `json:"urls"`
}

type Network

type Network struct {
	Type NetworkType `json:"type"`

	IP       string `json:"ip"`
	Netmask  string `json:"netmask"`
	Gateway  string `json:"gateway"`
	Resolved bool   `json:"resolved"` // was resolved via DHCP
	UseDHCP  bool   `json:"use_dhcp"`

	Default []string `json:"default"`
	DNS     []string `json:"dns"`

	Mac string `json:"mac"`

	Preconfigured bool   `json:"preconfigured"`
	Routes        Routes `json:"routes,omitempty"`

	Alias string `json:"alias,omitempty"`
}

func (Network) IsDHCP

func (n Network) IsDHCP() bool

func (Network) IsDefaultFor

func (n Network) IsDefaultFor(category string) bool

func (Network) IsVIP

func (n Network) IsVIP() bool

func (Network) String

func (n Network) String() string

type NetworkType

type NetworkType string
const (
	NetworkTypeDynamic NetworkType = "dynamic"
	NetworkTypeVIP     NetworkType = "vip"
)

type Networks

type Networks map[string]Network

func (Networks) DefaultIP

func (n Networks) DefaultIP() (ip string, found bool)

func (Networks) DefaultNetworkFor

func (n Networks) DefaultNetworkFor(category string) (Network, bool)

func (Networks) HasInterfaceAlias

func (n Networks) HasInterfaceAlias() bool

func (Networks) IPs

func (n Networks) IPs() (ips []string)

func (Networks) IsPreconfigured

func (n Networks) IsPreconfigured() bool

func (Networks) NetworkForMac

func (n Networks) NetworkForMac(mac string) (Network, bool)

type PlatformSettingsGetter

type PlatformSettingsGetter interface {
	DefaultNetworkResolver
	SetupBoshSettingsDisk() error
	GetAgentSettingsPath(tmpfs bool) string
	GetPersistentDiskSettingsPath(tmpfs bool) string
}

type Route

type Route struct {
	Destination string
	Gateway     string
	Netmask     string
}

type Routes

type Routes []Route

type Service

type Service interface {
	LoadSettings() error

	// GetSettings does not return error because without settings Agent cannot start.
	GetSettings() Settings

	GetPersistentDiskSettings(diskCID string) (DiskSettings, error)

	GetAllPersistentDiskSettings() (map[string]DiskSettings, error)

	SavePersistentDiskSettings(DiskSettings) error

	RemovePersistentDiskSettings(string) error

	PublicSSHKeyForUsername(string) (string, error)

	InvalidateSettings() error
}

func NewService

func NewService(
	fs boshsys.FileSystem,
	settingsSource Source,
	platform PlatformSettingsGetter,
	logger boshlog.Logger,
) Service

type Settings

type Settings struct {
	AgentID   string    `json:"agent_id"`
	Blobstore Blobstore `json:"blobstore"`
	Disks     Disks     `json:"disks"`
	Env       Env       `json:"env"`
	Networks  Networks  `json:"networks"`
	NTP       []string  `json:"ntp"`
	Mbus      string    `json:"mbus"`
	VM        VM        `json:"vm"`
}

func (Settings) EphemeralDiskSettings

func (s Settings) EphemeralDiskSettings() DiskSettings

func (Settings) GetBlobstore

func (s Settings) GetBlobstore() Blobstore

func (Settings) GetMbusURL

func (s Settings) GetMbusURL() string

func (Settings) GetNtpServers

func (s Settings) GetNtpServers() []string

func (Settings) PersistentDiskSettings

func (s Settings) PersistentDiskSettings(diskID string) (DiskSettings, bool)

func (Settings) PersistentDiskSettingsFromHint

func (s Settings) PersistentDiskSettingsFromHint(diskID string, diskHint interface{}) DiskSettings

func (Settings) RawEphemeralDiskSettings

func (s Settings) RawEphemeralDiskSettings() (devices []DiskSettings)

func (Settings) TmpFSEnabled

func (s Settings) TmpFSEnabled() bool

type Source

type Source interface {
	PublicSSHKeyForUsername(string) (string, error)
	Settings() (Settings, error)
}

type UpdateSettings

type UpdateSettings struct {
	DiskAssociations DiskAssociations `json:"disk_associations"`
	TrustedCerts     string           `json:"trusted_certs"`
}

type VM

type VM struct {
	Name string `json:"name"`
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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