github.com/kotalco/kotal@v0.3.0/apis/ethereum2/v1alpha1/validator.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  // ValidatorSpec defines the desired state of Validator
     9  type ValidatorSpec struct {
    10  	// Image is Ethereum 2.0 validator 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  
    18  	// Network is the network this validator is validating blocks for
    19  	Network string `json:"network"`
    20  	// Client is the Ethereum 2.0 client to use
    21  	Client Ethereum2Client `json:"client"`
    22  	// FeeRecipient is ethereum address collecting transaction fees
    23  	FeeRecipient shared.EthereumAddress `json:"feeRecipient,omitempty"`
    24  	// BeaconEndpoints is beacon node endpoints
    25  	// +kubebuilder:validation:MinItems=1
    26  	// +listType=set
    27  	BeaconEndpoints []string `json:"beaconEndpoints"`
    28  	// Graffiti is the text to include in proposed blocks
    29  	Graffiti string `json:"graffiti,omitempty"`
    30  	// Logging is logging verboisty level
    31  	// +kubebuilder:validation:Enum=off;fatal;error;warn;info;debug;trace;all;notice;crit;panic;none
    32  	Logging shared.VerbosityLevel `json:"logging,omitempty"`
    33  	// CertSecretName is k8s secret name that holds tls.crt
    34  	CertSecretName string `json:"certSecretName,omitempty"`
    35  	// Keystores is a list of Validator keystores
    36  	// +kubebuilder:validation:MinItems=1
    37  	Keystores []Keystore `json:"keystores"`
    38  	// WalletPasswordSecret is wallet password secret
    39  	WalletPasswordSecret string `json:"walletPasswordSecret,omitempty"`
    40  	// Resources is node compute and storage resources
    41  	shared.Resources `json:"resources,omitempty"`
    42  }
    43  
    44  // Keystore is Ethereum 2.0 validator EIP-2335 BLS12-381 keystore https://eips.ethereum.org/EIPS/eip-2335
    45  type Keystore struct {
    46  	// PublicKey is the validator public key in hexadecimal
    47  	// +kubebuilder:validation:Pattern="^0[xX][0-9a-fA-F]{96}$"
    48  	PublicKey string `json:"publicKey,omitempty"`
    49  	// SecretName is the kubernetes secret holding [keystore] and [password]
    50  	SecretName string `json:"secretName"`
    51  }
    52  
    53  // ValidatorStatus defines the observed state of Validator
    54  type ValidatorStatus struct{}
    55  
    56  // +kubebuilder:object:root=true
    57  
    58  // Validator is the Schema for the validators API
    59  // +kubebuilder:printcolumn:name="Client",type=string,JSONPath=".spec.client"
    60  // +kubebuilder:printcolumn:name="Network",type=string,JSONPath=".spec.network"
    61  type Validator struct {
    62  	metav1.TypeMeta   `json:",inline"`
    63  	metav1.ObjectMeta `json:"metadata,omitempty"`
    64  
    65  	Spec   ValidatorSpec   `json:"spec,omitempty"`
    66  	Status ValidatorStatus `json:"status,omitempty"`
    67  }
    68  
    69  // +kubebuilder:object:root=true
    70  
    71  // ValidatorList contains a list of Validator
    72  type ValidatorList struct {
    73  	metav1.TypeMeta `json:",inline"`
    74  	metav1.ListMeta `json:"metadata,omitempty"`
    75  	Items           []Validator `json:"items"`
    76  }
    77  
    78  func init() {
    79  	SchemeBuilder.Register(&Validator{}, &ValidatorList{})
    80  }