api

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeWebAPI

type FakeWebAPI struct {
}

FakeWebAPI implements the fake behaviors for the gRPC definitions of WebAPI.

func NewFakeWebAPI

func NewFakeWebAPI() *FakeWebAPI

NewFakeWebAPI creates a new FakeWebAPI instance.

func (*FakeWebAPI) ApproveStage

func (*FakeWebAPI) DisablePiped

func (*FakeWebAPI) EnablePiped

func (*FakeWebAPI) GetCommand

func (*FakeWebAPI) GetMe

func (*FakeWebAPI) GetPiped

func (*FakeWebAPI) GetProject

func (*FakeWebAPI) GetStageLog

func (*FakeWebAPI) ListPipeds

func (*FakeWebAPI) Register

func (a *FakeWebAPI) Register(server *grpc.Server)

Register registers all handling of this service into the specified gRPC server.

type PipedAPI

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

PipedAPI implements the behaviors for the gRPC definitions of PipedAPI.

func NewPipedAPI

NewPipedAPI creates a new PipedAPI instance.

func (*PipedAPI) CreateDeployment

CreateDeployment creates/triggers a new deployment for an application that is managed by this piped. This will be used by DeploymentTrigger component.

func (*PipedAPI) GetApplicationMostRecentDeployment

GetApplicationMostRecentDeployment returns the most recent deployment of the given application.

func (*PipedAPI) GetEnvironment

GetEnvironment finds and returns the environment for the specified ID.

func (*PipedAPI) ListApplications

ListApplications returns a list of registered applications that should be managed by the requested piped. Disabled applications should not be included in the response. Piped uses this RPC to fetch and sync the application configuration into its local database.

func (*PipedAPI) ListNotCompletedDeployments

ListNotCompletedDeployments returns a list of not completed deployments which are managed by this piped. DeploymentController component uses this RPC to spawns/syncs its local deployment executors.

func (*PipedAPI) ListUnhandledCommands

ListUnhandledCommands is periodically called by piped to obtain the commands that should be handled. Whenever an user makes an interaction from WebUI (cancel/approve/retry/sync) a new command with a unique identifier will be generated an saved into the datastore. Piped uses this RPC to list all still-not-handled commands to handle them, then report back the result to server. On other side, the web will periodically check the command status and feedback the result to user. In the future, we may need a solution to remove all old-handled commands from datastore for space.

func (*PipedAPI) Ping

Ping is periodically sent to report its realtime status/stats to control-plane. The received stats will be pushed to the metrics collector.

func (*PipedAPI) Register

func (a *PipedAPI) Register(server *grpc.Server)

Register registers all handling of this service into the specified gRPC server.

func (*PipedAPI) ReportApplicationLiveState

ReportApplicationLiveState is periodically sent to correct full state of an application. For kubernetes application, this contains a full tree of its kubernetes resources. The tree data should be written into filestore immediately and then the state in cache should be refreshsed too.

func (*PipedAPI) ReportApplicationLiveStateEvents

ReportApplicationLiveStateEvents is sent by piped to submit one or multiple events about the changes of application state. Control plane uses the received events to update the state of application-resource-tree. We want to start by a simple solution at this initial stage of development, so the API server just handles as below: - loads the releated application-resource-tree from filestore - checks and builds new state for the application-resource-tree - updates new state into fielstore and cache (cache data is for reading while handling web requests) In the future, we may want to redesign the behavior of this RPC by using pubsub/queue pattern. After receiving the events, all of them will be publish into a queue immediately, and then another Handler service will pick them inorder to apply to build new state. By that way we can control the traffic to the datastore in a better way.

func (*PipedAPI) ReportApplicationMostRecentDeployment

ReportApplicationMostRecentDeployment is used to update the basic information about the most recent deployment of a specific application.

func (*PipedAPI) ReportApplicationSyncState

ReportApplicationSyncState is used to update the sync status of an application.

func (*PipedAPI) ReportCommandHandled

ReportCommandHandled is called by piped to mark a specific command as handled. The request payload will contain the handle status as well as any additional result data. The handle result should be updated to both datastore and cache (for reading from web).

func (*PipedAPI) ReportDeploymentCompleted

ReportDeploymentCompleted used by piped to update the status of a specific deployment to SUCCESS | FAILURE | CANCELLED.

func (*PipedAPI) ReportDeploymentPlanned

ReportDeploymentPlanned used by piped to update the status of a specific deployment to PLANNED.

func (*PipedAPI) ReportDeploymentStatusChanged

ReportDeploymentStatusChanged is used to update the status of a specific deployment to RUNNING or ROLLING_BACK.

func (*PipedAPI) ReportPipedMeta

ReportPipedMeta is sent by piped while starting up to report its metadata such as configured cloud providers.

func (*PipedAPI) ReportStageLogs

ReportStageLogs is sent by piped to save the log of a pipeline stage.

func (*PipedAPI) ReportStageLogsFromLastCheckpoint

ReportStageLogsFromLastCheckpoint is used to save the full logs from the most recently saved point.

func (*PipedAPI) ReportStageStatusChanged

ReportStageStatusChanged used by piped to update the status of a specific stage of a deployment.

func (*PipedAPI) SaveDeploymentMetadata

SaveDeploymentMetadata used by piped to persist the metadata of a specific deployment.

func (*PipedAPI) SaveStageMetadata

SaveStageMetadata used by piped to persist the metadata of a specific stage of a deployment.

type WebAPI

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

WebAPI implements the behaviors for the gRPC definitions of WebAPI.

func NewWebAPI

func NewWebAPI(
	ctx context.Context,
	ds datastore.DataStore,
	sls stagelogstore.Store,
	alss applicationlivestatestore.Store,
	cmds commandstore.Store,
	projs map[string]config.ControlPlaneProject,
	encrypter encrypter,
	logger *zap.Logger) *WebAPI

NewWebAPI creates a new WebAPI instance.

func (*WebAPI) AddApplication

TODO: Validate the specified piped to ensure that it belongs to the specified environment.

func (*WebAPI) DisableStaticAdmin

DisableStaticAdmin disables static admin login.

func (*WebAPI) EnableStaticAdmin

EnableStaticAdmin enables static admin login.

func (*WebAPI) GetCommand

func (*WebAPI) GetMe

GetMe gets information about the current user.

func (*WebAPI) GetPiped

func (*WebAPI) GetProject

GetProject gets the specified porject without sensitive data.

func (*WebAPI) ListPipeds

TODO: Consider using piped-stats to decide piped connection status.

func (*WebAPI) Register

func (a *WebAPI) Register(server *grpc.Server)

Register registers all handling of this service into the specified gRPC server.

func (*WebAPI) UpdateProjectRBACConfig

UpdateProjectRBACConfig updates the sso settings.

func (*WebAPI) UpdateProjectSSOConfig

UpdateProjectSSOConfig updates the sso settings.

func (*WebAPI) UpdateProjectStaticAdmin

UpdateProjectStaticAdmin updates the static admin user settings.

Jump to

Keyboard shortcuts

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