server

package
v0.0.0-...-1a81cf4 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 23 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFoundError     = errors.New("not found")
	UnauthorizedError = errors.New("unauthorized")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Namespace          string
	Address            string // Address to listen on
	TLSSecretName      string // Name of secret containing TLS certificate
	TLSSecretNamespace string // Namespace of secret containing TLS certificate
	PodName            string // Name of the Pod we're running in
	PodIP              string // IP address of the Pod we're running in
	AdminSecretName    string // Name of basic authentication secret containing the admin username+password of the dashboard
	AllowAnonymous     bool   // If set, anonymous access to dashboard is allowed
}

Config settings for the Server

type Dependencies

type Dependencies struct {
	LivenessProbe         *probe.LivenessProbe
	Deployment            OperatorDependency
	DeploymentReplication OperatorDependency
	Storage               OperatorDependency
	Backup                OperatorDependency
	Apps                  OperatorDependency
	ML                    OperatorDependency
	ClusterSync           OperatorDependency
	Operators             Operators
	Secrets               typedCore.SecretInterface
}

Dependencies of the Server

type Deployment

type Deployment interface {
	Name() string
	Namespace() string
	GetMode() api.DeploymentMode
	Environment() api.Environment
	StateColor() StateColor
	PodCount() int
	ReadyPodCount() int
	VolumeCount() int
	ReadyVolumeCount() int
	StorageClasses() []string
	DatabaseURL() string
	DatabaseVersion() (string, string)
	Members() map[api.ServerGroup][]Member
}

Deployment is the API implemented by an ArangoDeployment.

type DeploymentInfo

type DeploymentInfo struct {
	Name             string             `json:"name"`
	Namespace        string             `json:"namespace"`
	Mode             api.DeploymentMode `json:"mode"`
	Environment      api.Environment    `json:"environment"`
	StateColor       StateColor         `json:"state_color"`
	PodCount         int                `json:"pod_count"`
	ReadyPodCount    int                `json:"ready_pod_count"`
	VolumeCount      int                `json:"volume_count"`
	ReadyVolumeCount int                `json:"ready_volume_count"`
	StorageClasses   []string           `json:"storage_classes"`
	DatabaseURL      string             `json:"database_url"`
	DatabaseVersion  string             `json:"database_version"`
	DatabaseLicense  string             `json:"database_license"`
}

DeploymentInfo is the information returned per deployment.

type DeploymentInfoDetails

type DeploymentInfoDetails struct {
	DeploymentInfo
	MemberGroups []MemberGroupInfo `json:"member_groups"`
}

DeploymentInfoDetails is the detailed information returned per deployment.

type DeploymentOperator

type DeploymentOperator interface {
	// GetDeployments returns basic information for all deployments managed by the operator
	GetDeployments() ([]Deployment, error)
	// GetDeployment returns detailed information for a deployment, managed by the operator, with given name
	GetDeployment(name string) (Deployment, error)
}

DeploymentOperator is the API implemented by the deployment operator.

type DeploymentReplication

type DeploymentReplication interface {
	Name() string
	Namespace() string
	StateColor() StateColor
	Source() Endpoint
	Destination() Endpoint
}

DeploymentReplication is the API implemented by an ArangoDeploymentReplication.

type DeploymentReplicationInfo

type DeploymentReplicationInfo struct {
	Name        string       `json:"name"`
	Namespace   string       `json:"namespace"`
	StateColor  StateColor   `json:"state_color"`
	Source      EndpointInfo `json:"source"`
	Destination EndpointInfo `json:"destination"`
}

DeploymentReplicationInfo is the information returned per deployment replication.

type DeploymentReplicationInfoDetails

type DeploymentReplicationInfoDetails struct {
	DeploymentReplicationInfo
}

DeploymentReplicationInfoDetails is the detailed information returned per deployment replication.

type DeploymentReplicationOperator

type DeploymentReplicationOperator interface {
	// GetDeploymentReplications returns basic information for all deployment replications managed by the operator
	GetDeploymentReplications() ([]DeploymentReplication, error)
	// GetDeploymentReplication returns detailed information for a deployment replication, managed by the operator, with given name
	GetDeploymentReplication(name string) (DeploymentReplication, error)
}

DeploymentReplicationOperator is the API implemented by the deployment operator.

type Endpoint

type Endpoint interface {
	DeploymentName() string
	MasterEndpoint() []string
	AuthKeyfileSecretName() string
	AuthUserSecretName() string
	TLSCACert() string
	TLSCACertSecretName() string
}

Endpoint is the API implemented by source&destination of the replication

type EndpointInfo

type EndpointInfo struct {
	DeploymentName        string   `json:"deployment_name"`
	MasterEndpoint        []string `json:"master_endpoint"`
	AuthKeyfileSecretName string   `json:"auth_keyfile_secret_name"`
	AuthUserSecretName    string   `json:"auth_user_secret_name"`
	TLSCACert             string   `json:"tls_ca_cert"`
	TLSCACertSecretName   string   `json:"tls_ca_cert_secret_name"`
}

