Documentation
¶
Index ¶
- func GenerateBuilderMetadata(o *flags.BuildOptions) map[string]string
- func UpdatePackerBuildersJson(dir string, metadata map[string]string) error
- type Client
- func (c *Client) AttachIP(serverID, fip string) error
- func (c *Client) CreateKeypair(keyNamePrefix string) (*keypairs.KeyPair, error)
- func (c *Client) CreateServer(keypair *keypairs.KeyPair, o *flags.ScanOptions, userData []byte) (*servers.Server, error)
- func (c *Client) GetFlavorIDByName(name string) string
- func (c *Client) GetFloatingIP(ipPool string) (*floatingips.FloatingIP, error)
- func (c *Client) GetServerStatus(sid string) bool
- func (c *Client) RemoveFIP(fip *floatingips.FloatingIP)
- func (c *Client) RemoveImage(imgID string)
- func (c *Client) RemoveKeypair(keyName string)
- func (c *Client) RemoveServer(serverID string)
- func (c *Client) UpdateImageMetadata(imgID string, digest string) *images.Image
- type OpenstackAuth
- type OpenstackCloud
- type OpenstackClouds
- type PackerBuildConfig
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.
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 ¶
CreateKeypair creates a new KeyPair in Openstack.
func (*Client) CreateServer ¶
func (c *Client) CreateServer(keypair *keypairs.KeyPair, o *flags.ScanOptions, userData []byte) (*servers.Server, error)
CreateServer creates a compute instance in Openstack.
func (*Client) GetFlavorIDByName ¶
GetFlavorIDByName will take a name of a flavor and attempt to find the ID from Openstack.
func (*Client) GetFloatingIP ¶
func (c *Client) GetFloatingIP(ipPool string) (*floatingips.FloatingIP, error)
GetFloatingIP will create a new FIP.
func (*Client) GetServerStatus ¶
GetServerStatus gets the status of a server
func (*Client) RemoveFIP ¶
func (c *Client) RemoveFIP(fip *floatingips.FloatingIP)
RemoveFIP will delete a Floating IP from Openstack.
func (*Client) RemoveImage ¶
RemoveImage will delete an image from Openstack.
func (*Client) RemoveKeypair ¶
RemoveKeypair will delete a Keypair from Openstack.
func (*Client) RemoveServer ¶
RemoveServer will delete a Server from Openstack.
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"`
NodeCustomRolesPre string `json:"node_custom_roles_pre,omitempty"`
NodeCustomRolesPost string `json:"node_custom_roles_post,omitempty"`
AnsibleUserVars string `json:"ansible_user_vars,omitempty"`
ExtraDebs string `json:"extra_debs,omitempty"`
ImageDiskFormat string `json:"image_disk_format"`
VolumeType string `json:"volume_type"`
VolumeSize string `json:"volume_size"`
}
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.