config

package
v0.0.0-...-b915449 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidVisibility

func IsValidVisibility(visibility string) bool

func IsValidVisibilityOrEmpty

func IsValidVisibilityOrEmpty(visibility string) bool

Types

type Config

type Config struct {
	// Cloud is the name of the cloud that should be used. The cloud
	// must be defined in the supplied clouds.yaml file supplied in the
	// credentials field.
	//
	// This option can NOT be overwritten using extra_specs.
	Cloud string `toml:"cloud"`

	// Credentials holds information needed to connect to a cloud.
	//
	// This option can NOT be overwritten using extra_specs.
	Credentials Credentials `toml:"credentials"`

	// DefaultStorageBackend holds the name of the default storage backend
	// to use. If this is is empty, we will default to whatever is the default
	// in the cloud.
	//
	// This option can be overwritten using extra_specs.
	DefaultStorageBackend string `toml:"default_storage_backend"`

	// DefaultSecurityGroups holds a list of security group IDs that will be
	// added by default to runners.
	//
	// This option can be overwritten using extra_specs.
	DefaultSecurityGroups []string `toml:"default_security_groups"`

	// DefaultNetworkID is the default network ID to use when creating a new runner.
	//
	// This value is mandatory.
	// This value can be overwritten by extra_specs.
	DefaultNetworkID string `toml:"network_id"`

	// BootFromVolume indicates whether or not to boot from a cinder volume.
	//
	// This value can be overwritten using extra_specs.
	BootFromVolume bool `toml:"boot_from_volume"`

	// BootDiskSize is used in when BootFromVolume is set to true. If not explicitly
	// set, we use the root disk size defined in the flavor. If no root disk size is
	// specified in the flavor, we default to 50 GB.
	//
	// This value can be overwritten using extra_specs.
	// This option is ignored if BootFromVolume is set to false.
	BootDiskSize *int64 `toml:"root_disk_size"`

	// UseConfigDrive indicates whether to use config drive or not.
	//
	// This value can be overwritten using extra_specs.
	UseConfigDrive bool `toml:"use_config_drive"`

	// AllowedImageOwners is a list of image owners that are allowed to be used.
	// If this is empty, all images are allowed.
	// If not empty, only images owned by the specified owners are allowed.
	//
	// This value can be overwritten using extra_specs.
	AllowedImageOwners []string `toml:"allowed_image_owners"`

	// ImageVisibility is the image visibility to use when searching for images.
	// If this is empty, we will use "public".
	// Other possible values are "private", "community" and "shared".
	//
	// This value can be overwritten using extra_specs.
	ImageVisibility string `toml:"image_visibility"`

	// DisableUdatesOnBoot indicates whether to install or update packages on boot during cloud-init.
	// If set to true `PackageUpgrade` is set to false and `Packages` is set to an empty list in the cloud-init config.
	//
	// This value can NOT be overwritten using extra_specs.
	DisableUpdatesOnBoot bool `toml:"disable_updates_on_boot"`

	// EnableBootDebug indicates whether to enable debug mode during boot / cloud-init.
	// If set to true `set -x` is added to the cloud-init config.
	// Attention: This will might expose sensitive data in the logs! Do not use in production!
	//
	// This value can be overwritten using extra_specs.
	EnableBootDebug bool `toml:"enable_boot_debug"`
}

func NewConfig

func NewConfig(cfgFile string) (*Config, error)

NewConfig returns a new Config

func (*Config) Validate

func (c *Config) Validate() error

type Credentials

type Credentials struct {
	// Clouds holds the path to the clouds.yaml file. This field is mandatory
	// and holds information on how to connect to one or more OpenStack clouds.
	Clouds string `toml:"clouds"`
	// PublicClouds is the path on disk to clouds-public.yaml. See:
	// https://docs.openstack.org/python-openstackclient/latest/configuration/index.html#clouds-public-yaml
	PublicClouds string `toml:"public_clouds"`
	// SecureClouds is the path on disk to secure.yaml. This file normally holds secrets
	// for connecting to the cloud. The format is identical to clouds.yaml, with only
	// sensitive fields fileld in. These fields are merged with the values in clouds.yaml.
	// See: https://docs.openstack.org/os-client-config/latest/user/configuration.html#splitting-secrets
	SecureClouds string `toml:"secure_clouds"`
}

Credentials holds the paths on disk to the following files:

  • clouds.yaml
  • clouds-public.yaml
  • secure.yaml

Out of the 3, the only one that is mandatory is clouds.yaml.

func (Credentials) HasCloud

func (c Credentials) HasCloud(name string) bool

func (*Credentials) LoadCloudsYAML

func (o *Credentials) LoadCloudsYAML() (map[string]clientconfig.Cloud, error)

func (*Credentials) LoadPublicCloudsYAML

func (o *Credentials) LoadPublicCloudsYAML() (map[string]clientconfig.Cloud, error)

func (*Credentials) LoadSecureCloudsYAML

func (o *Credentials) LoadSecureCloudsYAML() (map[string]clientconfig.Cloud, error)

func (Credentials) Validate

func (c Credentials) Validate() error

Jump to

Keyboard shortcuts

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