Documentation
¶
Index ¶
- func GenerateBuilderMetadata() map[string]string
- func UpdatePackerBuildersJson(dir string, metadata map[string]string)
- type Client
- func (c *Client) CreateKeypair(KeyNamePrefix string) *keypairs.KeyPair
- func (c *Client) CreateServer(keypair *keypairs.KeyPair, imageID, flavorName, networkID string, ...) (*servers.Server, string)
- func (c *Client) GetFlavorIDByName(name string) string
- 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 ¶
GenerateBuilderMetadata generates some glance metadata for the image.
func UpdatePackerBuildersJson ¶
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 ¶
CreateKeypair creates a new KeyPair in Openstack.
func (*Client) CreateServer ¶
func (c *Client) CreateServer(keypair *keypairs.KeyPair, imageID, flavorName, networkID string, enableConfigDrive bool) (*servers.Server, string)
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) 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() (cloudsConfig *OpenstackClouds)
InitOpenstack translates the clouds.yaml file into a struct to be used in app.
func (*OpenstackClouds) SetOpenstackEnvs ¶
func (c *OpenstackClouds) SetOpenstackEnvs()
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() (packerBuildConfig *PackerBuildConfig)
InitPackerConfig translates all the inputs into the global struct so that it can be utilised as required.
func (*PackerBuildConfig) GenerateVariablesFile ¶
func (p *PackerBuildConfig) GenerateVariablesFile(buildGitDir string)
GenerateVariablesFile converts the PackerBuildConfig into a build configuration file that packer can use.