config

package
v0.0.0-...-5984036 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KeldaDemoContext is the name of the context that connect to the
	// Kelda-maintained demo cluster. If this context is set, the user's local
	// kubeconfig is ignored.
	KeldaDemoContext = "kelda-demo-cluster"

	// UserConfigPath is the default path to the Kelda user config.
	UserConfigPath = "~/.kelda.yaml"

	// InitialUserConfigVersion is the first version of the Kelda
	// user config. Config files that do not specify a version
	// will default to this version.
	InitialUserConfigVersion = "v1alpha1"

	// SupportedUserConfigVersion is the supported version of the
	// Kelda user config of the current Kelda binary.
	SupportedUserConfigVersion = "v1alpha1"
)
View Source
const InitialSyncConfigVersion = "v1alpha1"

InitialSyncConfigVersion is the first version of the Kelda sync config. Config files that do not specify a version will default to this version.

View Source
const InitialWorkspaceConfigVersion = "v1alpha1"

InitialWorkspaceConfigVersion is the first version of the Kelda workspace config. Config files that do not specify a version will default to this version.

View Source
const SupportedSyncConfigVersion = "v1alpha1"

SupportedSyncConfigVersion is the supported version of the Kelda sync config of the current Kelda binary.

View Source
const SupportedWorkspaceConfigVersion = "v1alpha1"

SupportedWorkspaceConfigVersion is the supported version of the Kelda workspace config of the current Kelda binary.

Variables

View Source
var (

	// SupportedLicenseVersion is the supported version of the license
	// configuration.
	SupportedLicenseVersion = "v1alpha2"
)

Functions

func GetUserConfigPath

func GetUserConfigPath() (string, error)

Get the path to the user's global Kelda configuration. This path is expanded, so it can be directly passed to file operations.

func WriteUser

func WriteUser(cfg User) error

WriteUser writes the given user config to disk.

Types

type License

type License struct {
	// The version of the license format.
	Version string

	// The terms of the license.
	Terms Terms

	// Whether the license was properly signed.
	Signed bool
}

License contains the configuration required to grant a user access to use Kelda. Access is gated on the number of seats purchased and an expiry time.

func ParseLicense

func ParseLicense(licenseStr string) (License, error)

ParseLicense parses the license with the given contents. It expects licenses generated by License.Marshal.

func (License) CheckExpiration

func (license License) CheckExpiration() ([]*messages.Message, error)

CheckExpiration checks that the license has not expired.

func (License) CheckSeats

func (license License) CheckSeats(usedSeats int) ([]*messages.Message, error)

CheckSeats checks the customer is using a permissible number of seats.

func (License) Marshal

func (license License) Marshal(signingKey ed25519.PrivateKey) (string, error)

type LicenseType

type LicenseType int

LicenseType is the type of the license, currently just "trial" or "customer"

const (

	// Customer is a LicenseType indicating the license is for a signed-and-paid customer
	Customer LicenseType = 0

	// Trial is a LicenseType indicating a license for a client desiring a free trial
	Trial LicenseType = 1
)

type Service

type Service struct {
	Name      string   `json:"name,omitempty"`
	Script    []string `json:"script"`
	Manifests []string `json:"manifests,omitempty"`
}

Service contains the configuration required to boot a Microservice.

func (Service) GetDevCommand

func (svc Service) GetDevCommand() ([]string, error)

type SyncConfig

type SyncConfig struct {
	Version     string     `json:"version,omitempty"`
	Name        string     `json:"name"` // Required.
	Sync        []SyncRule `json:"sync,omitempty"`
	Command     []string   `json:"command,omitempty"`
	InitCommand []string   `json:"initCommand,omitempty"`
	Image       string     `json:"image,omitempty"`
	// contains filtered or unexported fields
}

SyncConfig contains the configuration that specifies how a service should be run when it's in development mode.

func ParseSyncConfig

func ParseSyncConfig(path string) (SyncConfig, error)

ParseSyncConfig parses the service configuration for `name` in the directory `path`.

func (SyncConfig) GetPath

func (c SyncConfig) GetPath() string

GetPath returns the filepath that the service was parsed from. A getter method is used rather than making the field public so that it can't get set by the yaml Unmarshalling.

func (SyncConfig) GetSyncConfigProto

func (c SyncConfig) GetSyncConfigProto() (syncConfig dev.SyncConfig)

GetSyncConfigProto returns the sync configuration as the protobuf type.

type SyncRule

type SyncRule struct {
	From        string   `json:"from"`
	To          string   `json:"to"`
	Except      []string `json:"except"`
	TriggerInit bool     `json:"triggerInit"`
}

SyncRule defines how to sync files from the local machine into the development container.

type Terms

type Terms struct {
	Customer   string      // the name of the customer
	Type       LicenseType // what type of license it is
	Seats      int         // how many seats the customer purchased
	ExpiryTime time.Time   // when the license expires
}

Terms contains the actionable terms of the license

type Tunnel

type Tunnel struct {
	ServiceName string `json:"serviceName"` // Required.
	LocalPort   uint32 `json:"localPort"`   // Required.
	RemotePort  uint32 `json:"remotePort"`  // Required.
}

Tunnel defines a desired tunnel between a local port and a service in the development environment.

type User

type User struct {
	Version   string `json:"version,omitempty"`
	Namespace string `json:"namespace"`
	Context   string `json:"context"`
	Workspace string `json:"workspace"`
}

User contains configuration used to identify the user.

func ParseUser

func ParseUser() (User, error)

ParseUser attempts to parse the User stored in the default path.

type Workspace

type Workspace struct {
	Version  string    `json:"version,omitempty"`
	Services []Service `json:"services"` // Required.
	Tunnels  []Tunnel  `json:"tunnels"`
	Ignore   []string  `json:"ignore"`
	// contains filtered or unexported fields
}

Workspace contains the main development environment configuration.

func ParseWorkspace

func ParseWorkspace(syncLogger *logrus.Logger, cfgPath string, ns string) (Workspace, error)

ParseWorkspace parses the config file at `cfgPath`.

func (Workspace) GetService

func (ws Workspace) GetService(name string) (Service, bool)

Jump to

Keyboard shortcuts

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