byoc

package
v0.0.0-...-d8aa2a0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CdTaskPrefix = "defang-cd" // WARNING: renaming this practically deletes the Pulumi state
	UploadPrefix = "uploads/"
)

Variables

View Source
var (
	DefangPulumiBackend    = os.Getenv("DEFANG_PULUMI_BACKEND") // FIXME: allow override in .defang file
	ErrLocalPulumiStopped  = errors.New("local pulumi command succeeded; stopping")
	PulumiConfigPassphrase = pkg.Getenv("PULUMI_CONFIG_PASSPHRASE", "asdf") // FIXME: allow override in .defang file
)

Functions

func DebugPulumiCD

func DebugPulumiCD(ctx context.Context, env []string, cmd ...string) error

DebugPulumiCD runs the multi-cloud cd binary (pulumi-defang/cd) locally instead of starting it as a cloud task. Gated on DEFANG_PULUMI_DIR pointing at the pulumi-defang repo root. Used to iterate on cd code without rebuilding/pushing the cd container image.

func DebugPulumiGolang

func DebugPulumiGolang(ctx context.Context, env []string, cmd ...string) error

func DebugPulumiNodeJS

func DebugPulumiNodeJS(ctx context.Context, env []string, cmd ...string) error

func GetPulumiBackend

func GetPulumiBackend(stateUrl string) (string, string, error)

func ParseTTL

func ParseTTL(value string, now time.Time) (string, error)

ParseTTL normalizes a deployment time-to-live for the CD program, which reads it from the DEFANG_TTL env var of the CD run into its defang:ttl stack config (see parseTTL in pulumi-defang's cd/program/ttl.go) to schedule the stack's self-destruct. Accepted inputs:

  • "", "0" and "never": no self-destruct
  • a Go duration with an optional whole-days prefix ("12h", "7d", "7d12h"): passed through unchanged, the CD parses the same syntax
  • a timestamp, in the same formats as `logs --since/--until` (RFC3339, unix seconds/millis): translated to the duration from now until that moment, because the CD only accepts durations

The minTTL floor is enforced here; the CD's maxTTL remains the sole, authoritative guard against typo'd far-future dates, so that rule cannot drift between the two sides.

Types

type ByocBaseClient

type ByocBaseClient struct {
	client.RetryDelayer

	Prefix      string
	PulumiStack string
	SetupDone   bool
	TenantLabel types.TenantLabel
	CanIUseConfig
	// contains filtered or unexported fields
}

func NewByocBaseClient

func NewByocBaseClient(tenantLabel types.TenantLabel, backend ProjectBackend, stack string) *ByocBaseClient

func (*ByocBaseClient) GetEndpoint

func (b *ByocBaseClient) GetEndpoint(serviceName string, projectName, delegateDomain string, port *composeTypes.ServicePortConfig) string

This function was copied from Fabric controller and slightly modified to work with BYOC

func (*ByocBaseClient) GetPrivateFqdn

func (b *ByocBaseClient) GetPrivateFqdn(projectName string, serviceName string) string

This function was copied from Fabric controller and slightly modified to work with BYOC

func (*ByocBaseClient) GetProjectLabel

func (b *ByocBaseClient) GetProjectLabel(projectName string) string

GetProjectLabel returns the DNS-safe project label, including stack (if applicable)

func (*ByocBaseClient) GetProjectUpdatePath

func (b *ByocBaseClient) GetProjectUpdatePath(projectName string) string

func (*ByocBaseClient) GetPublicFqdn

func (b *ByocBaseClient) GetPublicFqdn(projectName, delegateDomain, serviceName string) string

This function was copied from Fabric controller and slightly modified to work with BYOC

func (*ByocBaseClient) GetServiceInfos

func (b *ByocBaseClient) GetServiceInfos(ctx context.Context, projectName, delegateDomain, etag string, services map[string]composeTypes.ServiceConfig) ([]*defangv1.ServiceInfo, error)

func (*ByocBaseClient) GetStackName

func (b *ByocBaseClient) GetStackName() string

func (*ByocBaseClient) GetStackNameForDomain

func (b *ByocBaseClient) GetStackNameForDomain() string

func (*ByocBaseClient) HasDelegatedSubdomain

func (b *ByocBaseClient) HasDelegatedSubdomain() bool

HasDelegatedSubdomain returns true by default; providers that do not yet implement domain delegation (DO) override this to return false.

func (*ByocBaseClient) RemoteProjectName

func (b *ByocBaseClient) RemoteProjectName(ctx context.Context) (string, error)

func (*ByocBaseClient) ServicePrivateDNS

func (b *ByocBaseClient) ServicePrivateDNS(serviceName string) string

func (*ByocBaseClient) ServicePublicDNS

func (b *ByocBaseClient) ServicePublicDNS(serviceName string, projectName string) string

func (*ByocBaseClient) SetCanIUseConfig

func (b *ByocBaseClient) SetCanIUseConfig(quotas *defangv1.CanIUseResponse)

func (*ByocBaseClient) StackDir

func (b *ByocBaseClient) StackDir(projectName, name string) string

stackDir returns a stack-qualified path, like the Pulumi TS function `stackDir`

func (*ByocBaseClient) UpdateShardDomain

func (*ByocBaseClient) UpdateShardDomain(ctx context.Context) error

type CanIUseConfig

type CanIUseConfig struct {
	AllowGPU      bool
	AllowScaling  bool
	CDImage       string
	PulumiVersion string
	AwsApnId      string
}

type ErrMultipleProjects

type ErrMultipleProjects struct {
	ProjectNames []string
}

func (ErrMultipleProjects) Error

func (mp ErrMultipleProjects) Error() string

type ErrNoPermission

type ErrNoPermission string

func (ErrNoPermission) Error

func (e ErrNoPermission) Error() string

type Node

type Node struct {
	Name        string
	Deps        []string
	ServiceInfo *defangv1.ServiceInfo
	Visited     bool
}

Simple DFS topological sort to make sure the dependencies are created first

type ProjectBackend

type ProjectBackend interface {
	CdCommand(context.Context, client.CdCommandRequest) (*client.CdCommandResponse, error)
	CdList(context.Context, bool) (iter.Seq[state.Info], error)
	GetPrivateDomain(projectName string) string
	GetProjectUpdate(context.Context, string) (*defangv1.ProjectUpdate, error)
}

type ServiceInfoUpdater

type ServiceInfoUpdater interface {
	UpdateServiceInfo(ctx context.Context, serviceInfo *defangv1.ServiceInfo, projectName, delegateDomain string, service composeTypes.ServiceConfig) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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