Visualization
Use the visualization coupled with the Code Review section for correlated code deep dive
Code Review
1). Provider Command Registered Via Cobra
The Akash Provider command is registered via Cobra allowing initiation of the provider service via provider-services run
via the Akash CLI.
2). Command Flag Registration
Provider services run
command flags are registered via Cobra.
Example Cobra command flag registration for the declaration of the provider withdraw period is displayed in code capture. A similar declaration is made for all related
run
command flags.
Within the const declaration within this file
FlagWithdrawalPeriod
is defined. Via this const value the command and flag resultant allows the CLI entry ofprovider-services run --withdrawal-period <value>
during provider service initiation
3). Invoke of the doRunCmd Function
When the Provider Services run
command is executed the RunE
block defines downstream code execution on initiation. Primarily note the call of the doRunCmd
function. This function exists in the same source code file.
The
doRunCmd
function when called invokes several items core to Akash Provider operation a. As the primary focus of this section is the Akash Provider service and relational Akash Proviider Operators, we will not deep dive into these critical components but will expand on such functionality in other documentation sections.
A listing of core pieces of operation invoked in thedoRunCmd
include:
- Creation of Akash RPC node client for transaction monitoring and broadcasting via a call of the
client.NewClientWithBroadcaster
function- Creation of Kubernetes client for K8s cluster CRUD operations via a call of the
createClusterClient
function- Creation of Akash Provider Bid Strategy via a call of the
createBidPricingStrategy
function- Creation of REST API gateway - utilized for request/response for simple provider GET endpoints such as
/status
and/version
and POST endpoints such as manifest receipt on lease won event - via call of thegwrest.NewServer
function located inprovider/gateway/rest
directory.
4). Interaction with Kubernetes Customer Controller - IP Operator
Within a dedicated document in this section the Akash IP Operator - a Kubernetes custom controller implementation - code is covered in detail. In this document the interaction with the IP Operator from the Akash Provider service is covered.
Cobra command flag declaration includes the following definition which allows the basic enablement of IP Leases when provider-services run
is executed during Provider creation.
If the enableIPOperator
is true
an ipOperatorClient
session is opened to allow Provider service to IP Operator communication.
5). Interaction with Kubernetes Customer Controller - Hostname Operator
Within a dedicated document in this section the Akash Hostname Operator - a Kubernetes custom controller implementation - code is covered in detail. In this document the interaction with the Hostname Operator from the Akash Provider service is covered.
Cobra command flag declaration includes the following definition which allows the basic enablement of IP Leases when provider-services run
is executed during Provider creation.
A hostnameOperatorClient session is opened to allow Provider service to Hostname Operator communication.