github.com/kotalco/kotal@v0.3.0/apis/filecoin/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  // NodeSpec defines the desired state of Node
     9  type NodeSpec struct {
    10  	// Image is Filecoin node client image
    11  	Image string `json:"image,omitempty"`
    12  	// ExtraArgs is extra arguments to pass down to the cli
    13  	ExtraArgs shared.ExtraArgs `json:"extraArgs,omitempty"`
    14  	// Replicas is number of replicas
    15  	// +kubebuilder:validation:Enum=0;1
    16  	Replicas *uint `json:"replicas,omitempty"`
    17  	// API enables API server
    18  	API bool `json:"api,omitempty"`
    19  	// APIPort is API server listening port
    20  	APIPort uint `json:"apiPort,omitempty"`
    21  	// APIRequestTimeout is API request timeout in seconds
    22  	APIRequestTimeout uint `json:"apiRequestTimeout,omitempty"`
    23  	// DisableMetadataLog disables metadata log
    24  	DisableMetadataLog bool `json:"disableMetadataLog,omitempty"`
    25  	// P2PPort is p2p port
    26  	P2PPort uint `json:"p2pPort,omitempty"`
    27  	// Network is the Filecoin network the node will join and sync
    28  	Network FilecoinNetwork `json:"network"`
    29  	// IPFSPeerEndpoint is ipfs peer endpoint
    30  	IPFSPeerEndpoint string `json:"ipfsPeerEndpoint,omitempty"`
    31  	// IPFSOnlineMode sets ipfs online mode
    32  	IPFSOnlineMode bool `json:"ipfsOnlineMode,omitempty"`
    33  	// IPFSForRetrieval uses ipfs for retrieval
    34  	IPFSForRetrieval bool `json:"ipfsForRetrieval,omitempty"`
    35  	// Logging is logging verboisty level
    36  	// +kubebuilder:validation:Enum=error;warn;info;debug
    37  	Logging shared.VerbosityLevel `json:"logging,omitempty"`
    38  	// Resources is node compute and storage resources
    39  	shared.Resources `json:"resources,omitempty"`
    40  }
    41  
    42  // FilecoinNetwork is Filecoin network
    43  // +kubebuilder:validation:Enum=mainnet;calibration
    44  type FilecoinNetwork string
    45  
    46  const (
    47  	// MainNetwork is the Filecoin main network
    48  	MainNetwork FilecoinNetwork = "mainnet"
    49  	// CalibrationNetwork is the Filecoin main network
    50  	CalibrationNetwork FilecoinNetwork = "calibration"
    51  )
    52  
    53  // NodeStatus defines the observed state of Node
    54  type NodeStatus struct {
    55  	Client string `json:"client"`
    56  }
    57  
    58  // +kubebuilder:object:root=true
    59  // +kubebuilder:subresource:status
    60  
    61  // Node is the Schema for the nodes API
    62  // +kubebuilder:printcolumn:name="Network",type=string,JSONPath=".spec.network"
    63  // +kubebuilder:printcolumn:name="Client",type=string,JSONPath=".status.client"
    64  type Node struct {
    65  	metav1.TypeMeta   `json:",inline"`
    66  	metav1.ObjectMeta `json:"metadata,omitempty"`
    67  
    68  	Spec   NodeSpec   `json:"spec,omitempty"`
    69  	Status NodeStatus `json:"status,omitempty"`
    70  }
    71  
    72  // +kubebuilder:object:root=true
    73  
    74  // NodeList contains a list of Node
    75  type NodeList struct {
    76  	metav1.TypeMeta `json:",inline"`
    77  	metav1.ListMeta `json:"metadata,omitempty"`
    78  	Items           []Node `json:"items"`
    79  }
    80  
    81  func init() {
    82  	SchemeBuilder.Register(&Node{}, &NodeList{})
    83  }