monero-operator开源项目

我要开发同款
匿名用户2021年11月26日
47阅读
所属分类Google Go、云计算、云原生
授权协议Apache-2.0 License

作品详情

monero-operator

AKubernetes-nativewayofdeployingMoneronodes,networks,andminers:expressyourintentionandletKubernetesrunitforyou.

you:"Hi,I'dliketwopublicnodes,andthreeminersplease".

k8s:"Surething"

k8s:"Itlookslikeyouwanttwopublicnodes,butIsee0running-letmecreatethemforyou."

k8s:"Itlookslikeyouwantthreeminers,butIsee0running-letmecreatethemforyou."

you:"Actually,Ichangedmymind-Idon'twanttomineonminexmr,Iwantcryptonode.social".

k8s:"Goodchoice,poolconcentrationsucks-letmeupdateyourminersforyou:)"

See./docsfordetaileddocumentationabouteachresource.

ExampleFullnodeMiningclusterPrivatenetworkInstallLicenseExampleFullnode

Torunasinglefullnode,allyouneedtodoiscreateasingle-replicaMoneroNodeSet.

kind:MoneroNodeSetapiVersion:utxo.com.br/v1alpha1metadata:name:full-nodespec:replicas:1

WithaMoneroNodeSetyouexpresstheintentionofhavingasetofmonerodnodesrunningwithaparticularconfiguration:youexpressyourintent,andmonero-operatortakescareofmakingithappen.

Forinstance,withkubectl-treewecanseethattheoperatortookcareofinstantiatingaStatefulSet

$kubectltreemoneronodeset.utxo.com.brfull-nodeNAMESPACENAMEREADYdefaultMoneroNodeSet/full-nodeTruedefault├─Service/full-node-default│└─EndpointSlice/full-node-d2crv-default└─StatefulSet/full-node-default├─ControllerRevision/full-node-856644d54d-default└─Pod/full-node-0True

withapre-configuredsetofflags

$kubectlgetpodfull-node-0-ojsonpath={.spec.containers[*].command}|jq'.'["monerod","--data-dir=/data","--log-file=/dev/stdout","--no-igd","--no-zmq","--non-interactive","--p2p-bind-ip=0.0.0.0","--p2p-bind-port=18080","--rpc-restricted-bind-ip=0.0.0.0","--rpc-restricted-bind-port=18089"]

andaPersistentVolumeClaimattachedwithenoughdiskspaceforit.

$kubectlgetpvckubectlgetpvcNAMESTATUSVOLUMECAPACITYdata-full-node-0Boundpvc-1c60e835-d5f9-41c9-8509-b0e4b3b71f6b200Gi

Withthatallbeingdeclarative,updatingournodeisamatterofexpressingournewintentbyupdatingtheMoneroNodeSetdefinition,andlettingtheoperatortakecareofupdatingthingsbehindthescene.

Forinstance,assumingwewanttonowmakeitpublic,acceptinglotsofpeers,havingahigherbandwidthlimitandusingdnsblocklistandcheckpointing,we'dpatchtheobjectwiththefollowing:

kind:MoneroNodeSetapiVersion:utxo.com.br/v1alpha1metadata:name:full-setspec:replicas:1monerod:args:---public---enable-dns-blocklist---enforce-dns-checkpointing---out-peers=1024---in-peers=1024---limit-rate=128000

Whichwouldthenleadtoanupdatetothenode(Kubernetestakescareofsignallingthemonerod,waitingforittofinishgracefully-didImentionthatithasproperlysetreadinessprobestoo?-,detachingthedisk,etcetc).

Miningcluster

SimilartoMoneroNodeSet,withaMoneroMiningNodeSetyouexpresstheintentionofhavingaclusteroxreplicasrunning,andthentheoperatortakescareofmakingthathappen.

Forinstance,torunasetof5minersspreadacrossdifferentKubernetesnodes:

kind:MoneroMiningNodeSetapiVersion:utxo.com.br/v1alpha1metadata:name:minersspec:replicas:5hardAntiAffinity:truexmrig:args:--o-cryptonote.social:5556--u-891B5keCnwXN14hA9FoAzGFtaWmcuLjTDT5aRTp65juBLkbNpEhLNfgcBn6aWdGuBqBnSThqMPsGRjWVQadCrhoAT6CnSL3.node-$(id)---tls

ps.:$(id)isindeedathing-whereveryouputit,it'sgoingtobeinterpolatedwithanintegerthatidentifiesthereplicapps.:xmrigisusedunderthehood

Privatenetwork

WithaMoneroNetworkyouexpresstheintentionofhavinganetworkofinter-connectedMoneronodes,takingcareofnotonlybringingmonerodupforyou,butalsoprovidingtheproperflagsforeachdaemonsothattheyareexclusivenodesofthemselves.

Forinstance,considerthefollowingprivateregtestsetup:

kind:MoneroNetworkapiVersion:utxo.com.br/v1alpha1metadata:name:regtestspec:replicas:3template:spec:monerod:args:---regtest---fixed-difficulty=1

Underthehood,thefollowingtreeofobjectsgetsformed:

$kubectltreemoneronetwork.utxo.com.brregtestNAMEMoneroNetwork/regtest├─MoneroNodeSet/regtest-0│├─Service/regtest-0││└─EndpointSlice/regtest-0-plf9m│└─StatefulSet/regtest-0│├─ControllerRevision/regtest-0-6dc6799f4b│└─Pod/regtest-0-0├─MoneroNodeSet/regtest-1│├─Service/regtest-1││└─EndpointSlice/regtest-1-7sd9z│└─StatefulSet/regtest-1│├─ControllerRevision/regtest-1-5b5c6b7b8d│└─Pod/regtest-1-0└─MoneroNodeSet/regtest-2├─Service/regtest-2│└─EndpointSlice/regtest-2-rhmd9└─StatefulSet/regtest-2├─ControllerRevision/regtest-2-7fdbcdb57b└─Pod/regtest-2-0

witheachnodewiththeflagsproperlysetsothattheyareinterconnected:

$kubectlgetpods-ojsonpath={.items[*].spec.containers[*].command}|jq'.'["monerod","--add-exclusive-node=regtest-1","--add-exclusive-node=regtest-2","--fixed-difficulty=1",...]["monerod","--add-exclusive-node=regtest-0","--add-exclusive-node=regtest-2","--fixed-difficulty=1",...]["monerod","--add-exclusive-node=regtest-0","--add-exclusive-node=regtest-1","--fixed-difficulty=1",...]Installinstall#submitthecustomresourcedefinitionobjects,deployment,role-baseaccess#controlconfigs,etc.#kubectlapply-f./config/release.yamlLicense

See./LICENSE

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论