boot

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUserData

func CreateUserData(publicKeyFile string) (string, error)

CreateUserData creates cloud-init's user-data that contains user redhat with the specified public key

func DeleteEC2Image

func DeleteEC2Image(e *ec2.EC2, imageDesc *imageDescription) error

DeleteEC2Image deletes the specified image and its associated snapshot

func DescribeEC2Image

func DescribeEC2Image(e *ec2.EC2, imageName string) (*imageDescription, error)

DescribeEC2Image searches for EC2 image by its name and returns its id and snapshot id

func GetAWSCredentialsFromEnv

func GetAWSCredentialsFromEnv() (*awsCredentials, error)

GetAWSCredentialsFromEnv gets the credentials from environment variables If none of the environment variables is set, it returns nil. If some but not all environment variables are set, it returns an error.

func NewEC2

func NewEC2(c *awsCredentials) (*ec2.EC2, error)

NewEC2 creates EC2 struct from given credentials

func UploadImageToAWS

func UploadImageToAWS(c *awsCredentials, imagePath string, imageName string) error

UploadImageToAWS mimics the upload feature of osbuild-composer. It takes an image and an image name and creates an ec2 instance from them. The s3 key is never returned - the same thing is done in osbuild-composer, the user has no way of getting the s3 key.

func WithBootedImageInEC2

func WithBootedImageInEC2(e *ec2.EC2, securityGroupName string, imageDesc *imageDescription, publicKey string, instanceType string, f func(address string) error) (retErr error)

WithBootedImageInEC2 runs the function f in the context of booted image in AWS EC2

func WithBootedNspawnDirectory

func WithBootedNspawnDirectory(dir string, ns NetNS, f func() error) error

WithBootedNspawnImage boots the specified directory in the specified namespace using nspawn. The VM is killed immediately after function returns.

func WithBootedNspawnImage

func WithBootedNspawnImage(image string, ns NetNS, f func() error) error

WithBootedNspawnImage boots the specified image in the specified namespace using nspawn. The VM is killed immediately after function returns.

func WithBootedQemuImage

func WithBootedQemuImage(image string, ns NetNS, f func() error) error

WithBootedQemuImage boots the specified image in the specified namespace using qemu. The VM is killed immediately after function returns.

func WithExtractedTarArchive

func WithExtractedTarArchive(archive string, f func(dir string) error) error

WithExtractedTarArchive extracts the provided archive and passes a path to the result to the function f. The result is deleted immediately after the function returns.

func WithNetworkNamespace

func WithNetworkNamespace(f func(ns NetNS) error) error

WithNetworkNamespace provides the function f with a new network namespace which is deleted immediately after f returns

func WithSSHKeyPair

func WithSSHKeyPair(f func(privateKey, publicKey string) error) error

WithSSHKeyPair runs the function f with a newly generated ssh key-pair, they key-pair is deleted immediately after the function f returns

Types

type NetNS

type NetNS string

Network namespace abstraction

func (NetNS) Delete

func (n NetNS) Delete() error

Delete deletes the namespaces

func (NetNS) NamespacedCommand

func (n NetNS) NamespacedCommand(name string, arg ...string) *exec.Cmd

NamespaceCommand returns an *exec.Cmd struct with the difference that it's prepended by "ip netns exec NAMESPACE_NAME" command, which runs the command in a namespaced environment.

func (NetNS) NamespacedCommandContext

func (n NetNS) NamespacedCommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd

NamespaceCommand returns an *exec.Cmd struct with the difference that it's prepended by "ip netns exec NAMESPACE_NAME" command, which runs the command in a namespaced environment.

func (NetNS) Path

func (n NetNS) Path() string

Path returns the path to the namespace file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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