Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigDir(path string) string
- func ConfigName(path string) string
- func GetProjectSlug(projectID string) (string, error)
- func GetServiceTypes() []string
- func InterpolateStamps(s string) string
- func NewProjectId() string
- type Builder
- type Config
- func (c *Config) AddNewCronService(name string, command []string, schedule string) Cron
- func (c *Config) AddNewJobHelmChart(name string, command []string, schedule string) HelmChart
- func (c *Config) AddNewJobService(name string, command []string, schedule string) Job
- func (c *Config) AddNewWebService(name string) Web
- func (c *Config) Builders() map[string]Builder
- func (c *Config) Cronjobs() []Cron
- func (c *Config) GetCluster() string
- func (cfg *Config) GetInstanceName() string
- func (c *Config) GetProjectID() string
- func (cfg *Config) GetProjectName() string
- func (c *Config) GetProjectNameWithSlug() string
- func (c *Config) GetProjectSlug() string
- func (c *Config) HasDefaultFileName() bool
- func (cfg *Config) HasDeployment() (bool, error)
- func (c *Config) HelmCharts() []HelmChart
- func (c *Config) Jobs() []Job
- func (cfg *Config) SaveConfig(path string) (string, error)
- func (cfg *Config) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (c *Config) WebService() (Web, error)
- type Cron
- type EnvironmentFields
- type EnvsecFields
- type FlagSet
- type HelmChart
- type InstanceType
- func (i *InstanceType) Compute() string
- func (InstanceType) Descriptor() protoreflect.EnumDescriptor
- func (x InstanceType) Enum() *InstanceType
- func (InstanceType) EnumDescriptor() ([]byte, []int)deprecated
- func (i *InstanceType) MarshalYAML() (any, error)
- func (i *InstanceType) Memory() string
- func (x InstanceType) Number() protoreflect.EnumNumber
- func (x InstanceType) String() string
- func (InstanceType) Type() protoreflect.EnumType
- func (i *InstanceType) UnmarshalYAML(value *yaml.Node) error
- type Job
- type Service
- type Web
Constants ¶
const ( CronType = "cron" HelmChartType = "helm" JobType = "job" WebType = "web" )
Types
const DefaultAppPodPort = 8080
TODO DEV-983 consolidate default helm value constants
const JetpackEnvsecProvider = "jetpack"
const ProjectIDPrefix = "proj"
Variables ¶
var ( InstanceType_name = map[int32]string{ 0: "UNKNOWN", 1: "NANO", 2: "MICRO", 3: "SMALL", 4: "MEDIUM", 5: "MEDIUM_PLUS", } InstanceType_value = map[string]int32{ "UNKNOWN": 0, "NANO": 1, "MICRO": 2, "SMALL": 3, "MEDIUM": 4, "MEDIUM_PLUS": 5, } )
Enum value maps for InstanceType.
var ErrConfigNotFound = errors.New("jetconfig (launchpad.yaml) was not found")
var ErrInvalidProjectID = errors.New("project ID is invalid")
var File_padcli_jetconfig_jetconfig_proto protoreflect.FileDescriptor
var Versions = version{ // contains filtered or unexported fields }
singleton (unenforced) for this package
Functions ¶
func ConfigName ¶
func GetProjectSlug ¶
func GetServiceTypes ¶
func GetServiceTypes() []string
func InterpolateStamps ¶
func NewProjectId ¶
func NewProjectId() string
Types ¶
type Builder ¶
type Builder interface { GetBuildCommand() string GetImage() string GetInstanceType() *InstanceType GetPath() string ShouldPublish() bool }
Builder is an interface for services that may have BuildCommand fields. NOTE: not all builders will eventually have image. For example, helm-services may be builders but may not have images. We may refactor when introducing such builders.
type Config ¶
type Config struct { ConfigVersion string `yaml:"configVersion,omitempty"` // typeid generated for each project for storing env vars without having to rely on // project name which may change over time ProjectID string `yaml:"projectId,omitempty"` Name string `yaml:"name,omitempty"` // The cluster to deploy to. Should be the unique name of a Jetpack-managed cluster, // or the name of a context in the user's kubeconfig. Cluster string `yaml:"cluster,omitempty"` // --cluster Envsec EnvsecFields `yaml:"envsec,omitempty"` ImageRepository string `yaml:"imageRepository,omitempty"` Environment map[string]EnvironmentFields `yaml:"environment,omitempty"` Services services `yaml:"services,omitempty"` // The file path to this jetconfig Path string `yaml:"-"` // contains filtered or unexported fields }
TODO, make this struct unexported
func RequireFromFileSystem ¶
func RequireFromFileSystem( ctx context.Context, path string, env api.Environment, ) (*Config, error)
RequireFromFileSystem will: - read launchpad.yaml at `path` in the file system - populates the Config struct from the file's contents, via yaml unmarshalling - upgrade the jetconfig with newer fields - if config doesn't exist, it returns an error.
func (*Config) AddNewCronService ¶
instantiates a new Cron service for initcmd
func (*Config) AddNewJobHelmChart ¶
instantiates a new Job service for initcmd
func (*Config) AddNewJobService ¶
instantiates a new Job service for initcmd
func (*Config) AddNewWebService ¶
instantiates a new Web service for initcmd
func (*Config) GetCluster ¶
func (*Config) GetInstanceName ¶
func (*Config) GetProjectID ¶
func (*Config) GetProjectName ¶
func (*Config) GetProjectNameWithSlug ¶
func (*Config) GetProjectSlug ¶
func (*Config) HasDefaultFileName ¶
func (*Config) HasDeployment ¶
func (*Config) HelmCharts ¶
func (*Config) UnmarshalYAML ¶
func (*Config) WebService ¶
For now, at most one web service is expected If no web service is specified, then returns empty-string for name, and nil for *Web
NOTE: if we add a service.Name field, then this API improves TODO DEV-966 enable multiple web-services. Change function's name and type.
type Cron ¶
type Cron interface { Builder Service GetSchedule() string GetConcurrencyPolicy() string GetCommand() []string }
Public Cron interface
type EnvironmentFields ¶
type EnvironmentFields struct { // Default flags Flags FlagSet `yaml:"flags,omitempty"` }
type EnvsecFields ¶
type EnvsecFields struct {
Provider string `yaml:"provider,omitempty"`
}
type InstanceType ¶
type InstanceType int32
const ( InstanceType_UNKNOWN InstanceType = 0 InstanceType_NANO InstanceType = 1 InstanceType_MICRO InstanceType = 2 InstanceType_SMALL InstanceType = 3 InstanceType_MEDIUM InstanceType = 4 InstanceType_MEDIUM_PLUS InstanceType = 5 )
func (*InstanceType) Compute ¶
func (i *InstanceType) Compute() string
func (InstanceType) Descriptor ¶
func (InstanceType) Descriptor() protoreflect.EnumDescriptor
func (InstanceType) Enum ¶
func (x InstanceType) Enum() *InstanceType
func (InstanceType) EnumDescriptor
deprecated
func (InstanceType) EnumDescriptor() ([]byte, []int)
Deprecated: Use InstanceType.Descriptor instead.
func (*InstanceType) MarshalYAML ¶
func (i *InstanceType) MarshalYAML() (any, error)
func (*InstanceType) Memory ¶
func (i *InstanceType) Memory() string
func (InstanceType) Number ¶
func (x InstanceType) Number() protoreflect.EnumNumber
func (InstanceType) String ¶
func (x InstanceType) String() string
func (InstanceType) Type ¶
func (InstanceType) Type() protoreflect.EnumType
func (*InstanceType) UnmarshalYAML ¶
func (i *InstanceType) UnmarshalYAML(value *yaml.Node) error