controllers

package
v0.0.0-...-8540621 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProjectName = "default"

DefaultProjectName is the default project name to use for a vizier cluster that is created if none if provided.

View Source
const SaltLength int = 10

SaltLength is the length of the salt used when encrypting the jwt signing key.

Variables

This section is empty.

Functions

func NewStatusMetricsCollector

func NewStatusMetricsCollector(db *sqlx.DB) prometheus.Collector

NewStatusMetricsCollector creats a new vizier status metrics prometheus collector.

Types

type HandleNATSMessageFunc

type HandleNATSMessageFunc func(*cvmsgspb.V2CMessage)

HandleNATSMessageFunc is the signature for a NATS message handler.

type MetadataReader

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

MetadataReader reads updates from the NATS durable queue and sends updates to the indexer.

func NewMetadataReader

func NewMetadataReader(db *sqlx.DB, st msgbus.Streamer, nc *nats.Conn) (*MetadataReader, error)

NewMetadataReader creates a new MetadataReader.

func (*MetadataReader) Stop

func (m *MetadataReader) Stop()

Stop shuts down the metadata reader and all relevant goroutines.

type PodStatuses

type PodStatuses map[string]*cvmsgspb.PodStatus

PodStatuses Type to use in sqlx for the map of pod statuses.

func (*PodStatuses) Scan

func (p *PodStatuses) Scan(src interface{}) error

Scan Scans the sqlx database type ([]bytes) into the PodStatuses type.

func (PodStatuses) Value

func (p PodStatuses) Value() (driver.Value, error)

Value Returns a golang database/sql driver value for PodStatuses.

type Server

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

Server is a bridge implementation of evzmgr.

func New

func New(db *sqlx.DB, dbKey string, nc *nats.Conn, updater VzUpdater) *Server

New creates a new server.

func (*Server) CreateVizierCluster

func (s *Server) CreateVizierCluster(ctx context.Context, req *vzmgrpb.CreateVizierClusterRequest) (*uuidpb.UUID, error)

CreateVizierCluster creates a new tracked vizier cluster.

func (*Server) GetOrgFromVizier

func (s *Server) GetOrgFromVizier(ctx context.Context, id *uuidpb.UUID) (*vzmgrpb.GetOrgFromVizierResponse, error)

GetOrgFromVizier fetches the org to which a Vizier belongs. This is intended to be for internal use only.

func (*Server) GetVizierConnectionInfo

func (s *Server) GetVizierConnectionInfo(ctx context.Context, req *uuidpb.UUID) (*cvmsgspb.VizierConnectionInfo, error)

GetVizierConnectionInfo gets a viziers connection info,

func (*Server) GetVizierInfo

func (s *Server) GetVizierInfo(ctx context.Context, req *uuidpb.UUID) (*cvmsgspb.VizierInfo, error)

GetVizierInfo returns info for the specified Vizier.

func (*Server) GetVizierInfos

GetVizierInfos gets the vizier info for multiple viziers.

func (*Server) GetViziersByOrg

func (s *Server) GetViziersByOrg(ctx context.Context, orgID *uuidpb.UUID) (*vzmgrpb.GetViziersByOrgResponse, error)

GetViziersByOrg gets a list of viziers by organization.

func (*Server) GetViziersByShard

GetViziersByShard returns the list of connected Viziers for a given shardID.

func (*Server) HandleVizierHeartbeat

func (s *Server) HandleVizierHeartbeat(v2cMsg *cvmsgspb.V2CMessage)

HandleVizierHeartbeat handles the heartbeat from connected viziers.

func (*Server) ProvisionOrClaimVizier

func (s *Server) ProvisionOrClaimVizier(ctx context.Context, orgID uuid.UUID, userID uuid.UUID, clusterUID string, clusterName string) (uuid.UUID, string, error)

ProvisionOrClaimVizier provisions a given cluster or returns the ID if it already exists,

func (*Server) Stop

func (s *Server) Stop()

Stop performs any necessary cleanup before shutdown.

func (*Server) UpdateOrInstallVizier

