Documentation
¶
Index ¶
- func BuildConfigMaps(crd *cosmosv1.CosmosFullNode, p2p ExternalAddresses) ([]*corev1.ConfigMap, error)
- func BuildPVCs(crd *cosmosv1.CosmosFullNode) []*corev1.PersistentVolumeClaim
- func BuildPods(crd *cosmosv1.CosmosFullNode) []*corev1.Pod
- func BuildServices(crd *cosmosv1.CosmosFullNode) []*corev1.Service
- func DownloadGenesisCommand(cfg cosmosv1.ChainSpec) (string, []string)
- func DownloadSnapshotCommand(cfg cosmosv1.ChainSpec) (string, []string)
- func PVCName(pod *corev1.Pod) string
- func ResetStatus(crd *cosmosv1.CosmosFullNode)
- func SelectorLabels(crd *cosmosv1.CosmosFullNode) client.MatchingLabels
- type Client
- type ConfigMapControl
- type ExternalAddresses
- type Lister
- type PVCControl
- type PodBuilder
- type PodControl
- type ServiceControl
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 ¶
func BuildPVCs(crd *cosmosv1.CosmosFullNode) []*corev1.PersistentVolumeClaim
BuildPVCs outputs desired PVCs given the crd.
func BuildPods ¶ added in v0.6.0
func BuildPods(crd *cosmosv1.CosmosFullNode) []*corev1.Pod
BuildPods creates the final state of pods 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 ¶
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 ¶
DownloadSnapshotCommand returns a command and args for downloading and restoring from a snapshot.
func PVCName ¶ added in v0.5.0
PVCName returns the primary PVC holding the chain data associated with the pod.
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 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 ¶
func (cmc ConfigMapControl) Reconcile(ctx context.Context, log logr.Logger, crd *cosmosv1.CosmosFullNode, p2p ExternalAddresses) kube.ReconcileError
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 ¶
ExternalAddresses keys are instance names and values are public IPs or hostnames.
func CollectP2PAddresses ¶
func CollectP2PAddresses(ctx context.Context, crd *cosmosv1.CosmosFullNode, c Lister) (ExternalAddresses, kube.ReconcileError)
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 ¶
func (vc PVCControl) Reconcile(ctx context.Context, log logr.Logger, crd *cosmosv1.CosmosFullNode) (bool, kube.ReconcileError)
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 ¶
func (pc PodControl) Reconcile(ctx context.Context, log logr.Logger, crd *cosmosv1.CosmosFullNode) (bool, kube.ReconcileError)
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 ¶
func (sc ServiceControl) Reconcile(ctx context.Context, log logr.Logger, crd *cosmosv1.CosmosFullNode) kube.ReconcileError
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.