service

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TaskTTL is the minimum number of ticks (every ~10sec) within which a given task must be completed
	// before being rescheduled again.
	TaskTTL = 750 // ~2 hour

	// Tick represents the interval at which each manifest state is checked.
	Tick = 10 * time.Second
)

Variables

View Source
var (
	TasksScheduled = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "claudie_input_manifests_tasks_scheduled",
		Help: "Total number of tasks scheduled for builder service to work on",
	})

	TasksFinishedOk = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "claudie_input_manifests_tasks_completed",
		Help: "Total number of tasks completed by the builder service",
	})

	TasksFinishedErr = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "claudie_input_manifests_tasks_errored",
		Help: "Total number of tasks errored while processing by the builder service",
	})
)

Functions

func Diff

func Diff(current, desired *spec.K8Scluster, currentLbs, desiredLbs []*spec.LBcluster) []*spec.TaskEvent

Diff takes the desired and current state to determine the difference and returns a number of tasks to be performed in specific order. It is expected that the current state actually represents the actual current state of the cluster and the desired state contains relevant data from the current state with the requested changes (i.e. deletion, addition of nodes) from the new config changes, (relevant data was transferred to desired state).

func LbsNodePoolNodes

func LbsNodePoolNodes(clusters []*spec.LBcluster) (map[string]map[string][]string, map[string]map[string][]string)

func MustRegisterCounters

func MustRegisterCounters()

func NodePoolNodes

func NodePoolNodes(cluster *spec.K8Scluster) (map[string][]string, map[string][]string)

NodePoolNodes returns the current nodes for the dynamic and static nodepools.

Types

type GRPC

type GRPC struct {
	pb.UnimplementedManagerServiceServer

	HealthCheckServer *health.Server

	Store store.Store
	// contains filtered or unexported fields
}

func NewGRPC

func NewGRPC(ctx context.Context, opts ...grpc.ServerOption) (*GRPC, error)

func (*GRPC) GetConfig

func (g *GRPC) GetConfig(ctx context.Context, request *pb.GetConfigRequest) (*pb.GetConfigResponse, error)

func (*GRPC) ListConfigs

func (g *GRPC) ListConfigs(ctx context.Context, _ *pb.ListConfigRequest) (*pb.ListConfigResponse, error)

func (*GRPC) MarkForDeletion

func (g *GRPC) MarkForDeletion(ctx context.Context, request *pb.MarkForDeletionRequest) (*pb.MarkForDeletionResponse, error)

func (*GRPC) NextTask

func (g *GRPC) NextTask(ctx context.Context, _ *pb.NextTaskRequest) (*pb.NextTaskResponse, error)

func (*GRPC) Serve

func (g *GRPC) Serve() error

Serve will create a service goroutine for each connection

func (*GRPC) Stop

func (g *GRPC) Stop() error

Stop will gracefully shutdown the gRPC server and the healthcheck server

func (*GRPC) TaskComplete

func (g *GRPC) TaskComplete(ctx context.Context, req *pb.TaskCompleteRequest) (*pb.TaskCompleteResponse, error)

func (*GRPC) TaskUpdate

func (g *GRPC) TaskUpdate(ctx context.Context, req *pb.TaskUpdateRequest) (*pb.TaskUpdateResponse, error)

func (*GRPC) UpdateNodePool

func (g *GRPC) UpdateNodePool(ctx context.Context, request *pb.UpdateNodePoolRequest) (*pb.UpdateNodePoolResponse, error)

func (*GRPC) UpsertManifest

func (g *GRPC) UpsertManifest(ctx context.Context, request *pb.UpsertManifestRequest) (*pb.UpsertManifestResponse, error)

func (*GRPC) WatchForDoneOrErrorDocuments

func (g *GRPC) WatchForDoneOrErrorDocuments(ctx context.Context) error

func (*GRPC) WatchForPendingDocuments

func (g *GRPC) WatchForPendingDocuments(ctx context.Context) error

func (*GRPC) WatchForScheduledDocuments

func (g *GRPC) WatchForScheduledDocuments(ctx context.Context) error

type ScheduleResult added in v0.9.1

type ScheduleResult uint8

ScheduleResult describes what has happened during the scheduling of the tasks.

const (
	// NoReschedule describes the case where the manifest should not be rescheduled again
	// after either error-ing or completing.
	NoReschedule ScheduleResult = iota
	// Reschedule describes the case where the manifest should be rescheduled again
	// after either error-ing or completing.
	Reschedule
	// NotReady describes the case where the manifest is not ready to be scheduled yet,
	// this is mostly related to the retry policies which can vary. For example if
	// an exponential retry policy is used the manifest will not be ready to be scheduled
	// until the specified number of Tick pass.
	NotReady
	// FinalRetry describes the case where a manifest had a retry policy to retry
	// rescheduling the manifest N times before giving up. FinalRetry states that
	// the manifest should be retried one last time before giving up.
	FinalRetry
)

Jump to

Keyboard shortcuts

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