EndpointInfo is the information returned per source/destination endpoint of the replication.

type LocalStorage

type LocalStorage interface {
	Name() string
	LocalPaths() []string
	StateColor() StateColor
	StorageClass() string
	StorageClassIsDefault() bool
	Volumes() []Volume
}

LocalStorage is the API implemented by an ArangoLocalStorage.

type LocalStorageInfo

type LocalStorageInfo struct {
	Name                  string     `json:"name"`
	LocalPaths            []string   `json:"local_paths"`
	StateColor            StateColor `json:"state_color"`
	StorageClass          string     `json:"storage_class"`
	StorageClassIsDefault bool       `json:"storage_class_is_default"`
}

LocalStorageInfo is the information returned per local storage.

type LocalStorageInfoDetails

type LocalStorageInfoDetails struct {
	LocalStorageInfo
	Volumes []VolumeInfo `json:"volumes"`
}

LocalStorageInfoDetails contains detailed info a local storage

type Member

type Member interface {
	ID() string
	PodName() string
	PVCName() string
	PVName() string
	MemberOfCluster() MemberOfCluster
	Ready() bool
}

Member is the API implemented by a member of an ArangoDeployment.

type MemberGroupInfo

type MemberGroupInfo struct {
	Group   string       `json:"group"`
	Members []MemberInfo `json:"members"`
}

MemberGroupInfo contained detailed info of a group (e.g. Agent) of members

type MemberInfo

type MemberInfo struct {
	ID              string          `json:"id"`
	PodName         string          `json:"pod_name"`
	PVCName         string          `json:"pvc_name"`
	PVName          string          `json:"pv_name"`
	MemberOfCluster MemberOfCluster `json:"member_of_cluster"`
	Ready           bool            `json:"ready"`
}

MemberInfo contains detailed info of a specific member of the deployment

type MemberOfCluster

type MemberOfCluster string
const (
	IsMemberOfCluster    MemberOfCluster = "true"
	IsNotMemberOfCluster MemberOfCluster = "false"
	NeverMemberOfCluster MemberOfCluster = "never"
)

type OperatorDependency

type OperatorDependency struct {
	Enabled bool
	Probe   *probe.ReadyProbe
}

type OperatorReference

type OperatorReference struct {
	Namespace string       `json:"namespace"`
	Type      OperatorType `json:"type"`
	URL       string       `json:"url"`
}

OperatorReference contains a reference to another operator

type OperatorType

type OperatorType string
const (
	OperatorTypeDeployment            OperatorType = "deployment"
	OperatorTypeDeploymentReplication OperatorType = "deployment_replication"
	OperatorTypeStorage               OperatorType = "storage"
)

type Operators

type Operators interface {
	// Return the deployment operator (if any)
	DeploymentOperator() DeploymentOperator
	// Return the deployment replication operator (if any)
	DeploymentReplicationOperator() DeploymentReplicationOperator
	// Return the local storage operator (if any)
	StorageOperator() StorageOperator
	// FindOtherOperators looks up references to other operators in the same Kubernetes cluster.
	FindOtherOperators() []OperatorReference
}

Operators is the API provided to the server for accessing the various operators.

type Server

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

Server is the HTTPS server for the operator.

func NewServer

func NewServer(cli typedCore.CoreV1Interface, cfg Config, deps Dependencies) (*Server, error)

NewServer creates a new server, fetching/preparing a TLS certificate.

func (*Server) Run

func (s *Server) Run() error

Run the server until the program stops.

type StateColor

type StateColor string

StateColor is a strongly typed indicator of state

const (
	StateGreen  StateColor = "green"  // Everything good
	StateYellow StateColor = "yellow" // Something is going on, but deployment is available
	StateOrange StateColor = "orange" // Something is going on that may make the deployment unavailable. Trying to recover automatically
	StateRed    StateColor = "red"    // This is really bad. Intervention is very likely needed
)

type StorageOperator

type StorageOperator interface {
	// GetLocalStorages returns basic information for all local storages managed by the operator
	GetLocalStorages() ([]LocalStorage, error)
	// GetLocalStorage returns detailed information for a local, managed by the operator, with given name
	GetLocalStorage(name string) (LocalStorage, error)
}

StorageOperator is the API implemented by the storage operator.

type Volume

type Volume interface {
	Name() string
	StateColor() StateColor
	NodeName() string
	Capacity() string
}

Volume is the API implemented by a volume created in a ArangoLocalStorage.

type VolumeInfo

type VolumeInfo struct {
	Name       string     `json:"name"`
	StateColor StateColor `json:"state_color"`
	NodeName   string     `json:"node_name"`
	Capacity   string     `json:"capacity"`
}

VolumeInfo contained the information returned per volume that is created on behalf of a local storage.

Jump to

Keyboard shortcuts

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