Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Remove .spec.network.mode; use a global --network-plugin flag instead #319

Merged
merged 7 commits into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions cmd/ignite/cmd/cmdutil/networkflag.go

This file was deleted.

6 changes: 6 additions & 0 deletions cmd/ignite/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
"github.com/weaveworks/ignite/cmd/ignite/cmd/vmcmd"
"github.com/weaveworks/ignite/pkg/logs"
logflag "github.com/weaveworks/ignite/pkg/logs/flag"
"github.com/weaveworks/ignite/pkg/network"
networkflag "github.com/weaveworks/ignite/pkg/network/flag"
"github.com/weaveworks/ignite/pkg/providers"
versioncmd "github.com/weaveworks/ignite/pkg/version/cmd"
)

Expand All @@ -32,6 +35,8 @@ func NewIgniteCommand(in io.Reader, out, err io.Writer) *cobra.Command {
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Set the desired logging level, now that the flags are parsed
logs.Logger.SetLevel(logLevel)
// Set the desired network plugin
providers.NetworkPlugin = providers.NetworkPlugins[network.ActivePlugin]
},
Long: dedent.Dedent(fmt.Sprintf(`
Ignite is a containerized Firecracker microVM administration tool.
Expand Down Expand Up @@ -88,6 +93,7 @@ func NewIgniteCommand(in io.Reader, out, err io.Writer) *cobra.Command {
func addGlobalFlags(fs *pflag.FlagSet) {
AddQuietFlag(fs)
logflag.LogLevelFlagVar(fs, &logLevel)
networkflag.RegisterNetworkPluginFlag(fs)
}

// AddQuietFlag adds the quiet flag to a flagset
Expand Down
1 change: 0 additions & 1 deletion cmd/ignite/cmd/vmcmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func addCreateFlags(fs *pflag.FlagSet, cf *run.CreateFlags) {
cmdutil.SizeVar(fs, &cf.VM.Spec.Memory, "memory", "Amount of RAM to allocate for the VM")
cmdutil.SizeVarP(fs, &cf.VM.Spec.DiskSize, "size", "s", "VM filesystem size, for example 5GB or 2048MB")
cmdutil.OCIImageRefVarP(fs, &cf.VM.Spec.Kernel.OCI, "kernel-image", "k", "Specify an OCI image containing the kernel at /boot/vmlinux and optionally, modules")
cmdutil.NetworkModeVar(fs, &cf.VM.Spec.Network.Mode)
cmdutil.SSHVar(fs, &cf.SSH)
cmdutil.VolumeVarP(fs, &cf.VM.Spec.Storage, "volumes", "v", "Expose block devices from the host inside the VM")
}
6 changes: 6 additions & 0 deletions cmd/ignited/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (
"github.com/spf13/pflag"
"github.com/weaveworks/ignite/pkg/logs"
logflag "github.com/weaveworks/ignite/pkg/logs/flag"
"github.com/weaveworks/ignite/pkg/network"
networkflag "github.com/weaveworks/ignite/pkg/network/flag"
"github.com/weaveworks/ignite/pkg/providers"
versioncmd "github.com/weaveworks/ignite/pkg/version/cmd"
)

Expand All @@ -24,6 +27,8 @@ func NewIgnitedCommand(in io.Reader, out, err io.Writer) *cobra.Command {
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Set the desired logging level, now that the flags are parsed
logs.Logger.SetLevel(logLevel)
// Set the desired network plugin
providers.NetworkPlugin = providers.NetworkPlugins[network.ActivePlugin]
},
Long: dedent.Dedent(`
Ignite is a containerized Firecracker microVM administration tool.
Expand All @@ -43,4 +48,5 @@ func NewIgnitedCommand(in io.Reader, out, err io.Writer) *cobra.Command {

func addGlobalFlags(fs *pflag.FlagSet) {
logflag.LogLevelFlagVar(fs, &logLevel)
networkflag.RegisterNetworkPluginFlag(fs)
}
12 changes: 12 additions & 0 deletions docs/api/ignite_v1alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
- [func Convert\_v1alpha1\_VMKernelSpec\_To\_ignite\_VMKernelSpec(in
*VMKernelSpec, out *ignite.VMKernelSpec, s conversion.Scope)
error](#Convert_v1alpha1_VMKernelSpec_To_ignite_VMKernelSpec)
- [func Convert\_v1alpha1\_VMNetworkSpec\_To\_ignite\_VMNetworkSpec(in
*VMNetworkSpec, out *ignite.VMNetworkSpec, s conversion.Scope)
error](#Convert_v1alpha1_VMNetworkSpec_To_ignite_VMNetworkSpec)
- [func Convert\_v1alpha1\_VMSpec\_To\_ignite\_VMSpec(in *VMSpec, out
*ignite.VMSpec, s conversion.Scope)
error](#Convert_v1alpha1_VMSpec_To_ignite_VMSpec)
Expand Down Expand Up @@ -274,6 +277,15 @@ func Convert_v1alpha1_VMKernelSpec_To_ignite_VMKernelSpec(in *VMKernelSpec, out
Convert\_v1alpha1\_VMKernelSpec\_To\_ignite\_VMKernelSpec calls the
autogenerated conversion function along with custom conversion logic

## <a name="Convert_v1alpha1_VMNetworkSpec_To_ignite_VMNetworkSpec">func</a> [Convert\_v1alpha1\_VMNetworkSpec\_To\_ignite\_VMNetworkSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha1/conversion.go?s=7778:7909#L179)

``` go
func Convert_v1alpha1_VMNetworkSpec_To_ignite_VMNetworkSpec(in *VMNetworkSpec, out *ignite.VMNetworkSpec, s conversion.Scope) error
```

Convert\_v1alpha1\_VMNetworkSpec\_To\_ignite\_VMNetworkSpec calls the
autogenerated conversion function and custom conversion logic

## <a name="Convert_v1alpha1_VMSpec_To_ignite_VMSpec">func</a> [Convert\_v1alpha1\_VMSpec\_To\_ignite\_VMSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha1/conversion.go?s=697:800#L16)

``` go
Expand Down
84 changes: 25 additions & 59 deletions docs/api/ignite_v1alpha2.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
- [func SetDefaults\_PoolSpec(obj \*PoolSpec)](#SetDefaults_PoolSpec)
- [func SetDefaults\_VMKernelSpec(obj
\*VMKernelSpec)](#SetDefaults_VMKernelSpec)
- [func SetDefaults\_VMNetworkSpec(obj
\*VMNetworkSpec)](#SetDefaults_VMNetworkSpec)
- [func SetDefaults\_VMSpec(obj \*VMSpec)](#SetDefaults_VMSpec)
- [type BlockDeviceVolume](#BlockDeviceVolume)
- [type FileMapping](#FileMapping)
Expand All @@ -29,8 +27,6 @@
- [type Kernel](#Kernel)
- [type KernelSpec](#KernelSpec)
- [type KernelStatus](#KernelStatus)
- [type NetworkMode](#NetworkMode)
- [func (nm NetworkMode) String() string](#NetworkMode.String)
- [type OCIImageSource](#OCIImageSource)
- [type Pool](#Pool)
- [type PoolDevice](#PoolDevice)
Expand Down Expand Up @@ -113,19 +109,13 @@ func SetDefaults_PoolSpec(obj *PoolSpec)
func SetDefaults_VMKernelSpec(obj *VMKernelSpec)
```

## <a name="SetDefaults_VMNetworkSpec">func</a> [SetDefaults\_VMNetworkSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/defaults.go?s=1412:1462#L60)

``` go
func SetDefaults_VMNetworkSpec(obj *VMNetworkSpec)
```

## <a name="SetDefaults_VMSpec">func</a> [SetDefaults\_VMSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/defaults.go?s=829:865#L35)

``` go
func SetDefaults_VMSpec(obj *VMSpec)
```

## <a name="BlockDeviceVolume">type</a> [BlockDeviceVolume](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7062:7122#L193)
## <a name="BlockDeviceVolume">type</a> [BlockDeviceVolume](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7015:7075#L190)

``` go
type BlockDeviceVolume struct {
Expand All @@ -135,7 +125,7 @@ type BlockDeviceVolume struct {

BlockDeviceVolume defines a block device on the host

## <a name="FileMapping">type</a> [FileMapping](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7357:7452#L204)
## <a name="FileMapping">type</a> [FileMapping](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7310:7405#L201)

``` go
type FileMapping struct {
Expand All @@ -146,7 +136,7 @@ type FileMapping struct {

FileMapping defines mappings between files on the host and VM

## <a name="Image">type</a> [Image](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=342:806#L17)
## <a name="Image">type</a> [Image](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=334:798#L15)

``` go
type Image struct {
Expand All @@ -164,7 +154,7 @@ type Image struct {
Image represents a cached OCI image ready to be used with Ignite
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

## <a name="ImageSpec">type</a> [ImageSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=854:914#L29)
## <a name="ImageSpec">type</a> [ImageSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=846:906#L27)

``` go
type ImageSpec struct {
Expand All @@ -174,7 +164,7 @@ type ImageSpec struct {

ImageSpec declares what the image contains

## <a name="ImageStatus">type</a> [ImageStatus](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=1302:1451#L43)
## <a name="ImageStatus">type</a> [ImageStatus](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=1294:1443#L41)

``` go
type ImageStatus struct {
Expand All @@ -185,7 +175,7 @@ type ImageStatus struct {

ImageStatus defines the status of the image

## <a name="Kernel">type</a> [Kernel](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=3830:4297#L107)
## <a name="Kernel">type</a> [Kernel](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=3822:4289#L105)

``` go
type Kernel struct {
Expand All @@ -205,7 +195,7 @@ kernels This file is stored in
/var/lib/firecracker/kernels/{oci-image-digest}/metadata.json
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

## <a name="KernelSpec">type</a> [KernelSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=4350:4516#L119)
## <a name="KernelSpec">type</a> [KernelSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=4342:4508#L117)

``` go
type KernelSpec struct {
Expand All @@ -215,7 +205,7 @@ type KernelSpec struct {

KernelSpec describes the properties of a kernel

## <a name="KernelStatus">type</a> [KernelStatus](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=4567:4683#L126)
## <a name="KernelStatus">type</a> [KernelStatus](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=4559:4675#L124)

``` go
type KernelStatus struct {
Expand All @@ -226,30 +216,7 @@ type KernelStatus struct {

KernelStatus describes the status of a kernel

## <a name="NetworkMode">type</a> [NetworkMode](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7806:7829#L219)

``` go
type NetworkMode string
```

NetworkMode defines different states a VM can be in

``` go
const (
// NetworkModeCNI specifies the network mode where CNI is used
NetworkModeCNI NetworkMode = "cni"
// NetworkModeDockerBridge specifies the default docker bridge network is used
NetworkModeDockerBridge NetworkMode = "docker-bridge"
)
```

### <a name="NetworkMode.String">func</a> (NetworkMode) [String](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7869:7906#L223)

``` go
func (nm NetworkMode) String() string
```

## <a name="OCIImageSource">type</a> [OCIImageSource](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=1021:1253#L35)
## <a name="OCIImageSource">type</a> [OCIImageSource](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=1013:1245#L33)

``` go
type OCIImageSource struct {
Expand All @@ -263,7 +230,7 @@ type OCIImageSource struct {
OCIImageSource specifies how the OCI image was imported. It is the
status variant of OCIImageClaim

## <a name="Pool">type</a> [Pool](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=1726:1906#L52)
## <a name="Pool">type</a> [Pool](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=1718:1898#L50)

``` go
type Pool struct {
Expand All @@ -279,7 +246,7 @@ snapshotter part of Ignite, and the file (existing as a singleton) is
present at /var/lib/firecracker/snapshotter/pool.json
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

## <a name="PoolDevice">type</a> [PoolDevice](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=3197:3587#L94)
## <a name="PoolDevice">type</a> [PoolDevice](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=3189:3579#L92)

``` go
type PoolDevice struct {
Expand All @@ -295,7 +262,7 @@ type PoolDevice struct {

PoolDevice defines one device in the pool

## <a name="PoolDeviceType">type</a> [PoolDeviceType](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=2926:2952#L84)
## <a name="PoolDeviceType">type</a> [PoolDeviceType](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=2918:2944#L82)

``` go
type PoolDeviceType string
Expand All @@ -310,7 +277,7 @@ const (
)
```

## <a name="PoolSpec">type</a> [PoolSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=1953:2666#L62)
## <a name="PoolSpec">type</a> [PoolSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=1945:2658#L60)

``` go
type PoolSpec struct {
Expand All @@ -331,7 +298,7 @@ type PoolSpec struct {

PoolSpec defines the Pool’s specification

## <a name="PoolStatus">type</a> [PoolStatus](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=2716:2924#L78)
## <a name="PoolStatus">type</a> [PoolStatus](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=2708:2916#L76)

``` go
type PoolStatus struct {
Expand All @@ -343,7 +310,7 @@ type PoolStatus struct {

PoolStatus defines the Pool’s current status

## <a name="Runtime">type</a> [Runtime](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=8302:8348#L236)
## <a name="Runtime">type</a> [Runtime](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7754:7800#L216)

``` go
type Runtime struct {
Expand All @@ -353,7 +320,7 @@ type Runtime struct {

Runtime specifies the VM’s runtime information

## <a name="SSH">type</a> [SSH](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7672:7749#L213)
## <a name="SSH">type</a> [SSH](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7625:7702#L210)

``` go
type SSH struct {
Expand All @@ -378,7 +345,7 @@ func (s *SSH) MarshalJSON() ([]byte, error)
func (s *SSH) UnmarshalJSON(b []byte) error
```

## <a name="VM">type</a> [VM](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=4885:5340#L134)
## <a name="VM">type</a> [VM](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=4877:5332#L132)

``` go
type VM struct {
Expand All @@ -397,15 +364,15 @@ VM represents a virtual machine run by Firecracker These files are
stored in /var/lib/firecracker/vm/{vm-id}/metadata.json
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

## <a name="VMImageSpec">type</a> [VMImageSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6323:6385#L166)
## <a name="VMImageSpec">type</a> [VMImageSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6315:6377#L164)

``` go
type VMImageSpec struct {
OCI meta.OCIImageRef `json:"oci"`
}
```

## <a name="VMKernelSpec">type</a> [VMKernelSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6387:6507#L170)
## <a name="VMKernelSpec">type</a> [VMKernelSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6379:6499#L168)

``` go
type VMKernelSpec struct {
Expand All @@ -414,16 +381,15 @@ type VMKernelSpec struct {
}
```

## <a name="VMNetworkSpec">type</a> [VMNetworkSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6509:6627#L175)
## <a name="VMNetworkSpec">type</a> [VMNetworkSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6501:6580#L173)

``` go
type VMNetworkSpec struct {
Mode NetworkMode `json:"mode"`
Ports meta.PortMappings `json:"ports,omitempty"`
}
```

## <a name="VMSpec">type</a> [VMSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=5388:6321#L146)
## <a name="VMSpec">type</a> [VMSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=5380:6313#L144)

``` go
type VMSpec struct {
Expand All @@ -449,7 +415,7 @@ type VMSpec struct {

VMSpec describes the configuration of a VM

## <a name="VMStatus">type</a> [VMStatus](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=8389:8728#L241)
## <a name="VMStatus">type</a> [VMStatus](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7841:8180#L221)

``` go
type VMStatus struct {
Expand All @@ -464,7 +430,7 @@ type VMStatus struct {

VMStatus defines the status of a VM

## <a name="VMStorageSpec">type</a> [VMStorageSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6688:6832#L181)
## <a name="VMStorageSpec">type</a> [VMStorageSpec](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6641:6785#L178)

``` go
type VMStorageSpec struct {
Expand All @@ -475,7 +441,7 @@ type VMStorageSpec struct {

VMStorageSpec defines the VM’s Volumes and VolumeMounts

## <a name="Volume">type</a> [Volume](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6873:7004#L187)
## <a name="Volume">type</a> [Volume](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=6826:6957#L184)

``` go
type Volume struct {
Expand All @@ -486,7 +452,7 @@ type Volume struct {

Volume defines named storage volume

## <a name="VolumeMount">type</a> [VolumeMount](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7194:7290#L198)
## <a name="VolumeMount">type</a> [VolumeMount](https://github.com/weaveworks/ignite/tree/master/pkg/apis/ignite/v1alpha2/types.go?s=7147:7243#L195)

``` go
type VolumeMount struct {
Expand Down
Loading