mirror of
https://github.com/containers/podman.git
synced 2025-12-12 09:50:25 +08:00
introduce podman machine
podman machine allows podman to create, manage, and interact with a vm running some form of linux (default is fcos). podman is then configured to be able to interact with the vm automatically. while this is usable on linux, the real push is to get this working on both current apple architectures in macos. Ashley Cui contributed to this PR and was a great help. [NO TESTS NEEDED] Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
18
vendor/github.com/coreos/stream-metadata-go/stream/rhcos/rhcos.go
generated
vendored
Normal file
18
vendor/github.com/coreos/stream-metadata-go/stream/rhcos/rhcos.go
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
package rhcos
|
||||
|
||||
// Extensions is data specific to Red Hat Enterprise Linux CoreOS
|
||||
type Extensions struct {
|
||||
AzureDisk *AzureDisk `json:"azure-disk,omitempty"`
|
||||
}
|
||||
|
||||
// AzureDisk represents an Azure disk image that can be imported
|
||||
// into an image gallery or otherwise replicated, and then used
|
||||
// as a boot source for virtual machines.
|
||||
type AzureDisk struct {
|
||||
// Release is the source release version
|
||||
Release string `json:"release"`
|
||||
// URL to an image already stored in Azure infrastructure
|
||||
// that can be copied into an image gallery. Avoid creating VMs directly
|
||||
// from this URL as that may lead to performance limitations.
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
74
vendor/github.com/coreos/stream-metadata-go/stream/stream.go
generated
vendored
Normal file
74
vendor/github.com/coreos/stream-metadata-go/stream/stream.go
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
// Package stream models a CoreOS "stream", which is
|
||||
// a description of the recommended set of binary images for CoreOS. Use
|
||||
// this API to find cloud images, bare metal disk images, etc.
|
||||
package stream
|
||||
|
||||
import (
|
||||
"github.com/coreos/stream-metadata-go/stream/rhcos"
|
||||
)
|
||||
|
||||
// Stream contains artifacts available in a stream
|
||||
type Stream struct {
|
||||
Stream string `json:"stream"`
|
||||
Metadata Metadata `json:"metadata"`
|
||||
Architectures map[string]Arch `json:"architectures"`
|
||||
}
|
||||
|
||||
// Metadata for a release or stream
|
||||
type Metadata struct {
|
||||
LastModified string `json:"last-modified"`
|
||||
}
|
||||
|
||||
// Arch contains release details for a particular hardware architecture
|
||||
type Arch struct {
|
||||
Artifacts map[string]PlatformArtifacts `json:"artifacts"`
|
||||
Images Images `json:"images,omitempty"`
|
||||
// RHELCoreOSExtensions is data specific to Red Hat Enterprise Linux CoreOS
|
||||
RHELCoreOSExtensions *rhcos.Extensions `json:"rhel-coreos-extensions,omitempty"`
|
||||
}
|
||||
|
||||
// PlatformArtifacts contains images for a platform
|
||||
type PlatformArtifacts struct {
|
||||
Release string `json:"release"`
|
||||
Formats map[string]ImageFormat `json:"formats"`
|
||||
}
|
||||
|
||||
// ImageFormat contains all artifacts for a single OS image
|
||||
type ImageFormat struct {
|
||||
Disk *Artifact `json:"disk,omitempty"`
|
||||
Kernel *Artifact `json:"kernel,omitempty"`
|
||||
Initramfs *Artifact `json:"initramfs,omitempty"`
|
||||
Rootfs *Artifact `json:"rootfs,omitempty"`
|
||||
}
|
||||
|
||||
// Artifact represents one image file, plus its metadata
|
||||
type Artifact struct {
|
||||
Location string `json:"location"`
|
||||
Signature string `json:"signature"`
|
||||
Sha256 string `json:"sha256"`
|
||||
UncompressedSha256 string `json:"uncompressed-sha256,omitempty"`
|
||||
}
|
||||
|
||||
// Images contains images available in cloud providers
|
||||
type Images struct {
|
||||
Aws *AwsImage `json:"aws,omitempty"`
|
||||
Gcp *GcpImage `json:"gcp,omitempty"`
|
||||
}
|
||||
|
||||
// AwsImage represents an image across all AWS regions
|
||||
type AwsImage struct {
|
||||
Regions map[string]AwsRegionImage `json:"regions,omitempty"`
|
||||
}
|
||||
|
||||
// AwsRegionImage represents an image in one AWS region
|
||||
type AwsRegionImage struct {
|
||||
Release string `json:"release"`
|
||||
Image string `json:"image"`
|
||||
}
|
||||
|
||||
// GcpImage represents a GCP cloud image
|
||||
type GcpImage struct {
|
||||
Project string `json:"project,omitempty"`
|
||||
Family string `json:"family,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
47
vendor/github.com/coreos/stream-metadata-go/stream/stream_utils.go
generated
vendored
Normal file
47
vendor/github.com/coreos/stream-metadata-go/stream/stream_utils.go
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
package stream
|
||||
|
||||
import "fmt"
|
||||
|
||||
// FormatPrefix describes a stream+architecture combination, intended for prepending to error messages
|
||||
func (st *Stream) FormatPrefix(archname string) string {
|
||||
return fmt.Sprintf("%s/%s", st.Stream, archname)
|
||||
}
|
||||
|
||||
// GetArchitecture loads the architecture-specific builds from a stream,
|
||||
// with a useful descriptive error message if the architecture is not found.
|
||||
func (st *Stream) GetArchitecture(archname string) (*Arch, error) {
|
||||
archdata, ok := st.Architectures[archname]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("stream:%s does not have architecture '%s'", st.Stream, archname)
|
||||
}
|
||||
return &archdata, nil
|
||||
}
|
||||
|
||||
// GetAwsRegionImage returns the release data (AMI and release ID) for a particular
|
||||
// architecture and region.
|
||||
func (st *Stream) GetAwsRegionImage(archname, region string) (*AwsRegionImage, error) {
|
||||
starch, err := st.GetArchitecture(archname)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
awsimages := starch.Images.Aws
|
||||
if awsimages == nil {
|
||||
return nil, fmt.Errorf("%s: No AWS images", st.FormatPrefix(archname))
|
||||
}
|
||||
var regionVal AwsRegionImage
|
||||
var ok bool
|
||||
if regionVal, ok = awsimages.Regions[region]; !ok {
|
||||
return nil, fmt.Errorf("%s: No AWS images in region %s", st.FormatPrefix(archname), region)
|
||||
}
|
||||
|
||||
return ®ionVal, nil
|
||||
}
|
||||
|
||||
// GetAMI returns the AWS machine image for a particular architecture and region.
|
||||
func (st *Stream) GetAMI(archname, region string) (string, error) {
|
||||
regionVal, err := st.GetAwsRegionImage(archname, region)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return regionVal.Image, nil
|
||||
}
|
||||
Reference in New Issue
Block a user