fullnode

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConfigMaps

func BuildConfigMaps(crd *cosmosv1.CosmosFullNode, p2p ExternalAddresses) ([]*corev1.ConfigMap, error)

BuildConfigMaps creates a ConfigMap with configuration to be mounted as files into containers. Currently, the config.toml (for Tendermint) and app.toml (for the Cosmos SDK).

func BuildPVCs

BuildPVCs outputs desired PVCs given the crd.

func BuildServices

func BuildServices(crd *cosmosv1.CosmosFullNode) []*corev1.Service

BuildServices returns a list of services given the crd.

Creates a single RPC service, likely for use with an Ingress.

Creates 1 p2p service per pod. P2P diverges from traditional web and kubernetes architecture which calls for a single p2p service backed by multiple pods. Pods may be in various states even with proper readiness probes. Therefore, we do not want to confuse or disrupt peer exchange (PEX) within tendermint. If using a single p2p service, an outside peer discovering a pod out of sync it could be interpreted as byzantine behavior if the peer previously connected to a pod that was in sync through the same external address.

func DownloadGenesisCommand

func DownloadGenesisCommand(cfg cosmosv1.ChainSpec) (string, []string)

DownloadGenesisCommand returns a proper genesis command for use in an init container.

The general strategy is if the user does not configure an external genesis file, use the genesis from the <chain-binary> init command. If the user supplies a custom script, we use that. Otherwise, we use attempt to download and extract the file.

func DownloadSnapshotCommand

func DownloadSnapshotCommand(cfg cosmosv1.ChainSpec) (string, []string)

DownloadSnapshotCommand returns a command and args for downloading and restoring from a snapshot.

func PVCName added in v0.5.0

func PVCName(pod *corev1.Pod) string

PVCName returns the primary PVC holding the chain data associated with the pod.

func PodState

func PodState(crd *cosmosv1.CosmosFullNode) []*corev1.Pod

PodState creates the final state of pods given the crd.

func ResetStatus added in v0.5.0

func ResetStatus(crd *cosmosv1.CosmosFullNode)

ResetStatus is used at the beginning of the reconcile loop. It resets the crd's status to a fresh state.

func SelectorLabels

func SelectorLabels(crd *cosmosv1.CosmosFullNode) client.MatchingLabels

SelectorLabels returns the labels used in selector operations.

Types

type Client

type Client interface {
	client.Reader
	client.Writer

	Scheme() *runtime.Scheme
}

Client is a controller client. It is a subset of client.Client.

type ConfigMapControl

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

ConfigMapControl creates or updates configmaps.

func NewConfigMapControl

func NewConfigMapControl(client Client) ConfigMapControl

NewConfigMapControl returns a valid ConfigMapControl.

func (ConfigMapControl) Reconcile

Reconcile creates or updates configmaps containing items that are mounted into pods as files. The ConfigMap is never deleted unless the CRD itself is deleted.

type ExternalAddresses

type ExternalAddresses map[string]string

ExternalAddresses keys are instance names and values are public IPs or hostnames.

func CollectP2PAddresses

CollectP2PAddresses collects external addresses from p2p services.

func (ExternalAddresses) Incomplete

func (addrs ExternalAddresses) Incomplete() bool

Incomplete returns true if any instances do not have a public IP or hostname.

type Lister

type Lister interface {
	List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
}

Lister can list resources, subset of client.Client.

type PVCControl

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

PVCControl reconciles volumes for a CosmosFullNode. Unlike StatefulSet, PVCControl will update volumes by deleting and recreating volumes.

func NewPVCControl

func NewPVCControl(client Client) PVCControl

NewPVCControl returns a valid PVCControl

func (PVCControl) Reconcile

Reconcile is the control loop for PVCs. The bool return value, if true, indicates the controller should requeue the request.

type PodBuilder

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

PodBuilder builds corev1.Pods

func NewPodBuilder

func NewPodBuilder(crd *cosmosv1.CosmosFullNode) PodBuilder

NewPodBuilder returns a valid PodBuilder.

Panics if any argument is nil.

func (PodBuilder) Build

func (b PodBuilder) Build() *corev1.Pod

Build assigns the CosmosFullNode crd as the owner and returns a fully constructed pod.

func (PodBuilder) WithOrdinal

func (b PodBuilder) WithOrdinal(ordinal int32) PodBuilder

WithOrdinal updates adds name and other metadata to the pod using "ordinal" which is the pod's ordered sequence. Pods have deterministic, consistent names similar to a StatefulSet instead of generated names.

type PodControl

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

PodControl reconciles pods for a CosmosFullNode.

func NewPodControl

func NewPodControl(client Client) PodControl

NewPodControl returns a valid PodControl.

func (PodControl) Reconcile

Reconcile is the control loop for pods. The bool return value, if true, indicates the controller should requeue the request.

type ServiceControl

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

ServiceControl creates or updates Services.

func NewServiceControl

func NewServiceControl(client Client) ServiceControl

func (ServiceControl) Reconcile

Reconcile creates or updates services. Some services, like P2P, reserve public addresses of which should not change. Therefore, services are never deleted unless the CRD itself is deleted.

Jump to

Keyboard shortcuts

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