cmd

package
v0.0.0-...-3e2f06c Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 49 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidFileConfig is used when some error occurred on reading the configuration file. The message also provides instructions to search for how to set up configuration.
	ErrInvalidFileConfig = func(err error) error {
		return fmt.Errorf("failed converting configuration file: %v\nSee more details at https://nanovms.gitbook.io/ops/configuration", err)
	}
)

Functions

func BuildCommand

func BuildCommand() *cobra.Command

BuildCommand helps you to build image from ELF

func ComposeCommands

func ComposeCommands() *cobra.Command

ComposeCommands provides support for running binary with nanos

func ConvertJSONToConfig

func ConvertJSONToConfig(data []byte, c *types.Config) (err error)

ConvertJSONToConfig converts a byte array to an object of type configuration

func DeployCommand

func DeployCommand() *cobra.Command

DeployCommand builds image and deploy an instance

func EnvCommand

func EnvCommand() *cobra.Command

EnvCommand provides cross-build features.

func ExtractFromDockerImage

func ExtractFromDockerImage(imageName string, packageName string, parch string, targetExecutable string, quiet bool, verbose bool, copyWholeFS bool, args []string) (string, string)

ExtractFromDockerImage creates a package by extracting an executable and its shared libraries

func GetRootCommand

func GetRootCommand() *cobra.Command

GetRootCommand provides set all commands for Ops

func ImageCommands

func ImageCommands() *cobra.Command

ImageCommands provides image related command on GCP

func ImageNameToPackageNameAndVersion

func ImageNameToPackageNameAndVersion(imageName string) (string, string, error)

ImageNameToPackageNameAndVersion converts a Docker image name to a package name and version

func InstanceCommands

func InstanceCommands() *cobra.Command

InstanceCommands provides instance related commands

func LoadCommand

func LoadCommand() *cobra.Command

LoadCommand helps you to run application with package

func MovePackageFiles

func MovePackageFiles(origin string, target string) string

MovePackageFiles moves a package from a directory to another

func NetworkCommands

func NetworkCommands() *cobra.Command

NetworkCommands have the capability of creating/destroying networks. linux only for now - mac uses vmnet-bridged.

func PackageCommands

func PackageCommands() *cobra.Command

PackageCommands gives package related commands

func PersistBuildImageCommandFlags

func PersistBuildImageCommandFlags(cmdFlags *pflag.FlagSet)

PersistBuildImageCommandFlags append a command the required flags to run an image

func PersistConfigCommandFlags

func PersistConfigCommandFlags(cmdFlags *pflag.FlagSet)

PersistConfigCommandFlags append a command the required flags to run an image

func PersistCreateInstanceFlags

func PersistCreateInstanceFlags(cmdFlags *pflag.FlagSet)

PersistCreateInstanceFlags specify create instance flags in command

func PersistDeleteInstanceFlags

func PersistDeleteInstanceFlags(cmdFlags *pflag.FlagSet)

PersistDeleteInstanceFlags specify delete instance flags in command

func PersistGlobalCommandFlags

func PersistGlobalCommandFlags(cmdFlags *pflag.FlagSet)

PersistGlobalCommandFlags append the global flags to a command

func PersistNanosVersionCommandFlags

func PersistNanosVersionCommandFlags(cmdFlags *pflag.FlagSet)

PersistNanosVersionCommandFlags append nanos version flag to a command

func PersistNightlyCommandFlags

func PersistNightlyCommandFlags(cmdFlags *pflag.FlagSet)

PersistNightlyCommandFlags append nightly flag to a command

func PersistPkgCommandFlags

func PersistPkgCommandFlags(cmdFlags *pflag.FlagSet)

PersistPkgCommandFlags append a command the required flags to use a package

func PersistProviderCommandFlags

func PersistProviderCommandFlags(cmdFlags *pflag.FlagSet)

PersistProviderCommandFlags append a command the required flags to run an image

func PersistRunLocalInstanceCommandFlags

func PersistRunLocalInstanceCommandFlags(cmdFlags *pflag.FlagSet)

PersistRunLocalInstanceCommandFlags append a command the required flags to run an image

func PrepareNetworkPorts

func PrepareNetworkPorts(ports []string) (portsPrepared []string, err error)

PrepareNetworkPorts validates ports and split ports strings separated by commas

func ProfileCommand

func ProfileCommand() *cobra.Command

ProfileCommand provides a profile command

func RunCommand

func RunCommand() *cobra.Command

RunCommand provides support for running binary with nanos

func RunLocalInstance

func RunLocalInstance(c *types.Config) (err error)

RunLocalInstance runs a virtual machine in a hypervisor

func SubtractTimeNotation

func SubtractTimeNotation(date time.Time, notation string) (newDate time.Time, err error)

SubtractTimeNotation subtracts time notation timestamp from date passed by argument

func UpdateCommand

func UpdateCommand() *cobra.Command

UpdateCommand provides update related commands

func ValidateNetworkPorts

