ostack

package
v0.1.0-beta.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateBuilderMetadata

func GenerateBuilderMetadata(o *flags.BuildOptions) map[string]string

GenerateBuilderMetadata generates some glance metadata for the image.

func UpdatePackerBuildersJson

func UpdatePackerBuildersJson(dir string, metadata map[string]string) error

UpdatePackerBuildersJson pre-populates the metadata field in the packer.json file as objects cannot be passed as variables in packer.

Types

type Client

type Client struct {
	Cloud           OpenstackCloud
	Provider        *gophercloud.ProviderClient
	EndpointOptions *gophercloud.EndpointOpts
}

Client contains the Env vars of the program as well as the Provider and any EndpointOptions. This is used in gophercloud connections.

func NewOpenstackClient

func NewOpenstackClient(cloud OpenstackCloud) *Client

NewOpenstackClient creates the initial client for connecting to Openstack.

func (*Client) CreateKeypair

func (c *Client) CreateKeypair(keyNamePrefix string) *keypairs.KeyPair

CreateKeypair creates a new KeyPair in Openstack.

func (*Client) CreateServer

func (c *Client) CreateServer(keypair *keypairs.KeyPair, o *flags.ScanOptions) (*servers.Server, string)

CreateServer creates a compute instance in Openstack.

func (*Client) GetFlavorIDByName

func (c *Client) GetFlavorIDByName(name string) string

GetFlavorIDByName will take a name of a flavor and attempt to find the ID from Openstack.

func (*Client) RemoveImage

func (c *Client) RemoveImage(imgID string)

RemoveImage will delete an image from Openstack.

func (*Client) RemoveKeypair

func (c *Client) RemoveKeypair(keyName string)

RemoveKeypair will delete a Keypair from Openstack.

func (*Client) RemoveServer

func (c *Client) RemoveServer(serverID string)

RemoveServer will delete a Server from Openstack.

func (*Client) UpdateImageMetadata

func (c *Client) UpdateImageMetadata(imgID string, digest string) *images.Image

UpdateImageMetadata updates an images metadata.

type OpenstackAuth

type OpenstackAuth struct {
	AuthURL                     string `yaml:"auth_url"`
	Username                    string `yaml:"username,omitempty"`
	Password                    string `yaml:"password,omitempty"`
	ApplicationCredentialID     string `yaml:"application_credential_id,omitempty"`
	ApplicationCredentialSecret string `yaml:"application_credential_secret,omitempty"`
	ProjectID                   string `yaml:"project_id"`
	ProjectName                 string `yaml:"project_name"`
	UserDomainName              string `yaml:"user_domain_name"`
}

OpenstackAuth is the auth section of a singular cloud in the clouds.yaml file for Openstack.

type OpenstackCloud

type OpenstackCloud struct {
	Auth               OpenstackAuth `yaml:"auth"`
	RegionName         string        `yaml:"region_name,omitempty"`
	Interface          string        `yaml:"interface,omitempty"`
	IdentityApiVersion int           `yaml:"identity_api_version"`
	AuthType           string        `yaml:"auth_type"`
}

OpenstackCloud is a singular cloud definition in the clouds.yaml file for Openstack.

type OpenstackClouds

type OpenstackClouds struct {
	Clouds map[string]OpenstackCloud `yaml:"clouds"`
}

OpenstackClouds exists to contain the contents of the clouds.yaml file for Openstack

func InitOpenstack

func InitOpenstack(cloudsFile string) *OpenstackClouds

InitOpenstack will read the contents of the clouds.yaml file for Openstack and parse it into a OpenstackClouds struct.

func (*OpenstackClouds) SetOpenstackEnvs

func (c *OpenstackClouds) SetOpenstackEnvs(cloudName string)

SetOpenstackEnvs sets the environment variables for the build command to be able to connect to Openstack.

type PackerBuildConfig

type PackerBuildConfig struct {
	ImageName            string `json:"image_name,omitempty"`
	SourceImage          string `json:"source_image"`
	Networks             string `json:"networks"`
	Flavor               string `json:"flavor"`
	AttachConfigDrive    string `json:"attach_config_drive,omitempty"`
	UseFloatingIp        string `json:"use_floating_ip,omitempty"`
	FloatingIpNetwork    string `json:"floating_ip_network,omitempty"`
	CniVersion           string `json:"kubernetes_cni_semver,omitempty"`
	CniDebVersion        string `json:"kubernetes_cni_deb_version,omitempty"`
	CrictlVersion        string `json:"crictl_version,omitempty"`
	ImageVisibility      string `json:"image_visibility,omitempty"`
	KubernetesSemver     string `json:"kubernetes_semver,omitempty"`
	KubernetesRpmVersion string `json:"kubernetes_rpm_version,omitempty"`
	KubernetesSeries     string `json:"kubernetes_series,omitempty"`
	KubernetesDebVersion string `json:"kubernetes_deb_version,omitempty"`
	NodeCustomRolesPost  string `json:"node_custom_roles_post,omitempty"`
	AnsibleUserVars      string `json:"ansible_user_vars,omitempty"`
	ExtraDebs            string `json:"extra_debs,omitempty"`
	VolumeType           string `json:"volume_type"`
	ImageDiskFormat      string `json:"image_disk_format"`
}

PackerBuildConfig exists to allow variables to be parsed into a packer json file which can then be used for a build.

func InitPackerConfig

func InitPackerConfig(o *flags.BuildOptions) *PackerBuildConfig

InitPackerConfig takes the application inputs and converts it into a PackerBuildConfig.

func (*PackerBuildConfig) GenerateVariablesFile

func (p *PackerBuildConfig) GenerateVariablesFile(buildGitDir string)

GenerateVariablesFile converts the PackerBuildConfig into a build configuration file that packer can use.

Jump to

Keyboard shortcuts

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