remote

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

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

Go to latest
Published: Feb 20, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownChange = errors.New("unknown kind of change")

Functions

func ClusterError

func ClusterError(err error) error

func PlatformTestBattery

func PlatformTestBattery(t *testing.T, wrap func(mock Platform) Platform)

func UnavailableError

func UnavailableError(err error) error

func UnsupportedResourceKind

func UnsupportedResourceKind(err error) error

func UpgradeNeededError

func UpgradeNeededError(err error) error

Types

type Change

type Change struct {
	Kind   ChangeKind  // essentially a type tag
	Source interface{} // what changed
}

func (*Change) UnmarshalJSON

func (c *Change) UnmarshalJSON(bs []byte) error

type ChangeKind

type ChangeKind string
const (
	GitChange   ChangeKind = "git"
	ImageChange ChangeKind = "image"
)

func (ChangeKind) MarshalJSON

func (k ChangeKind) MarshalJSON() ([]byte, error)

type ErrorLoggingPlatform

type ErrorLoggingPlatform struct {
	Platform Platform
	Logger   log.Logger
}

func (*ErrorLoggingPlatform) Export

func (p *ErrorLoggingPlatform) Export(ctx context.Context) (config []byte, err error)

func (*ErrorLoggingPlatform) GitRepoConfig

func (p *ErrorLoggingPlatform) GitRepoConfig(ctx context.Context, regenerate bool) (_ flux.GitConfig, err error)

func (*ErrorLoggingPlatform) JobStatus

func (p *ErrorLoggingPlatform) JobStatus(ctx context.Context, jobID job.ID) (_ job.Status, err error)

func (*ErrorLoggingPlatform) ListImages

func (p *ErrorLoggingPlatform) ListImages(ctx context.Context, spec update.ResourceSpec) (_ []flux.ImageStatus, err error)

func (*ErrorLoggingPlatform) ListServices

func (p *ErrorLoggingPlatform) ListServices(ctx context.Context, maybeNamespace string) (_ []flux.ControllerStatus, err error)

func (*ErrorLoggingPlatform) NotifyChange

func (p *ErrorLoggingPlatform) NotifyChange(ctx context.Context, change Change) (err error)

func (*ErrorLoggingPlatform) Ping

func (p *ErrorLoggingPlatform) Ping(ctx context.Context) (err error)

func (*ErrorLoggingPlatform) SyncStatus

func (p *ErrorLoggingPlatform) SyncStatus(ctx context.Context, ref string) (_ []string, err error)

func (*ErrorLoggingPlatform) UpdateManifests

func (p *ErrorLoggingPlatform) UpdateManifests(ctx context.Context, u update.Spec) (_ job.ID, err error)

func (*ErrorLoggingPlatform) Version

func (p *ErrorLoggingPlatform) Version(ctx context.Context) (v string, err error)

type FatalError

type FatalError struct {
	Err error
}

Wrap errors in this to indicate that the platform should be considered dead, and disconnected.

func (FatalError) Error

func (err FatalError) Error() string

type GitUpdate

type GitUpdate struct {
	URL string
}

type ImageUpdate

type ImageUpdate struct {
	Name image.Name
}

type MockPlatform

type MockPlatform struct {
	PingError error

	VersionAnswer string
	VersionError  error

	ExportAnswer []byte
	ExportError  error

	ListServicesAnswer []flux.ControllerStatus
	ListServicesError  error

	ListImagesAnswer []flux.ImageStatus
	ListImagesError  error

	UpdateManifestsArgTest func(update.Spec) error
	UpdateManifestsAnswer  job.ID
	UpdateManifestsError   error

	NotifyChangeError error

	SyncStatusAnswer []string
	SyncStatusError  error

	JobStatusAnswer job.Status
	JobStatusError  error

	GitRepoConfigAnswer flux.GitConfig
	GitRepoConfigError  error
}

func (*MockPlatform) Export

func (p *MockPlatform) Export(ctx context.Context) ([]byte, error)

func (*MockPlatform) GitRepoConfig

func (p *MockPlatform) GitRepoConfig(ctx context.Context, regenerate bool) (flux.GitConfig, error)

func (*MockPlatform) JobStatus

func (p *MockPlatform) JobStatus(context.Context, job.ID) (job.Status, error)

func (*MockPlatform) ListImages

func (*MockPlatform) ListServices

func (p *MockPlatform) ListServices(ctx context.Context, ns string) ([]flux.ControllerStatus, error)

func (*MockPlatform) NotifyChange

func (p *MockPlatform) NotifyChange(ctx context.Context, change Change) error

func (*MockPlatform) Ping

func (p *MockPlatform) Ping(ctx context.Context) error

func (*MockPlatform) SyncStatus

func (p *MockPlatform) SyncStatus(context.Context, string) ([]string, error)

func (*MockPlatform) UpdateManifests

func (p *MockPlatform) UpdateManifests(ctx context.Context, s update.Spec) (job.ID, error)

func (*MockPlatform) Version

func (p *MockPlatform) Version(ctx context.Context) (string, error)

type Platform

type Platform interface {
	PlatformV9
}

Platform is the SPI for the daemon; i.e., it's all the things we have to ask to the daemon, rather than the service.

func Instrument

func Instrument(p Platform) Platform

type PlatformV4

type PlatformV4 interface {
	Ping(context.Context) error
	Version(context.Context) (string, error)
}

type PlatformV5

type PlatformV5 interface {
	PlatformV4
	// We still support this, for bootstrapping; but it might
	// reasonably be moved to the daemon interface, or removed in
	// favour of letting people use their cluster-specific tooling.
	Export(context.Context) ([]byte, error)
}

type PlatformV6

type PlatformV6 interface {
	PlatformV6Deprecated
	PlatformV6NotDeprecated
}

type PlatformV6Deprecated

type PlatformV6Deprecated interface {
	// Poke the daemon to sync with git
	SyncNotify(context.Context) error
}

type PlatformV6NotDeprecated

type PlatformV6NotDeprecated interface {
	PlatformV5
	// These are new, or newly moved to this interface
	ListServices(ctx context.Context, namespace string) ([]flux.ControllerStatus, error)
	ListImages(context.Context, update.ResourceSpec) ([]flux.ImageStatus, error)
	// Send a spec for updating config to the daemon
	UpdateManifests(context.Context, update.Spec) (job.ID, error)
	// Ask the daemon where it's up to with syncing
	SyncStatus(ctx context.Context, ref string) ([]string, error)
	// Ask the daemon where it's up to with job processing
	JobStatus(context.Context, job.ID) (job.Status, error)
	// Get the daemon's public SSH key
	GitRepoConfig(ctx context.Context, regenerate bool) (flux.GitConfig, error)
}

In which we move functionality that refers to the Git repo or image registry into the platform. Methods that we no longer use are deprecated, so this does not include the previous definitions, though it does include some their methods.

type PlatformV9

type PlatformV9 interface {
	PlatformV6NotDeprecated
	// ChangeNotify tells the daemon that we've noticed a change in
	// e.g., the git repo, or image registry, and now would be a good
	// time to update its state.
	NotifyChange(context.Context, Change) error
}

PlatformV9 effectively replaces the SyncNotify with the more generic ChangeNotify, so we can use it to inform the daemon of new images (or rather, a change to an image repo that is _probably_ a new image being pushed)

Directories

Path Synopsis
This is a `net/rpc`-compatible implementation of a client and server for `flux/remote.Platform`.
This is a `net/rpc`-compatible implementation of a client and server for `flux/remote.Platform`.

Jump to

Keyboard shortcuts

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