func ValidateNetworkPorts(ports []string) error

ValidateNetworkPorts verifies ports strings have right format Strings must have only numbers, commas or hyphens. Commas and hypens must separate 2 numbers

func VersionCommand

func VersionCommand() *cobra.Command

VersionCommand provides version command

func VolumeCommands

func VolumeCommands() *cobra.Command

VolumeCommands handles volumes related operations

Types

type BuildImageCommandFlags

type BuildImageCommandFlags struct {
	Type            string
	CmdArgs         []string
	DisableArgsCopy bool
	CmdEnvs         []string
	ImageName       string
	TFSv4           bool
	Mounts          []string
	TargetRoot      string
	IPAddress       string
	IPv6Address     string
	Netmask         string
	Gateway         string
	NetConsolePort  string
	NetConsoleIP    string
	Consoles        []string
}

BuildImageCommandFlags consolidates all command flags required to build an image in one struct

func NewBuildImageCommandFlags

func NewBuildImageCommandFlags(cmdFlags *pflag.FlagSet) (flags *BuildImageCommandFlags)

NewBuildImageCommandFlags returns an instance of BuildImageCommandFlags initialized with command flags values

func (*BuildImageCommandFlags) MergeToConfig

func (flags *BuildImageCommandFlags) MergeToConfig(c *types.Config) (err error)

MergeToConfig overrides configuration passed by argument with command flags values

type Compose

type Compose struct {
	// contains filtered or unexported fields
}

Compose holds information related to a compose session.

(eg: starts a dns server for svc discovery && associated unikernels in same network; each unikernel gets an address of name.service)

ops compose up

experimental and objective should be to *not* interfere with existing 'ops run', 'ops pkg load', 'ops instance create' functionality

run first:

ops pkg get eyberg/ops-dns:0.0.1

compose.yaml:

packages:

  • pkg: myserver name: mynewserver:0.0.1
  • pkg: myclient name: mynewclient:0.0.1

much of this probably belongs in a diff. pkg but not sure what to do there yet

func (Compose) UP

func (com Compose) UP(composeFile string)

UP reads in a compose.yaml and starts all services listed with svc discovery.

type ComposeFile

type ComposeFile struct {
	Packages []Package
}

ComposeFile represents a configuration for ops compose.

type ConfigCommandFlags

type ConfigCommandFlags struct {
	Config string
}

ConfigCommandFlags handles config file path flag and build configuration from the file

func NewConfigCommandFlags

func NewConfigCommandFlags(cmdFlags *pflag.FlagSet) (flags *ConfigCommandFlags)

NewConfigCommandFlags returns an instance of ConfigCommandFlags

func (*ConfigCommandFlags) MergeToConfig

func (flags *ConfigCommandFlags) MergeToConfig(c *types.Config) (err error)

MergeToConfig reads a json configuration file

type CreateInstanceFlags

type CreateInstanceFlags struct {
	DomainName string
	Flavor     string
	Ports      []string
	UDPPorts   []string
}

CreateInstanceFlags consolidates flags used to create an instance

func NewCreateInstanceCommandFlags

func NewCreateInstanceCommandFlags(cmdFlags *pflag.FlagSet) (flags *CreateInstanceFlags)

NewCreateInstanceCommandFlags returns an instance of CreateInstanceFlags

func (*CreateInstanceFlags) MergeToConfig

func (f *CreateInstanceFlags) MergeToConfig(config *types.Config) (err error)

MergeToConfig append command flags that are used to create an instance

type DeleteInstanceFlags

type DeleteInstanceFlags struct {
	DomainName string
}

DeleteInstanceFlags consolidates flags used for delete an instance

func NewDeleteInstanceCommandFlags

func NewDeleteInstanceCommandFlags(cmdFlags *pflag.FlagSet) (flags *DeleteInstanceFlags)

NewDeleteInstanceCommandFlags returns an instance of DeleteInstanceFlags

func (*DeleteInstanceFlags) MergeToConfig

func (f *DeleteInstanceFlags) MergeToConfig(config *types.Config) (err error)

MergeToConfig append command flags that are used to delete an instance

type GlobalCommandFlags

type GlobalCommandFlags struct {
	ShowWarnings bool
	ShowErrors   bool
	ShowDebug    bool
	JSON         bool
}

GlobalCommandFlags are flags accepted by every command

func NewGlobalCommandFlags

func NewGlobalCommandFlags(cmdFlags *pflag.FlagSet) (flags *GlobalCommandFlags)

NewGlobalCommandFlags returns an instance of GlobalCommandFlags

func (*GlobalCommandFlags) MergeToConfig

func (flags *GlobalCommandFlags) MergeToConfig(config *types.Config) (err error)

MergeToConfig append command flags that are used transversally for all commands to configuration

type MergeConfigContainer

type MergeConfigContainer struct {
	// contains filtered or unexported fields
}

MergeConfigContainer is responsible for merge a list of flags attributes to ops configuration

func NewMergeConfigContainer

