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

New Storage Caching and Filtering framework #99

Merged
merged 5 commits into from
Jul 8, 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
16 changes: 8 additions & 8 deletions api/ignite.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ TODO: This should move into a dedicated validation package



## <a name="FileMapping">type</a> [FileMapping](/src/target/types.go?s=6735:6830#L179)
## <a name="FileMapping">type</a> [FileMapping](/src/target/types.go?s=6757:6852#L179)
``` go
type FileMapping struct {
HostPath string `json:"hostPath"`
Expand Down Expand Up @@ -173,7 +173,7 @@ Image represents a cached OCI image ready to be used with Ignite



## <a name="ImageClaim">type</a> [ImageClaim](/src/target/types.go?s=6330:6507#L165)
## <a name="ImageClaim">type</a> [ImageClaim](/src/target/types.go?s=6352:6529#L165)
``` go
type ImageClaim struct {
Type ImageSourceType `json:"type"`
Expand Down Expand Up @@ -285,7 +285,7 @@ This file is stored in /var/lib/firecracker/kernels/{oci-image-digest}/metadata.



## <a name="KernelClaim">type</a> [KernelClaim](/src/target/types.go?s=6565:6668#L173)
## <a name="KernelClaim">type</a> [KernelClaim](/src/target/types.go?s=6587:6690#L173)
``` go
type KernelClaim struct {
UID meta.UID `json:"uid"`
Expand Down Expand Up @@ -323,7 +323,7 @@ KernelSpec describes the properties of a kernel



## <a name="NetworkMode">type</a> [NetworkMode](/src/target/types.go?s=7016:7039#L190)
## <a name="NetworkMode">type</a> [NetworkMode](/src/target/types.go?s=7038:7061#L190)
``` go
type NetworkMode string
```
Expand Down Expand Up @@ -473,7 +473,7 @@ PoolStatus defines the Pool's current status



## <a name="SSH">type</a> [SSH](/src/target/types.go?s=6893:6959#L185)
## <a name="SSH">type</a> [SSH](/src/target/types.go?s=6915:6981#L185)
``` go
type SSH struct {
PublicKey string `json:"publicKey,omitempty"`
Expand Down Expand Up @@ -518,7 +518,7 @@ These files are stored in /var/lib/firecracker/vm/{vm-id}/metadata.json



## <a name="VMSpec">type</a> [VMSpec](/src/target/types.go?s=5440:6277#L144)
## <a name="VMSpec">type</a> [VMSpec](/src/target/types.go?s=5440:6299#L144)
``` go
type VMSpec struct {
Image *ImageClaim `json:"image"`
Expand Down Expand Up @@ -552,7 +552,7 @@ VMSpec describes the configuration of a VM



## <a name="VMState">type</a> [VMState](/src/target/types.go?s=7416:7435#L201)
## <a name="VMState">type</a> [VMState](/src/target/types.go?s=7435:7454#L201)
``` go
type VMState string
```
Expand All @@ -575,7 +575,7 @@ const (



## <a name="VMStatus">type</a> [VMStatus](/src/target/types.go?s=7595:7715#L210)
## <a name="VMStatus">type</a> [VMStatus](/src/target/types.go?s=7614:7734#L210)
``` go
type VMStatus struct {
State VMState `json:"state"`
Expand Down
36 changes: 22 additions & 14 deletions api/meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* [type IPAddresses](#IPAddresses)
* [func (i IPAddresses) String() string](#IPAddresses.String)
* [type Kind](#Kind)
* [func (k Kind) Lower() string](#Kind.Lower)
* [func (k Kind) String() string](#Kind.String)
* [func (k Kind) Upper() string](#Kind.Upper)
* [type Object](#Object)
Expand Down Expand Up @@ -95,7 +96,7 @@ where .Name, .UID, .Kind and .APIVersion become easily available



## <a name="APITypeList">type</a> [APITypeList](/src/target/meta.go?s=553:580#L25)
## <a name="APITypeList">type</a> [APITypeList](/src/target/meta.go?s=580:607#L27)
``` go
type APITypeList []*APIType
```
Expand Down Expand Up @@ -181,7 +182,7 @@ func (i IPAddresses) String() string



## <a name="Kind">type</a> [Kind](/src/target/meta.go?s=772:788#L36)
## <a name="Kind">type</a> [Kind](/src/target/meta.go?s=799:815#L38)
``` go
type Kind string
```
Expand All @@ -202,7 +203,14 @@ const (



### <a name="Kind.String">func</a> (Kind) [String](/src/target/meta.go?s=968:997#L47)
### <a name="Kind.Lower">func</a> (Kind) [Lower](/src/target/meta.go?s=1244:1272#L65)
``` go
func (k Kind) Lower() string
```



### <a name="Kind.String">func</a> (Kind) [String](/src/target/meta.go?s=995:1024#L49)
``` go
func (k Kind) String() string
```
Expand All @@ -211,7 +219,7 @@ Returns a lowercase string representation of the Kind



### <a name="Kind.Upper">func</a> (Kind) [Upper](/src/target/meta.go?s=1165:1193#L59)
### <a name="Kind.Upper">func</a> (Kind) [Upper](/src/target/meta.go?s=1192:1220#L61)
``` go
func (k Kind) Upper() string
```
Expand All @@ -220,7 +228,7 @@ Returns a uppercase string representation of the Kind



## <a name="Object">type</a> [Object](/src/target/meta.go?s=2243:2407#L104)
## <a name="Object">type</a> [Object](/src/target/meta.go?s=2345:2509#L110)
``` go
type Object interface {
runtime.Object
Expand Down Expand Up @@ -249,7 +257,7 @@ extra GetName() and GetUID() methods from ObjectMeta



## <a name="ObjectMeta">type</a> [ObjectMeta](/src/target/meta.go?s=1377:1515#L66)
## <a name="ObjectMeta">type</a> [ObjectMeta](/src/target/meta.go?s=1479:1617#L72)
``` go
type ObjectMeta struct {
Name string `json:"name"`
Expand All @@ -271,7 +279,7 @@ implement the Object interface



### <a name="ObjectMeta.GetCreated">func</a> (\*ObjectMeta) [GetCreated](/src/target/meta.go?s=1953:1992#L93)
### <a name="ObjectMeta.GetCreated">func</a> (\*ObjectMeta) [GetCreated](/src/target/meta.go?s=2055:2094#L99)
``` go
func (o *ObjectMeta) GetCreated() *Time
```
Expand All @@ -280,7 +288,7 @@ GetCreated returns when the Object was created



### <a name="ObjectMeta.GetName">func</a> (\*ObjectMeta) [GetName](/src/target/meta.go?s=1559:1596#L73)
### <a name="ObjectMeta.GetName">func</a> (\*ObjectMeta) [GetName](/src/target/meta.go?s=1661:1698#L79)
``` go
func (o *ObjectMeta) GetName() string
```
Expand All @@ -289,7 +297,7 @@ GetName returns the name of the Object



### <a name="ObjectMeta.GetUID">func</a> (\*ObjectMeta) [GetUID](/src/target/meta.go?s=1758:1791#L83)
### <a name="ObjectMeta.GetUID">func</a> (\*ObjectMeta) [GetUID](/src/target/meta.go?s=1860:1893#L89)
``` go
func (o *ObjectMeta) GetUID() UID
```
Expand All @@ -298,7 +306,7 @@ GetUID returns the UID of the Object



### <a name="ObjectMeta.SetCreated">func</a> (\*ObjectMeta) [SetCreated](/src/target/meta.go?s=2066:2106#L98)
### <a name="ObjectMeta.SetCreated">func</a> (\*ObjectMeta) [SetCreated](/src/target/meta.go?s=2168:2208#L104)
``` go
func (o *ObjectMeta) SetCreated(t *Time)
```
Expand All @@ -307,7 +315,7 @@ SetCreated returns when the Object was created



### <a name="ObjectMeta.SetName">func</a> (\*ObjectMeta) [SetName](/src/target/meta.go?s=1656:1697#L78)
### <a name="ObjectMeta.SetName">func</a> (\*ObjectMeta) [SetName](/src/target/meta.go?s=1758:1799#L84)
``` go
func (o *ObjectMeta) SetName(name string)
```
Expand All @@ -316,7 +324,7 @@ SetName sets the name of the Object



### <a name="ObjectMeta.SetUID">func</a> (\*ObjectMeta) [SetUID](/src/target/meta.go?s=1848:1884#L88)
### <a name="ObjectMeta.SetUID">func</a> (\*ObjectMeta) [SetUID](/src/target/meta.go?s=1950:1986#L94)
``` go
func (o *ObjectMeta) SetUID(uid UID)
```
Expand Down Expand Up @@ -496,7 +504,7 @@ The default string for Time is a human readable difference between the Time and



## <a name="TypeMeta">type</a> [TypeMeta](/src/target/meta.go?s=669:710#L28)
## <a name="TypeMeta">type</a> [TypeMeta](/src/target/meta.go?s=696:737#L30)
``` go
type TypeMeta struct {
metav1.TypeMeta
Expand All @@ -514,7 +522,7 @@ TypeMeta is an alias for the k8s/apimachinery TypeMeta with some additional meth



### <a name="TypeMeta.GetKind">func</a> (\*TypeMeta) [GetKind](/src/target/meta.go?s=712:745#L32)
### <a name="TypeMeta.GetKind">func</a> (\*TypeMeta) [GetKind](/src/target/meta.go?s=739:772#L34)
``` go
func (t *TypeMeta) GetKind() Kind
```
Expand Down
8 changes: 5 additions & 3 deletions cmd/ignite-spawn/ignite-spawn.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os"
"path"

"github.com/weaveworks/ignite/pkg/container/prometheus"

api "github.com/weaveworks/ignite/pkg/apis/ignite/v1alpha1"

"github.com/weaveworks/ignite/pkg/container"
"github.com/weaveworks/ignite/pkg/container/prometheus"
"github.com/weaveworks/ignite/pkg/metadata/loader"
)

func main() {
Expand All @@ -27,7 +27,7 @@ func Run() error {
}

vmID := os.Args[1]
opts, err := NewOptions(loader.NewResLoader(), vmID)
opts, err := NewOptions(vmID)
if err != nil {
return err
}
Expand All @@ -47,6 +47,8 @@ func StartVM(co *options) error {
}

// Serve metrics over an unix socket in the VM's own directory
// TODO: when restarting a VM using `start`, we get a panic:
// panic: listen unix /var/lib/firecracker/vm/6a2b6ebafcb0e75c/prometheus.sock: bind: address already in use
metricsSocket := path.Join(co.vm.ObjectPath(), "prometheus.sock")
go prometheus.ServeMetrics(metricsSocket)

Expand Down
11 changes: 5 additions & 6 deletions cmd/ignite-spawn/options.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package main

import (
"github.com/weaveworks/ignite/pkg/metadata/loader"
"github.com/weaveworks/ignite/pkg/client"
"github.com/weaveworks/ignite/pkg/filter"
"github.com/weaveworks/ignite/pkg/metadata/vmmd"
)

type options struct {
vm *vmmd.VM
}

func NewOptions(l *loader.ResLoader, vmMatch string) (*options, error) {
func NewOptions(vmMatch string) (*options, error) {
co := &options{}

if allVMS, err := l.VMs(); err == nil {
if co.vm, err = allVMS.MatchSingle(vmMatch); err != nil {
return nil, err
}
if vm, err := client.VMs().Find(filter.NewIDNameFilter(vmMatch)); err == nil {
co.vm = &vmmd.VM{vm}
} else {
return nil, err
}
Expand Down
4 changes: 1 addition & 3 deletions cmd/ignite/cmd/imgcmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package imgcmd
import (
"io"

"github.com/weaveworks/ignite/pkg/metadata/loader"

"github.com/lithammer/dedent"

"github.com/spf13/cobra"
Expand All @@ -25,7 +23,7 @@ func NewCmdImage(out io.Writer) *cobra.Command {
Aliases: []string{"images"},
Run: func(cmd *cobra.Command, args []string) {
errutils.Check(func() error {
i, err := run.NewImagesOptions(loader.NewResLoader())
i, err := run.NewImagesOptions()
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/ignite/cmd/imgcmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/spf13/cobra"
"github.com/weaveworks/ignite/cmd/ignite/run"
"github.com/weaveworks/ignite/pkg/errutils"
"github.com/weaveworks/ignite/pkg/metadata/loader"
)

// NewCmdImport imports a new VM image
Expand All @@ -28,7 +27,7 @@ func NewCmdImport(out io.Writer) *cobra.Command {
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
errutils.Check(func() error {
io, err := run.NewImportOptions(loader.NewResLoader(), args[0])
io, err := run.NewImportOptions(args[0])
if err != nil {
return err
}
Expand Down
4 changes: 1 addition & 3 deletions cmd/ignite/cmd/imgcmd/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package imgcmd
import (
"io"

"github.com/weaveworks/ignite/pkg/metadata/loader"

"github.com/lithammer/dedent"

"github.com/spf13/cobra"
Expand All @@ -29,7 +27,7 @@ func NewCmdRm(out io.Writer) *cobra.Command {
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
errutils.Check(func() error {
ro, err := rf.NewRmiOptions(loader.NewResLoader(), args)
ro, err := rf.NewRmiOptions(args)
if err != nil {
return err
}
Expand Down
4 changes: 1 addition & 3 deletions cmd/ignite/cmd/kerncmd/kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package kerncmd
import (
"io"

"github.com/weaveworks/ignite/pkg/metadata/loader"

"github.com/lithammer/dedent"

"github.com/spf13/cobra"
Expand All @@ -25,7 +23,7 @@ func NewCmdKernel(out io.Writer) *cobra.Command {
Aliases: []string{"kernels"},
Run: func(cmd *cobra.Command, args []string) {
errutils.Check(func() error {
ko, err := run.NewKernelsOptions(loader.NewResLoader())
ko, err := run.NewKernelsOptions()
if err != nil {
return err
}
Expand Down
4 changes: 1 addition & 3 deletions cmd/ignite/cmd/kerncmd/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package kerncmd
import (
"io"

"github.com/weaveworks/ignite/pkg/metadata/loader"

"github.com/lithammer/dedent"

"github.com/spf13/cobra"
Expand All @@ -29,7 +27,7 @@ func NewCmdRm(out io.Writer) *cobra.Command {
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
errutils.Check(func() error {
ro, err := rf.NewRmkOptions(loader.NewResLoader(), args)
ro, err := rf.NewRmkOptions(args)
if err != nil {
return err
}
Expand Down
4 changes: 1 addition & 3 deletions cmd/ignite/cmd/vmcmd/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package vmcmd
import (
"io"

"github.com/weaveworks/ignite/pkg/metadata/loader"

"github.com/lithammer/dedent"

"github.com/spf13/cobra"
Expand All @@ -25,7 +23,7 @@ func NewCmdAttach(out io.Writer) *cobra.Command {
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
errutils.Check(func() error {
ao, err := run.NewAttachOptions(loader.NewResLoader(), args[0])
ao, err := run.NewAttachOptions(args[0])
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/ignite/cmd/vmcmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/weaveworks/ignite/cmd/ignite/cmd/cmdutil"
"github.com/weaveworks/ignite/cmd/ignite/run"
"github.com/weaveworks/ignite/pkg/errutils"
"github.com/weaveworks/ignite/pkg/metadata/loader"
)

// NewCmdCreate creates a new VM given an image and a kernel
Expand Down Expand Up @@ -40,7 +39,7 @@ func NewCmdCreate(out io.Writer) *cobra.Command {
Args: cobra.RangeArgs(0, 1),
Run: func(cmd *cobra.Command, args []string) {
errutils.Check(func() error {
co, err := cf.NewCreateOptions(loader.NewResLoader(), args)
co, err := cf.NewCreateOptions(args)
if err != nil {
return err
}
Expand Down
Loading