github.com/kotalco/kotal@v0.3.0/apis/ipfs/v1alpha1/cluster_peer.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 // ClusterPeerSpec defines the desired state of ClusterPeer 9 type ClusterPeerSpec struct { 10 // Image is ipfs cluster peer 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 // ID is the the cluster peer id 18 ID string `json:"id,omitempty"` 19 // PrivateKeySecretName is k8s secret holding private key 20 PrivateKeySecretName string `json:"privateKeySecretName,omitempty"` 21 // TrustedPeers is CRDT trusted cluster peers who can manage the pinset 22 // +listType=set 23 TrustedPeers []string `json:"trustedPeers,omitempty"` 24 // BootstrapPeers are ipfs cluster peers to connect to 25 // +listType=set 26 BootstrapPeers []string `json:"bootstrapPeers,omitempty"` 27 // Consensus is ipfs cluster consensus algorithm 28 Consensus ConsensusAlgorithm `json:"consensus,omitempty"` 29 // ClusterSecretName is k8s secret holding cluster secret 30 ClusterSecretName string `json:"clusterSecretName"` 31 // PeerEndpoint is ipfs peer http API endpoint 32 PeerEndpoint string `json:"peerEndpoint"` 33 // Logging is logging verboisty level 34 // +kubebuilder:validation:Enum=error;warn;info;debug 35 Logging shared.VerbosityLevel `json:"logging,omitempty"` 36 // Resources is node compute and storage resources 37 shared.Resources `json:"resources,omitempty"` 38 } 39 40 // ConsensusAlgorithm is IPFS cluster consensus algorithm 41 // +kubebuilder:validation:Enum=crdt;raft 42 type ConsensusAlgorithm string 43 44 const ( 45 // CRDT consensus algorithm 46 CRDT ConsensusAlgorithm = "crdt" 47 // Raft consensus algorithm 48 Raft ConsensusAlgorithm = "raft" 49 ) 50 51 // ClusterPeerStatus defines the observed state of ClusterPeer 52 type ClusterPeerStatus struct { 53 Client string `json:"client"` 54 Consensus string `json:"consensus"` 55 } 56 57 // +kubebuilder:object:root=true 58 // +kubebuilder:subresource:status 59 60 // ClusterPeer is the Schema for the clusterpeers API 61 // +kubebuilder:printcolumn:name="Client",type=string,JSONPath=".status.client" 62 // +kubebuilder:printcolumn:name="Consensus",type=string,JSONPath=".spec.consensus" 63 type ClusterPeer struct { 64 metav1.TypeMeta `json:",inline"` 65 metav1.ObjectMeta `json:"metadata,omitempty"` 66 67 Spec ClusterPeerSpec `json:"spec,omitempty"` 68 Status ClusterPeerStatus `json:"status,omitempty"` 69 } 70 71 // +kubebuilder:object:root=true 72 73 // ClusterPeerList contains a list of ClusterPeer 74 type ClusterPeerList struct { 75 metav1.TypeMeta `json:",inline"` 76 metav1.ListMeta `json:"metadata,omitempty"` 77 Items []ClusterPeer `json:"items"` 78 } 79 80 func init() { 81 SchemeBuilder.Register(&ClusterPeer{}, &ClusterPeerList{}) 82 }