func NewMergeConfigContainer(flags ...MergeConfigFlags) *MergeConfigContainer

NewMergeConfigContainer returns an instance of MergeConfigContainer Flags order matters.

func (*MergeConfigContainer) Merge

func (m *MergeConfigContainer) Merge(config *types.Config) error

Merge uses a list of flags to override configuration properties.

type MergeConfigFlags

type MergeConfigFlags interface {
	MergeToConfig(config *types.Config) error
}

MergeConfigFlags are flags structures able to override ops configuration attributes

type NanosVersionCommandFlags

type NanosVersionCommandFlags struct {
	NanosVersion string
}

NanosVersionCommandFlags is used to change configuration to use nanos version build tools paths

func NewNanosVersionCommandFlags

func NewNanosVersionCommandFlags(cmdFlags *pflag.FlagSet) (flags *NanosVersionCommandFlags)

NewNanosVersionCommandFlags returns an instance of NanosVersionCommandFlags

func (*NanosVersionCommandFlags) MergeToConfig

func (flags *NanosVersionCommandFlags) MergeToConfig(config *types.Config) (err error)

MergeToConfig downloads specified nanos version build and change configuration nanos tools paths

type Network

type Network struct {
	Network string
	Name    string
}

Network contains individual user-created network details.

type NightlyCommandFlags

type NightlyCommandFlags struct {
	Nightly bool
	Arch    string
}

NightlyCommandFlags is used to change configuration to use nightly build tools paths

func NewNightlyCommandFlags

func NewNightlyCommandFlags(cmdFlags *pflag.FlagSet) (flags *NightlyCommandFlags)

NewNightlyCommandFlags returns an instance of NightlyCommandFlags

func (*NightlyCommandFlags) MergeToConfig

func (flags *NightlyCommandFlags) MergeToConfig(config *types.Config) (err error)

MergeToConfig downloads nightly build and change configuration nanos tools paths

type Package

type Package struct {
	Pkg   string
	Name  string
	Local bool
}

Package is a part of the compose yaml file.

type PkgCommandFlags

type PkgCommandFlags struct {
	Package        string
	SluggedPackage string
	LocalPackage   bool
}

PkgCommandFlags consolidates all command flags required to use a provider

func NewPkgCommandFlags

func NewPkgCommandFlags(cmdFlags *pflag.FlagSet) (flags *PkgCommandFlags)

NewPkgCommandFlags returns an instance of PkgCommandFlags

func (*PkgCommandFlags) MergeToConfig

func (flags *PkgCommandFlags) MergeToConfig(c *types.Config) (err error)

MergeToConfig merge package configuration to ops configuration

func (*PkgCommandFlags) PackagePath

func (flags *PkgCommandFlags) PackagePath() string

PackagePath returns the package path in file system

func (*PkgCommandFlags) Parch

func (flags *PkgCommandFlags) Parch() string

Parch returns the user's preferred architecture which can ovveride the machine's architecture with the --arch flag.

type Profile

type Profile struct {
	OpsVersion   string
	NanosVersion string
	QemuVersion  string
	OS           string
	Arch         string
	Hypervisor   bool
}

Profile holds a particular host's configuration that is used to troubleshoot different environments. This is separate and different from a runtime cache.

type ProviderCommandFlags

type ProviderCommandFlags struct {
	TargetCloud string
	Zone        string
	Project     string
}

ProviderCommandFlags consolidates all command flags required to use a provider

func NewProviderCommandFlags

func NewProviderCommandFlags(cmdFlags *pflag.FlagSet) (flags *ProviderCommandFlags)

NewProviderCommandFlags returns an instance of ProviderCommandFlags

func (*ProviderCommandFlags) MergeToConfig

func (flags *ProviderCommandFlags) MergeToConfig(c *types.Config) (err error)

MergeToConfig merge provider flags to configuration

type RunLocalInstanceCommandFlags

type RunLocalInstanceCommandFlags struct {
	Accel           bool
	Bridged         bool
	BridgeName      string
	BridgeIPAddress string
	Debug           bool
	Force           bool
	GDBPort         int
	MissingFiles    bool
	NoTrace         []string
	Ports           []string
	SkipBuild       bool
	Memory          string
	Smp             int
	SyscallSummary  bool
	TapName         string
	Trace           bool
	Verbose         bool
	Arch            string
}

RunLocalInstanceCommandFlags consolidates all command flags required to run a local instance in one struct

func NewRunLocalInstanceCommandFlags

func NewRunLocalInstanceCommandFlags(cmdFlags *pflag.FlagSet) (flags *RunLocalInstanceCommandFlags)

NewRunLocalInstanceCommandFlags returns an instance of RunLocalInstanceCommandFlags initialized with command flags values

func (*RunLocalInstanceCommandFlags) MergeToConfig

func (flags *RunLocalInstanceCommandFlags) MergeToConfig(c *types.Config) error

MergeToConfig overrides configuration passed by argument with command flags values

Jump to

Keyboard shortcuts

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