ops

package
v0.0.0-...-7448efe Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var State_name = map[State]string{
	0: "UNSPECIFIED",
	1: "INIT",
	2: "ONLINE",
	3: "WARNING",
	4: "ERROR",
}
View Source
var State_value = map[string]State{
	"UNSPECIFIED": 0,
	"INIT":        1,
	"ONLINE":      2,
	"WARNING":     3,
	"ERROR":       4,
}

Functions

This section is empty.

Types

type AuthenticationType

type AuthenticationType int32

AuthenticationType type of authentication to contact cluster orchestrator

const (
	// AUTHENTICATION_TYPE_UNSPECIFIED Unspecified authentication type
	AUTHENTICATION_TYPE_UNSPECIFIED AuthenticationType = 0
	// AUTHENTICATION_CREDENTIAL authenticate using credentials
	AUTHENTICATION_CREDENTIAL AuthenticationType = 1
	// AUTHENTICATION_TYPE_APITOKEN authenticate using API token
	AUTHENTICATION_TYPE_APITOKEN AuthenticationType = 2
)

type ClusterConfig

type ClusterConfig struct {
	Name        string
	ID          string
	ManifestURL string // used by the cluster to register itself with the orchestrator
}

ClusterConfig holds cluster configuration details

type ClusterStatus

type ClusterStatus struct {
	Name        string
	ID          string
	Nodes       []*Node // list of nodes onboarded to the cluster
	State       State   // cluster State
	Metrics     Metrics
	ErrorString string
	NodeErrors  map[string]string
}

ClusterStatus holds cluster status details

type DummyOrchestratorConfig

type DummyOrchestratorConfig struct {
	Server             string             // address of the cluster orchestration server
	Port               string             // to contact on cluster orchestration server
	AuthenticationType AuthenticationType // denotes the authenticate type to contact cluster orchestrator
	UserName           string
	Password           string
	APIToken           string // session token to access objects
}

DummyOrchestratorConfig holds the config to contact dummy server

type Metrics

type Metrics struct {
	CPUPercentage    float32 // percentage of cpu used by the cluster
	PodsPercentage   float32 // percentage of pods deployed on the cluster
	MemoryPercentage float32 // percentage of memory used by the cluster
}

Metrics holds metrics status of a cluster

type Node

type Node struct {
	Name               string
	ID                 string
	ClusterID          string
	NodeIP             string
	ErrorString        string
	TotalCPUs          int64   // total available CPU cores
	TotalMemoryInBytes int64   // total available memory on the cluster node
	TotalPodsCapacity  int64   // total number of deployable pods
	UsedCPUPercentage  float32 // used CPU percentage on the cluster node
	UsedMemoryInBytes  int64
	UsedPods           int64
	State              State    // state of the cluster node
	Role               NodeRole // role of the cluster node
}

Node holds cluster node details

type NodeRole

type NodeRole int32

NodeRole cluster node role

const (
	// NODE_ROLE_UNSPECIFIED Unspecified node role
	NODE_ROLE_UNSPECIFIED NodeRole = 0
	// NODE_ROLE_SERVER to categorize server cluster nodes
	NODE_ROLE_SERVER NodeRole = 1
	// NODE_ROLE_AGENT to categorize agent cluster nodes
	NODE_ROLE_AGENT NodeRole = 2
)

type OrchestratorClient

type OrchestratorClient interface {
	// Login authenticates using UserName and Password
	Login() (string, error)
	// VerifyConnection verifies if authentication API token is valid.
	VerifyTokenValidity() error
	// CreateCluster creates a cluster with the given name and return ClusterConfig object
	CreateCluster(clusterName string) (*ClusterConfig, error)
	// GetClusterStatus reads cluster status by cluster ID and returns ClusterStatus object
	GetClusterStatusByID(clusterID string) (*ClusterStatus, error)
	// ListClusterStatuses returns list of cluster statuses
	ListClusterStatuses() ([]*ClusterStatus, error)
	// DeleteCluster removes a cluster by ID from cluster orchestrator
	DeleteCluster(clusterID string) error
}

OrchestratorClient defines methods to establish and verify connection with the cluster orchestrator

type OrchestratorConfig

type OrchestratorConfig struct {
	Type    OrchestratorType
	Rancher *RancherOrchestratorConfig // holds rancher config
	Dummy   *DummyOrchestratorConfig
}

OrchestratorConfig holds the config to contact cluster orchestrator

type OrchestratorType

type OrchestratorType int32

OrchestratorType type of cluster orchestrator

const (
	// ORCHESTRATOR_TYPE_UNSPECIFIED Unspecified orchestrator type
	ORCHESTRATOR_TYPE_UNSPECIFIED OrchestratorType = 0
	// ORCHESTRATOR_TYPE_RANCHER rancher as cluster orchestrator
	ORCHESTRATOR_TYPE_RANCHER OrchestratorType = 1
	// ORCHESTRATOR_TYPE_DUMMY dummy as cluster orchestrator
	ORCHESTRATOR_TYPE_DUMMY OrchestratorType = 2
)

type RancherOrchestratorConfig

type RancherOrchestratorConfig struct {
	Server             string             // address of the cluster orchestration server
	Port               string             // to contact on cluster orchestration server
	AuthenticationType AuthenticationType // denotes the authenticate type to contact cluster orchestrator
	UserName           string
	Password           string
	APIToken           string // session token to access objects
}

RancherOrchestratorConfig holds the config to contact rancher server

type State

type State int32

State Orchestrator object state

const (
	// STATE_UNSPECIFIED Unspecified state
	STATE_UNSPECIFIED State = 0
	// STATE_INIT init state
	STATE_INIT State = 1
	// STATE_ONLINE online state
	STATE_ONLINE State = 2
	// STATE_WARNING error/offline state
	STATE_WARNING State = 3
	// STATE_ERROR error/offline state
	STATE_ERROR State = 4
)

Jump to

Keyboard shortcuts

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