github.com/kotalco/kotal@v0.3.0/apis/aptos/v1alpha1/node.go (about)

     1  package v1alpha1
     2  
     3  import (
     4  	"github.com/kotalco/kotal/apis/shared"
     5  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     6  )
     7  
     8  // AptosNetwork is Aptos network
     9  type AptosNetwork string
    10  
    11  const (
    12  	Devnet  AptosNetwork = "devnet"
    13  	Mainnet AptosNetwork = "mainnet"
    14  	Testnet AptosNetwork = "testnet"
    15  )
    16  
    17  // Peer is Aptos network peer
    18  type Peer struct {
    19  	// ID is peer identifier
    20  	ID string `json:"id"`
    21  	// Addresses is array of peer multiaddress
    22  	// +listType=set
    23  	// +kubebuilder:validation:MinItems=1
    24  	Addresses []string `json:"addresses"`
    25  }
    26  
    27  // NodeSpec defines the desired state of Node
    28  type NodeSpec struct {
    29  	// Image is Aptos node client image
    30  	Image string `json:"image,omitempty"`
    31  	// ExtraArgs is extra arguments to pass down to the cli
    32  	ExtraArgs shared.ExtraArgs `json:"extraArgs,omitempty"`
    33  	// Replicas is number of replicas
    34  	// +kubebuilder:validation:Enum=0;1
    35  	Replicas *uint `json:"replicas,omitempty"`
    36  	// Network is Aptos network to join and sync
    37  	// +kubebuilder:validation:Enum=devnet;testnet;mainnet
    38  	Network AptosNetwork `json:"network"`
    39  	// Validator enables validator mode
    40  	Validator bool `json:"validator,omitempty"`
    41  	// Waypoint provides an off-chain mechanism to verify the sync process after restart or epoch change
    42  	Waypoint string `json:"waypoint,omitempty"`
    43  	// GenesisConfigmapName is Kubernetes configmap name holding genesis blob
    44  	GenesisConfigmapName string `json:"genesisConfigmapName,omitempty"`
    45  	// NodePrivateKeySecretName is the secret name holding node private key
    46  	NodePrivateKeySecretName string `json:"nodePrivateKeySecretName,omitempty"`
    47  	// PeerId is the node identity
    48  	PeerId string `json:"peerId,omitempty"`
    49  	// SeedPeers is seed peers
    50  	SeedPeers []Peer `json:"seedPeers,omitempty"`
    51  	// API enables REST API server
    52  	API bool `json:"api,omitempty"`
    53  	// APIPort is api server port
    54  	APIPort uint `json:"apiPort,omitempty"`
    55  	// P2PPort is p2p communications port
    56  	P2PPort uint `json:"p2pPort,omitempty"`
    57  	// MetricsPort is metrics server port
    58  	MetricsPort uint `json:"metricsPort,omitempty"`
    59  	// Resources is node compute and storage resources
    60  	shared.Resources `json:"resources,omitempty"`
    61  }
    62  
    63  // NodeStatus defines the observed state of Node
    64  type NodeStatus struct {
    65  }
    66  
    67  // +kubebuilder:object:root=true
    68  
    69  // Node is the Schema for the nodes API
    70  type Node struct {
    71  	metav1.TypeMeta   `json:",inline"`
    72  	metav1.ObjectMeta `json:"metadata,omitempty"`
    73  
    74  	Spec   NodeSpec   `json:"spec,omitempty"`
    75  	Status NodeStatus `json:"status,omitempty"`
    76  }
    77  
    78  // +kubebuilder:object:root=true
    79  
    80  // NodeList contains a list of Node
    81  type NodeList struct {
    82  	metav1.TypeMeta `json:",inline"`
    83  	metav1.ListMeta `json:"metadata,omitempty"`
    84  	Items           []Node `json:"items"`
    85  }
    86  
    87  func init() {
    88  	SchemeBuilder.Register(&Node{}, &NodeList{})
    89  }