Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions api/v1alpha1/archive_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package v1alpha1

// ArchiveSpec configures an archive node (no pruning, full history).
// Archive nodes always block sync from genesis to retain all historical data.
// If SnapshotGeneration is set, the node also acts as a snapshotter.
type ArchiveSpec struct {
// Peers configures how the archive node discovers peers for block sync.
// +optional
Peers []PeerSource `json:"peers,omitempty"`

// SnapshotGeneration configures periodic snapshot creation and optional upload.
// +optional
SnapshotGeneration *SnapshotGenerationConfig `json:"snapshotGeneration,omitempty"`
}
176 changes: 176 additions & 0 deletions api/v1alpha1/common_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
)

// PeerSource is a union type — exactly one field must be set.
// +kubebuilder:validation:XValidation:rule="(has(self.ec2Tags) ? 1 : 0) + (has(self.static) ? 1 : 0) == 1",message="exactly one of ec2Tags or static must be set"
type PeerSource struct {
// EC2Tags discovers peers by querying EC2 for running instances
// matching the specified tags.
// +optional
EC2Tags *EC2TagsPeerSource `json:"ec2Tags,omitempty"`

// Static provides a fixed list of peer addresses.
// +optional
Static *StaticPeerSource `json:"static,omitempty"`
}

// EC2TagsPeerSource discovers peers via EC2 tag filters in a specific region.
type EC2TagsPeerSource struct {
// Region is the AWS region to query for EC2 instances.
// +kubebuilder:validation:MinLength=1
Region string `json:"region"`

// Tags are the EC2 instance tags to filter on.
// +kubebuilder:validation:MinProperties=1
Tags map[string]string `json:"tags"`
}

// StaticPeerSource provides a fixed list of peer addresses.
type StaticPeerSource struct {
// Addresses is a list of peer addresses in "nodeId@host:port" format.
// +kubebuilder:validation:MinItems=1
Addresses []string `json:"addresses"`
}

// SnapshotSource identifies where to obtain a chain snapshot and how to
// configure the node after restore. Exactly one source variant must be set.
// +kubebuilder:validation:XValidation:rule="(has(self.s3) ? 1 : 0) + (has(self.stateSync) ? 1 : 0) == 1",message="exactly one of s3 or stateSync must be set"
type SnapshotSource struct {
// S3 downloads a snapshot archive from an S3 bucket.
// +optional
S3 *S3SnapshotSource `json:"s3,omitempty"`

// StateSync fetches snapshot chunks from peers via Tendermint state sync.
// +optional
StateSync *StateSyncSource `json:"stateSync,omitempty"`

// TrustPeriod is the window during which the snapshot's block validators
// are considered trustworthy. Must be long enough to cover the age of
// the snapshot (e.g. "9999h0m0s" for old S3 snapshots).
// +optional
TrustPeriod string `json:"trustPeriod,omitempty"`

// BackfillBlocks is the number of historical blocks to fetch from peers
// after snapshot restore.
// +optional
BackfillBlocks int64 `json:"backfillBlocks,omitempty"`
}

// S3SnapshotSource configures snapshot download from an S3 bucket.
type S3SnapshotSource struct {
// URI of the snapshot archive in s3://bucket/prefix format.
// +kubebuilder:validation:MinLength=1
URI string `json:"uri"`

// Region is the AWS region for S3 access.
// +optional
// +kubebuilder:default="us-east-1"
Region string `json:"region,omitempty"`
}

// StateSyncSource enables Tendermint state sync, which fetches snapshot
// chunks from peers on the p2p network. The controller manages trust
// height and RPC server configuration automatically.
type StateSyncSource struct{}

// SnapshotGenerationConfig configures a node to produce Tendermint state-sync
// snapshots and optionally upload them to remote storage. The controller sets
// archival pruning and a system-default snapshot-interval in app.toml.
type SnapshotGenerationConfig struct {
// KeepRecent is the number of recent snapshots to retain on disk.
// Must be at least 2 so the upload algorithm can select the
// second-to-latest completed snapshot.
// +kubebuilder:validation:Minimum=2
KeepRecent int32 `json:"keepRecent"`

// Destination configures where generated snapshots are uploaded.
// When set, the controller submits a scheduled upload task to the sidecar.
// +optional
Destination *SnapshotDestination `json:"destination,omitempty"`
}