UpdateOrInstallVizier updates or installs the given vizier cluster to the specified version.

func (*Server) UpdateVizierConfig

UpdateVizierConfig supports updating of the Vizier config.

func (*Server) VizierConnected

VizierConnected is an the request made to the mgr to handle new Vizier connections.

type StatusMonitor

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

StatusMonitor is responsible for maintaining status information of vizier clusters. It has a routine that is periodically invoked.

func NewStatusMonitor

func NewStatusMonitor(db *sqlx.DB) *StatusMonitor

NewStatusMonitor creates a new StatusMonitor operating on the passed in DB and starts it.

func (*StatusMonitor) Stop

func (s *StatusMonitor) Stop()

Stop kills the status monitor.

func (*StatusMonitor) UpdateDBEntries

func (s *StatusMonitor) UpdateDBEntries()

UpdateDBEntries updates the database status.

type Updater

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

Updater is responsible for tracking and updating Viziers.

func NewUpdater

func NewUpdater(db *sqlx.DB, atClient artifacttrackerpb.ArtifactTrackerClient, nc *nats.Conn) (*Updater, error)

NewUpdater creates a new Vizier updater.

func (*Updater) AddToUpdateQueue

func (u *Updater) AddToUpdateQueue(vizierID uuid.UUID) bool

AddToUpdateQueue queues the given Vizier for an update to the latest version.

func (*Updater) ProcessUpdateQueue

func (u *Updater) ProcessUpdateQueue()

ProcessUpdateQueue updates the Viziers in the update queue.

func (*Updater) Stop

func (u *Updater) Stop()

Stop stops the updater.

func (*Updater) UpdateOrInstallVizier

func (u *Updater) UpdateOrInstallVizier(vizierID uuid.UUID, version string, redeployEtcd bool) (*cvmsgspb.V2CMessage, error)

UpdateOrInstallVizier immediately updates or installs the Vizier instance. This should be used in cases where the user is bootstrapping Vizier for the first time, or has manually sent an update request.

func (*Updater) VersionUpToDate

func (u *Updater) VersionUpToDate(version string) bool

VersionUpToDate checks if the given version string is up to date with the current vizier version.

type VizierInfo

type VizierInfo struct {
	ID                            uuid.UUID     `db:"vizier_cluster_id"`
	Status                        vizierStatus  `db:"status"`
	LastHeartbeat                 *int64        `db:"last_heartbeat"`
	ClusterUID                    *string       `db:"cluster_uid"`
	ClusterName                   *string       `db:"cluster_name"`
	ClusterVersion                *string       `db:"cluster_version"`
	OperatorVersion               *string       `db:"operator_version"`
	VizierVersion                 *string       `db:"vizier_version"`
	StatusMessage                 *string       `db:"status_message"`
	ControlPlanePodStatuses       PodStatuses   `db:"control_plane_pod_statuses"`
	UnhealthyDataPlanePodStatuses PodStatuses   `db:"unhealthy_data_plane_pod_statuses"`
	NumNodes                      int32         `db:"num_nodes"`
	NumInstrumentedNodes          int32         `db:"num_instrumented_nodes"`
	OrgID                         uuid.UUID     `db:"org_id"`
	PrevStatus                    *vizierStatus `db:"prev_status"`
	PrevStatusTime                *time.Time    `db:"prev_status_time"`
}

VizierInfo represents all info we want to fetch about a Vizier.

type VizierState

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

VizierState contains all state necessary to process metadata updates for the given vizier.

type VzUpdater

type VzUpdater interface {
	UpdateOrInstallVizier(vizierID uuid.UUID, version string, redeployEtcd bool) (*cvmsgspb.V2CMessage, error)
	VersionUpToDate(version string) bool
	// AddToUpdateQueue must be idempotent since we Queue based on heartbeats and reported version.
	AddToUpdateQueue(vizierID uuid.UUID) bool
}

VzUpdater is the interface for the module responsible for updating Vizier.

Directories

Path Synopsis
Package mock_controllers is a generated GoMock package.
Package mock_controllers is a generated GoMock package.

Jump to

Keyboard shortcuts

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