// SnapshotDestination configures where generated snapshots are uploaded.
// Exactly one destination type must be set.
type SnapshotDestination struct {
// S3 uploads snapshots to an S3 bucket.
S3 *S3SnapshotDestination `json:"s3"`
}

// S3SnapshotDestination configures S3 as the upload target for snapshots.
type S3SnapshotDestination struct {
// Bucket is the S3 bucket name.
// +kubebuilder:validation:MinLength=1
Bucket string `json:"bucket"`

// Prefix is an optional key prefix within the bucket (e.g. "state-sync/").
// +optional
Prefix string `json:"prefix,omitempty"`

// Region is the AWS region of the bucket.
// +kubebuilder:validation:MinLength=1
Region string `json:"region"`
}

// GenesisConfiguration defines the chain identity and where genesis data is sourced.
// At most one of PVC or S3 may be set. When neither is set the node uses the
// default genesis produced by seid init.
// +kubebuilder:validation:XValidation:rule="(has(self.pvc) ? 1 : 0) + (has(self.s3) ? 1 : 0) <= 1",message="at most one of pvc or s3 may be set"
type GenesisConfiguration struct {
// ChainID is the canonical chain identifier for this node.
// +kubebuilder:validation:MinLength=1
ChainID string `json:"chainId"`

// PVC references a pre-provisioned PVC populated by SeiNodePool's genesis ceremony.
// +optional
PVC *GenesisPVCSource `json:"pvc,omitempty"`

// S3 configures the sidecar to download genesis.json from an S3 bucket.
// +optional
S3 *GenesisS3Source `json:"s3,omitempty"`
}

// GenesisPVCSource references a data PVC that SeiNodePool's prep Job already populated.
type GenesisPVCSource struct {
// DataPVC is the name of the pre-populated PVC in the same namespace.
// +kubebuilder:validation:MinLength=1
DataPVC string `json:"dataPVC"`
}

// GenesisS3Source configures download of genesis.json from an S3 bucket.
type GenesisS3Source struct {
// URI is the S3 URI of the genesis.json file (s3://bucket/key format).
// +kubebuilder:validation:MinLength=1
URI string `json:"uri"`

// Region is the AWS region for S3 access.
// +optional
Region string `json:"region,omitempty"`
}

// SeiNodeStorageConfig controls PVC lifecycle for SeiNode.
type SeiNodeStorageConfig struct {
// RetainOnDelete prevents the data PVC from being deleted when the
// SeiNode is deleted.
// +optional
// +kubebuilder:default=false
RetainOnDelete bool `json:"retainOnDelete,omitempty"`
}

// SidecarConfig configures the sei-sidecar container.
type SidecarConfig struct {
// Image overrides the sidecar container image.
// +optional
Image string `json:"image,omitempty"`

// Port is the HTTP port the sidecar listens on.
// +optional
// +kubebuilder:default=7777
Port int32 `json:"port,omitempty"`

// Resources defines CPU/memory requests and limits for the sidecar container.
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
}
19 changes: 19 additions & 0 deletions api/v1alpha1/full_node_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package v1alpha1

// FullNodeSpec configures a chain-following full node (RPC, sentry, etc.).
// The node bootstraps from a snapshot (S3 or state sync) or syncs from genesis.
type FullNodeSpec struct {
// Peers configures how this node discovers and connects to peers.
// +optional
Peers []PeerSource `json:"peers,omitempty"`

// Snapshot configures how the node obtains its initial chain state.
// When absent the node block-syncs from genesis.
// +optional
Snapshot *SnapshotSource `json:"snapshot,omitempty"`

// SnapshotGeneration configures periodic snapshot creation and optional upload.
// When set, the controller disables pruning and enables snapshot intervals.
// +optional
SnapshotGeneration *SnapshotGenerationConfig `json:"snapshotGeneration,omitempty"`
}
14 changes: 14 additions & 0 deletions api/v1alpha1/replayer_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package v1alpha1

// ReplayerSpec configures an ephemeral replay workload that restores from a
// snapshot and replays blocks forward. Always requires both a snapshot source
// and peer sources for block sync after restore.
type ReplayerSpec struct {
// Snapshot identifies the snapshot to restore from before replay begins.
Snapshot SnapshotSource `json:"snapshot"`

// Peers configures how the replayer discovers peers for block sync
// after restoring from the snapshot.
// +kubebuilder:validation:MinItems=1
Peers []PeerSource `json:"peers"`
}
Loading
Loading