├── .chglog
├── CHANGELOG.tpl.md
└── config.yaml
├── .codecov.yml
├── .env
├── .envrc
├── .github
├── CODEOWNERS
└── workflows
│ ├── concommits.yaml
│ ├── cron-integration-tests.yaml
│ ├── integration-tests.yaml
│ ├── release.yaml
│ ├── tests.yaml
│ └── wip.yaml
├── .gitignore
├── .golangci.yaml
├── .goreleaser-docker.yaml
├── .goreleaser.yaml
├── .mockery.yaml
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── _docs
├── deployment.yaml
├── development-environment.md
├── escrow.md
├── img
│ └── logo-label-black.svg
├── kustomize
│ ├── README.md
│ ├── akash-node
│ │ ├── deployment.yaml
│ │ ├── ingress.yaml
│ │ ├── kustomization.yaml
│ │ ├── run.sh
│ │ └── service.yaml
│ ├── akash-operator-hostname
│ │ ├── cluster-roles.yaml
│ │ ├── deployment.yaml
│ │ ├── ingress.yaml
│ │ ├── kustomization.yaml
│ │ ├── role-bindings.yaml
│ │ ├── service-accounts.yaml
│ │ └── service.yaml
│ ├── akash-operator-inventory
│ │ ├── cluster-roles.yaml
│ │ ├── config.yaml
│ │ ├── deployment.yaml
│ │ ├── kustomization.yaml
│ │ ├── role-bindings.yaml
│ │ ├── service-accounts.yaml
│ │ └── service.yaml
│ ├── akash-operator-ip
│ │ ├── cluster-roles.yaml
│ │ ├── deployment.yaml
│ │ ├── ingress.yaml
│ │ ├── kustomization.yaml
│ │ ├── role-bindings.yaml
│ │ ├── service-accounts.yaml
│ │ └── service.yaml
│ ├── akash-provider
│ │ ├── deployment.yaml
│ │ ├── ingress.yaml
│ │ ├── kustomization.yaml
│ │ ├── rbac.yaml
│ │ ├── run.sh
│ │ ├── service.yaml
│ │ └── service_account.yaml
│ ├── akash-services
│ │ ├── kustomization.yaml
│ │ └── network-policies.yaml
│ ├── kind
│ │ └── kind-metrics-server.yaml
│ ├── networking
│ │ ├── namespace.yaml
│ │ └── network-policy-default-ns-deny.yaml
│ ├── redis
│ │ ├── kustomization.yaml
│ │ ├── service.yaml
│ │ └── statefulset.yaml
│ ├── storage
│ │ └── storageclass.yaml
│ └── templates
│ │ ├── akash-node
│ │ ├── docker-image.yaml
│ │ ├── gateway-host.yaml
│ │ └── kustomization.yaml
│ │ ├── akash-operator-hostname
│ │ ├── docker-image.yaml
│ │ └── kustomization.yaml
│ │ ├── akash-operator-inventory
│ │ ├── docker-image.yaml
│ │ └── kustomization.yaml
│ │ ├── akash-operator-ip
│ │ ├── docker-image.yaml
│ │ └── kustomization.yaml
│ │ ├── akash-provider
│ │ ├── docker-image.yaml
│ │ ├── gateway-host.yaml
│ │ └── kustomization.yaml
│ │ └── redis
│ │ └── kustomization.yaml
├── marketplace.md
├── mtls.md
├── operators
│ └── inventory.md
├── persistenstorage-provider.md
├── provider-k8s-hard-multi-tenancy.md
├── provider.yaml
├── provider
│ └── kube
│ │ ├── metallb-service.yaml
│ │ └── ns-network-policies.yaml
├── pubsub.md
├── rook
│ ├── prod
│ │ ├── akash-deployments-pool.yaml
│ │ ├── akash-deployments-storageclass.yaml
│ │ ├── akash-nodes-pool.yaml
│ │ ├── akash-nodes-storageclass.yaml
│ │ ├── cluster.yaml
│ │ ├── common.yaml
│ │ ├── crds.yaml
│ │ ├── operator.yaml
│ │ └── toolbox.yaml
│ └── test
│ │ ├── aio.yaml
│ │ ├── akash-deployments-pool.yaml
│ │ ├── akash-deployments-storageclass.yaml
│ │ ├── akash-nodes-pool.yaml
│ │ ├── akash-nodes-storageclass.yaml
│ │ ├── cluster.yaml
│ │ ├── common.yaml
│ │ ├── crds.yaml
│ │ ├── operator.yaml
│ │ └── toolbox.yaml
└── testing.md
├── _run
├── .env
├── .envrc
├── .envrc_run
├── common-base.mk
├── common-commands.mk
├── common-helm.mk
├── common-kind-vars.mk
├── common-kind.mk
├── common-kube.mk
├── common-kustomize.mk
├── common-minikube.mk
├── common.mk
├── ingress-nginx.yaml
├── kind-config-calico.yaml
├── kube-config-metal-lb-ip.yaml
├── kube
│ ├── .envrc
│ ├── .gitignore
│ ├── Dockerfile
│ ├── Makefile
│ ├── README.md
│ ├── deployment.yaml
│ ├── grafana.yaml
│ ├── key.key
│ ├── key2.key
│ ├── kind-config-80.yaml
│ ├── kind-config.yaml
│ ├── provider.yaml
│ └── test.yaml
├── metallb.yaml
├── minikube
│ ├── .envrc
│ ├── Makefile
│ ├── README.md
│ ├── deployment.yaml
│ └── provider.yaml
├── promtail-values.yaml
├── single
│ ├── .envrc
│ ├── Makefile
│ ├── README.md
│ ├── deployment.yaml
│ ├── deployment2.yaml
│ ├── kind-config.yaml
│ └── provider.yaml
└── ssh
│ ├── .envrc
│ ├── .gitignore
│ ├── Dockerfile
│ ├── Makefile
│ ├── README.md
│ ├── deployment.yaml
│ ├── gpu.yaml
│ ├── kind-config-80.yaml
│ ├── kind-config.yaml
│ ├── provider.yaml
│ └── test.yaml
├── balance_checker.go
├── bidengine
├── config.go
├── order.go
├── order_test.go
├── pricing.go
├── pricing_test.go
├── provider_attributes.go
├── provider_attributes_test.go
├── service.go
├── shellscript.go
└── types.go
├── client
└── client.go
├── cluster
├── client.go
├── config.go
├── hostname.go
├── hostname_test.go
├── inventory.go
├── inventory_test.go
├── kube
│ ├── apply.go
│ ├── builder
│ │ ├── builder.go
│ │ ├── builder_test.go
│ │ ├── deployment.go
│ │ ├── deployment_test.go
│ │ ├── lease_params.go
│ │ ├── manifest.go
│ │ ├── namespace.go
│ │ ├── netpol.go
│ │ ├── podsecuritypolicy.go
│ │ ├── service.go
│ │ ├── service_credentials.go
│ │ ├── settings.go
│ │ ├── statefulset.go
│ │ └── workload.go
│ ├── cleanup.go
│ ├── client.go
│ ├── client_common.go
│ ├── client_exec.go
│ ├── client_exec_test.go
│ ├── client_hostname_connections.go
│ ├── client_ingress.go
│ ├── client_test.go
│ ├── clientcommon
│ │ ├── open_kube_config.go
│ │ └── recover_lease_id_from_labels.go
│ ├── cluster_ip_connections.go
│ ├── deploy_test.go
│ ├── errors
│ │ └── errors.go
│ ├── k8s_integration_test.go
│ ├── operators
│ │ ├── clients
│ │ │ ├── hostname
│ │ │ │ ├── client.go
│ │ │ │ └── client_test.go
│ │ │ ├── inventory
│ │ │ │ ├── client.go
│ │ │ │ ├── client_test.go
│ │ │ │ └── inventory.go
│ │ │ ├── ip
│ │ │ │ ├── client.go
│ │ │ │ └── client_test.go
│ │ │ └── metallb
│ │ │ │ ├── client.go
│ │ │ │ └── mocks
│ │ │ │ └── metallb_client.go
│ │ └── deploy
│ │ │ └── deploy.go
│ ├── resourcetypes.go
│ ├── resourcetypes_test.go
│ ├── types
│ │ ├── v1beta0
│ │ │ └── types.go
│ │ ├── v1beta1
│ │ │ └── types.go
│ │ └── v1beta2
│ │ │ └── types.go
│ └── util
│ │ └── check_inside_kubernetes.go
├── manager.go
├── manager_cleanup.go
├── mocks
│ ├── client.go
│ ├── cluster.go
│ ├── read_client.go
│ └── service.go
├── monitor.go
├── monitor_test.go
├── reservation.go
├── service.go
├── types
│ ├── v1beta2
│ │ ├── directives.go
│ │ ├── hostname.go
│ │ ├── interfaces.go
│ │ ├── ip.go
│ │ ├── reservation.go
│ │ └── types.go
│ └── v1beta3
│ │ ├── clients
│ │ ├── hostname
│ │ │ └── hostname.go
│ │ ├── inventory
│ │ │ ├── inventory.go
│ │ │ └── metrics.go
│ │ └── ip
│ │ │ ├── ip.go
│ │ │ └── mocks
│ │ │ └── client.go
│ │ ├── deployment.go
│ │ ├── fromctx
│ │ └── context.go
│ │ ├── interfaces.go
│ │ ├── mocks
│ │ ├── hostname_service_client.go
│ │ ├── i_deployment.go
│ │ ├── reservation.go
│ │ └── reservation_group.go
│ │ ├── reservation.go
│ │ └── types.go
└── util
│ ├── endpoint_quantity.go
│ ├── ip_sharing_key.go
│ ├── ip_sharing_key_test.go
│ ├── lease_id_to_namespace.go
│ ├── service_client.go
│ ├── service_discovery_agent.go
│ ├── service_discovery_agent_static.go
│ └── service_discovery_agent_types.go
├── cmd
└── provider-services
│ ├── cmd
│ ├── certs.go
│ ├── clusterns.go
│ ├── flags
│ │ ├── flags.go
│ │ ├── kube_config.go
│ │ └── service_endpoint_flag.go
│ ├── helpers.go
│ ├── helpers_test.go
│ ├── leaseEvents.go
│ ├── leaseLogs.go
│ ├── leaseStatus.go
│ ├── manifest.go
│ ├── metrics.go
│ ├── migrate.go
│ ├── migrate_endpoints.go
│ ├── migrate_hostnames.go
│ ├── root.go
│ ├── run.go
│ ├── run_resource_server.go
│ ├── sdl-to-manifest.go
│ ├── serviceStatus.go
│ ├── shell.go
│ ├── status.go
│ ├── test_helpers.go
│ └── util
│ │ └── util.go
│ └── main.go
├── config.go
├── event
└── events.go
├── gateway
├── grpc
│ └── server.go
├── rest
│ ├── auth.go
│ ├── client.go
│ ├── client_shell.go
│ ├── client_shell_test.go
│ ├── constants.go
│ ├── integration_test.go
│ ├── middleware.go
│ ├── path.go
│ ├── router.go
│ ├── router_migrate.go
│ ├── router_migrate_endpoint.go
│ ├── router_migrate_test.go
│ ├── router_shell.go
│ ├── router_test.go
│ └── server.go
└── utils
│ └── utils.go
├── go.mod
├── go.sum
├── install.sh
├── integration
├── app_test.go
├── container2container_test.go
├── customcurrency_test.go
├── deployment_update_test.go
├── e2e_test.go
├── escrow_monitor_test.go
├── ipaddress_test.go
├── migrate_hostname_test.go
├── node_port_test.go
├── persistentstorage_test.go
├── storageclassram_test.go
└── test_helpers.go
├── make
├── changelog.mk
├── codegen.mk
├── init.mk
├── lint.mk
├── mod.mk
├── releasing.mk
├── setup-cache.mk
└── test-integration.mk
├── manifest
├── config.go
├── manager.go
├── manager_test.go
├── mocks
│ ├── client.go
│ └── status_client.go
├── parse.go
├── service.go
├── types.go
├── watchdog.go
└── watchdog_test.go
├── mocks
├── client.go
└── status_client.go
├── operator
├── cmd.go
├── common
│ ├── error_logic.go
│ ├── ignore_list.go
│ ├── ignore_list_config.go
│ ├── ignore_list_test.go
│ ├── logger.go
│ ├── operator_config.go
│ ├── operator_flags.go
│ ├── operator_server.go
│ ├── operator_server_test.go
│ ├── prepared_data.go
│ └── prepared_data_test.go
├── hostname
│ ├── cmd.go
│ ├── operator.go
│ ├── operator_test.go
│ └── types.go
├── inventory
│ ├── ceph.go
│ ├── cmd.go
│ ├── config.go
│ ├── config_test.go
│ ├── node-discovery.go
│ ├── nodes.go
│ ├── rancher.go
│ ├── registry.go
│ ├── state.go
│ ├── types.go
│ └── util.go
├── ip
│ ├── cmd.go
│ ├── operator.go
│ ├── operator_test.go
│ ├── types.go
│ └── types
│ │ └── error_response.go
├── psutil.go
└── waiter
│ ├── waiter.go
│ └── waiter_test.go
├── pkg
├── apis
│ ├── akash.network
│ │ ├── crd.yaml
│ │ ├── crd_v1_v2beta1.yaml
│ │ ├── v2beta1
│ │ │ ├── doc.go
│ │ │ ├── register.go
│ │ │ ├── types.go
│ │ │ ├── types_inventory.go
│ │ │ ├── zz_generated.deepcopy.go
│ │ │ └── zz_generated.defaults.go
│ │ └── v2beta2
│ │ │ ├── doc.go
│ │ │ ├── k8s_integration_test.go
│ │ │ ├── manifest.go
│ │ │ ├── migrate
│ │ │ ├── manifest.go
│ │ │ ├── provider_host.go
│ │ │ └── provider_leased_ips.go
│ │ │ ├── node_info.go
│ │ │ ├── provider_host.go
│ │ │ ├── provider_lease_ip.go
│ │ │ ├── register.go
│ │ │ ├── types.go
│ │ │ ├── types_inventory.go
│ │ │ ├── types_test.go
│ │ │ ├── zz_generated.deepcopy.go
│ │ │ └── zz_generated.defaults.go
│ └── boilerplate.go.txt
└── client
│ ├── applyconfiguration
│ ├── akash.network
│ │ ├── v2beta1
│ │ │ ├── inventory.go
│ │ │ ├── inventoryclusterstorage.go
│ │ │ ├── inventoryrequest.go
│ │ │ ├── inventoryrequestspec.go
│ │ │ ├── inventoryrequeststatus.go
│ │ │ ├── inventoryspec.go
│ │ │ ├── inventorystatus.go
│ │ │ ├── leaseid.go
│ │ │ ├── manifest.go
│ │ │ ├── manifestgroup.go
│ │ │ ├── manifestservice.go
│ │ │ ├── manifestserviceexpose.go
│ │ │ ├── manifestserviceexposehttpoptions.go
│ │ │ ├── manifestserviceparams.go
│ │ │ ├── manifestservicestorage.go
│ │ │ ├── manifestspec.go
│ │ │ ├── manifeststatus.go
│ │ │ ├── manifeststorageparams.go
│ │ │ ├── providerhost.go
│ │ │ ├── providerhostspec.go
│ │ │ ├── providerhoststatus.go
│ │ │ ├── providerleasedip.go
│ │ │ ├── providerleasedipspec.go
│ │ │ ├── providerleasedipstatus.go
│ │ │ ├── resourcepair.go
│ │ │ └── resourceunits.go
│ │ └── v2beta2
│ │ │ ├── inventory.go
│ │ │ ├── inventoryclusterstorage.go
│ │ │ ├── inventoryrequest.go
│ │ │ ├── inventoryrequestspec.go
│ │ │ ├── inventoryrequeststatus.go
│ │ │ ├── inventoryspec.go
│ │ │ ├── inventorystatus.go
│ │ │ ├── leaseid.go
│ │ │ ├── manifest.go
│ │ │ ├── manifestgroup.go
│ │ │ ├── manifestservice.go
│ │ │ ├── manifestservicecredentials.go
│ │ │ ├── manifestserviceexpose.go
│ │ │ ├── manifestserviceexposehttpoptions.go
│ │ │ ├── manifestserviceparams.go
│ │ │ ├── manifestspec.go
│ │ │ ├── manifeststorageparams.go
│ │ │ ├── providerhost.go
│ │ │ ├── providerhostspec.go
│ │ │ ├── providerleasedip.go
│ │ │ ├── providerleasedipspec.go
│ │ │ ├── resourcecpu.go
│ │ │ ├── resourcegpu.go
│ │ │ ├── resourcememory.go
│ │ │ ├── resourcepair.go
│ │ │ ├── resources.go
│ │ │ ├── resourcevolume.go
│ │ │ ├── schedulerparams.go
│ │ │ ├── schedulerresourcegpu.go
│ │ │ └── schedulerresources.go
│ ├── internal
│ │ └── internal.go
│ └── utils.go
│ ├── clientset
│ └── versioned
│ │ ├── clientset.go
│ │ ├── fake
│ │ ├── clientset_generated.go
│ │ ├── doc.go
│ │ └── register.go
│ │ ├── scheme
│ │ ├── doc.go
│ │ └── register.go
│ │ └── typed
│ │ └── akash.network
│ │ ├── v2beta1
│ │ ├── akash.network_client.go
│ │ ├── doc.go
│ │ ├── fake
│ │ │ ├── doc.go
│ │ │ ├── fake_akash.network_client.go
│ │ │ ├── fake_inventory.go
│ │ │ ├── fake_inventoryrequest.go
│ │ │ ├── fake_manifest.go
│ │ │ ├── fake_providerhost.go
│ │ │ └── fake_providerleasedip.go
│ │ ├── generated_expansion.go
│ │ ├── inventory.go
│ │ ├── inventoryrequest.go
│ │ ├── manifest.go
│ │ ├── providerhost.go
│ │ └── providerleasedip.go
│ │ └── v2beta2
│ │ ├── akash.network_client.go
│ │ ├── doc.go
│ │ ├── fake
│ │ ├── doc.go
│ │ ├── fake_akash.network_client.go
│ │ ├── fake_inventory.go
│ │ ├── fake_inventoryrequest.go
│ │ ├── fake_manifest.go
│ │ ├── fake_providerhost.go
│ │ └── fake_providerleasedip.go
│ │ ├── generated_expansion.go
│ │ ├── inventory.go
│ │ ├── inventoryrequest.go
│ │ ├── manifest.go
│ │ ├── providerhost.go
│ │ └── providerleasedip.go
│ ├── informers
│ └── externalversions
│ │ ├── akash.network
│ │ ├── interface.go
│ │ ├── v2beta1
│ │ │ ├── interface.go
│ │ │ ├── inventory.go
│ │ │ ├── inventoryrequest.go
│ │ │ ├── manifest.go
│ │ │ ├── providerhost.go
│ │ │ └── providerleasedip.go
│ │ └── v2beta2
│ │ │ ├── interface.go
│ │ │ ├── inventory.go
│ │ │ ├── inventoryrequest.go
│ │ │ ├── manifest.go
│ │ │ ├── providerhost.go
│ │ │ └── providerleasedip.go
│ │ ├── factory.go
│ │ ├── generic.go
│ │ └── internalinterfaces
│ │ └── factory_interfaces.go
│ └── listers
│ └── akash.network
│ ├── v2beta1
│ ├── expansion_generated.go
│ ├── inventory.go
│ ├── inventoryrequest.go
│ ├── manifest.go
│ ├── providerhost.go
│ └── providerleasedip.go
│ └── v2beta2
│ ├── expansion_generated.go
│ ├── inventory.go
│ ├── inventoryrequest.go
│ ├── manifest.go
│ ├── providerhost.go
│ └── providerleasedip.go
├── script
├── codecov.sh
├── genchangelog.sh
├── install_dev_dependencies.sh
├── is_local_gomod.sh
├── is_prerelease.sh
├── kubectl_retry.sh
├── provider_migrate_to_hostname_operator.md
├── provider_migrate_to_hostname_operator.py
├── rook.sh
├── semver.sh
├── semver_funcs.sh
├── setup-kind.sh
├── setup-kube.sh
├── setup-minikube.sh
├── shellcheck.sh
├── tools.sh
└── usd_pricing_oracle.sh
├── service.go
├── session
├── session.go
└── session_test.go
├── testdata
├── deployment
│ ├── deployment-v2-c2c.yaml
│ ├── deployment-v2-custom-currency.yaml
│ ├── deployment-v2-escrow.yaml
│ ├── deployment-v2-ip-endpoint.yaml
│ ├── deployment-v2-migrate.yaml
│ ├── deployment-v2-multi-groups-ip-endpoint.yaml
│ ├── deployment-v2-multi-ip-endpoint.yaml
│ ├── deployment-v2-newcontainer.yaml
│ ├── deployment-v2-nodeport.yaml
│ ├── deployment-v2-nohost.yaml
│ ├── deployment-v2-shared-ip-endpoint.yaml
│ ├── deployment-v2-storage-beta2.yaml
│ ├── deployment-v2-storage-default.yaml
│ ├── deployment-v2-storage-ram.yaml
│ ├── deployment-v2-storage-updateA.yaml
│ ├── deployment-v2-storage-updateB.yaml
│ ├── deployment-v2-updateA.yaml
│ ├── deployment-v2-updateB.yaml
│ ├── deployment-v2.yaml
│ └── deployment.yaml
└── sdl
│ ├── deployment-svc-mismatch.yaml
│ ├── private_service.yaml
│ ├── profile-svc-name-mismatch.yaml
│ ├── simple-double-ram.yaml
│ ├── simple.yaml
│ ├── simple2.yaml
│ ├── storageClass1.yaml
│ ├── storageClass2.yaml
│ ├── storageClass3.yaml
│ ├── storageClass4.yaml
│ └── storageClass5.yaml
├── testutil
├── manifest
│ ├── v2beta1
│ │ ├── manifest.go
│ │ ├── manifest_app.go
│ │ ├── manifest_overflow.go
│ │ └── manifest_rand.go
│ └── v2beta2
│ │ ├── manifest.go
│ │ ├── manifest_app.go
│ │ ├── manifest_overflow.go
│ │ └── manifest_rand.go
├── network.go
├── provider
│ └── provider.go
└── rest
│ └── restserver.go
├── tools.go
├── tools
├── fromctx
│ └── context.go
└── pconfig
│ ├── bbolt
│ └── bbolt.go
│ ├── bbolt_test.go
│ ├── memory
│ └── memory.go
│ └── pconfig.go
├── types
└── types.go
└── version
└── version.go
/.chglog/CHANGELOG.tpl.md:
--------------------------------------------------------------------------------
1 | {{ range .Versions }}
2 |
3 | ## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }}
4 |
5 | > {{ datetime "2006-01-02" .Tag.Date }}
6 |
7 | {{ range .CommitGroups -}}
8 | ### {{ .Title }}
9 |
10 | {{ range .Commits -}}
11 | * {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
12 | {{ end }}
13 | {{ end -}}
14 |
15 | {{- if .RevertCommits -}}
16 | ### Reverts
17 |
18 | {{ range .RevertCommits -}}
19 | * {{ .Revert.Header }}
20 | {{ end }}
21 | {{ end -}}
22 |
23 | {{- if .MergeCommits -}}
24 | ### Pull Requests
25 |
26 | {{ range .MergeCommits -}}
27 | * {{ .Header }}
28 | {{ end }}
29 | {{ end -}}
30 |
31 | {{- if .NoteGroups -}}
32 | {{ range .NoteGroups -}}
33 | ### {{ .Title }}
34 |
35 | {{ range .Notes }}
36 | {{ .Body }}
37 | {{ end }}
38 | {{ end -}}
39 | {{ end -}}
40 | {{ end -}}
--------------------------------------------------------------------------------
/.chglog/config.yaml:
--------------------------------------------------------------------------------
1 | style: github
2 | template: CHANGELOG.tpl.md
3 | info:
4 | title: CHANGELOG
5 | repository_url: https://github.com/akash-network/provider
6 | options:
7 | commits:
8 | # filters:
9 | # Type:
10 | # - feat
11 | # - fix
12 | # - perf
13 | # - refactor
14 | commit_groups:
15 | title_maps:
16 | feat: Features
17 | fix: Bug Fixes
18 | perf: Performance Improvements
19 | refactor: Code Refactoring
20 | header:
21 | pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
22 | pattern_maps:
23 | - Type
24 | - Scope
25 | - Subject
26 | notes:
27 | keywords:
28 | - BREAKING CHANGE
29 |
--------------------------------------------------------------------------------
/.codecov.yml:
--------------------------------------------------------------------------------
1 | comment: false
2 | codecov:
3 | require_ci_to_pass: true
4 | branch: main
5 |
6 | coverage:
7 | precision: 2
8 | round: down
9 | range: 50...100
10 |
11 | status:
12 | # Learn more at https://docs.codecov.io/docs/commit-status
13 | project:
14 | default:
15 | threshold: 1% # allow this much decrease on project
16 | changes: false
17 |
18 | ignore:
19 | - "**/*mock/.*"
20 | - "pkg/client"
21 | - "**/zz_generated.deepcopy.go"
22 | - "_docs"
23 | - "_run"
24 | - "script"
25 | - "make"
26 |
--------------------------------------------------------------------------------
/.env:
--------------------------------------------------------------------------------
1 | KINDEST_VERSION=v1.32.0
2 | GO111MODULE=on
3 | REDIS_VERSION=7
4 | ROOT_DIR=${AP_ROOT}
5 | AP_DEVCACHE_BASE=${AP_ROOT}/.cache
6 | AP_DEVCACHE=${AP_DEVCACHE_BASE}
7 | AP_DEVCACHE_BIN=${AP_DEVCACHE}/bin
8 | AP_DEVCACHE_INCLUDE=${AP_DEVCACHE}/include
9 | AP_DEVCACHE_VERSIONS=${AP_DEVCACHE}/versions
10 | AP_DEVCACHE_NODE_MODULES=${AP_DEVCACHE}
11 | AP_DEVCACHE_NODE_BIN=${AP_DEVCACHE_NODE_MODULES}/node_modules/.bin
12 | AP_DEVCACHE_TESTS=${AP_DEVCACHE}/tests
13 | DEVCACHE_RUN=${AP_DEVCACHE}/run
14 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @boz @troian
2 |
--------------------------------------------------------------------------------
/.github/workflows/concommits.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | name: conventional commits
3 | on:
4 | pull_request:
5 | push:
6 | branches:
7 | - main
8 | jobs:
9 | build:
10 | name: conventional commits
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v4
14 | - uses: webiny/action-conventional-commits@v1.3.0
15 |
--------------------------------------------------------------------------------
/.github/workflows/cron-integration-tests.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Integration tests on schedule
3 |
4 | on:
5 | schedule:
6 | - cron: '0 */12 * * *'
7 |
8 | jobs:
9 | call-integration-tests:
10 | uses: ./.github/workflows/integration-tests.yaml
11 |
--------------------------------------------------------------------------------
/.github/workflows/wip.yaml:
--------------------------------------------------------------------------------
1 | name: github
2 |
3 | on:
4 | pull_request:
5 | types:
6 | - opened
7 | - edited
8 | - labeled
9 | - unlabeled
10 | - synchronize
11 |
12 | jobs:
13 | wip:
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v4
17 | - uses: akash-network/wip-check@v1
18 | with:
19 | labels: '["do-not-merge", "wip", "rfc"]'
20 | keywords: '["WIP", "wip", "RFC", "rfc"]'
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### Go template
2 | # Binaries for programs and plugins
3 | *.exe
4 | *.exe~
5 | *.dll
6 | *.so
7 | *.dylib
8 |
9 | # Test binary, built with `go test -c`
10 | *.test
11 |
12 | # Output of the go coverage tool, specifically when used with LiteIDE
13 | *.out
14 |
15 | # Dependency directories (remove the comment below to include it)
16 | vendor/
17 | .cache/
18 |
19 | # goreleaser build dir
20 | dist
21 |
22 | .idea/
23 | *.iml
24 | .vscode
25 | *.code-workspace
26 |
27 | coverage.txt
28 |
29 | go.work
30 | go.work.sum
31 |
32 | dev.env
33 |
--------------------------------------------------------------------------------
/.golangci.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | issues:
3 | exclude:
4 | - comment on exported (method|function|type|const|var)
5 | exclude-use-default: true
6 | # Skip generated k8s code
7 | skip-dirs:
8 | - pkg/client
9 | - ".*/mocks"
10 | - ".*/kubernetes_mock"
11 |
12 | # Skip vendor/ etc
13 | skip-dirs-use-default: true
14 | linters:
15 | disable-all: true
16 | enable:
17 | - unused
18 | - misspell
19 | - err113
20 | - gofmt
21 | - gocritic
22 | - goconst
23 | - govet
24 | - ineffassign
25 | - unparam
26 | - staticcheck
27 | - revive
28 | - gosec
29 | - copyloopvar
30 | - prealloc
31 | linters-settings:
32 | gocritic:
33 | disabled-checks:
34 | - ifElseChain
35 | - singleCaseSwitch
36 |
--------------------------------------------------------------------------------
/.mockery.yaml:
--------------------------------------------------------------------------------
1 | quiet: False
2 | inpackage: False
3 | with-expecter: True
4 | keeptree: True
5 | case: underscore
6 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## [v0.6.9](https://github.com/akash-network/provider/compare/v0.6.8...v0.6.9)
4 |
5 | > 2025-03-03
6 |
7 | ### Bug Fixes
8 |
9 | * bump akash-api ([#272](https://github.com/akash-network/provider/issues/272))
10 | * **build:** move kind variables into dedicated make file ([#271](https://github.com/akash-network/provider/issues/271))
11 |
12 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu:noble
2 | LABEL "org.opencontainers.image.source"="https://github.com/akash-network/provider"
3 |
4 | COPY provider-services /usr/bin/
5 |
6 | ENV DEBIAN_FRONTEND=noninteractive
7 |
8 | RUN \
9 | apt-get update \
10 | && apt-get install -y --no-install-recommends \
11 | tini \
12 | jq \
13 | bc \
14 | netcat-traditional \
15 | mawk \
16 | curl \
17 | ca-certificates \
18 | pci.ids \
19 | && rm -rf /var/lib/apt/lists/*
20 |
21 | ENV DEBIAN_FRONTEND=""
22 |
23 | # default port for provider API
24 | EXPOSE 8443
25 |
26 | # default for inventory operator API
27 | EXPOSE 8080
28 |
29 | ENTRYPOINT ["/usr/bin/tini", "--"]
30 | CMD ["provider-services", "--help"]
31 |
--------------------------------------------------------------------------------
/_docs/escrow.md:
--------------------------------------------------------------------------------
1 | # Escrow Accounts and Payments
2 |
3 | Please see [here](../../docs/design/escrow.md) for most up-to-date documentation.
--------------------------------------------------------------------------------
/_docs/kustomize/README.md:
--------------------------------------------------------------------------------
1 | Kustomize Kubernetes
2 | --------------------
3 |
4 | Directory contains templates and files to configure a Kubernetes cluster to support Akash Provider services.
5 |
6 | ## `networking/`
7 |
8 | Normal Kubernetes declaration files to be `kubectl apply -f networking/`
9 |
10 | * `akash-services` namespace declaration
11 | * Default-deny Network policies for the `default` namespace to cripple the potential of malicious containers being run there.
12 |
13 | ## `akash-services/`
14 |
15 | [Kustomize](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/) directory for configuring Network Policies to support `akash-services` namespace of Akash apps.
16 |
17 | `kubectl kustomize akash-services/ | kubectl apply -f -`
18 |
19 | ## `akashd/`
20 |
21 | Kustomize directory to configure running the `akash` blockchain node service.
22 |
23 | `kubectl kustomize akashd/ | kubectl apply -f -`
24 |
25 | ## `akash-provider/`
26 |
27 | Kustomize directory to configure running the `akash-provider` instance which manages tenant workloads within the cluster.
28 |
29 | `kubectl kustomize akash-provider/ | kubectl apply -f -`
30 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-node/ingress.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: networking.k8s.io/v1
3 | kind: Ingress
4 | metadata:
5 | name: akash-node
6 | spec:
7 | ingressClassName: "akash-ingress-class"
8 | rules:
9 | - host: akash.localhost
10 | http:
11 | paths:
12 | - path: /
13 | pathType: Prefix
14 | backend:
15 | service:
16 | name: akash-node
17 | port:
18 | name: akash-rpc
19 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-node/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -e
4 |
5 | env | sort
6 |
7 | mkdir -p "$AKASH_HOME/data"
8 | mkdir -p "$AKASH_HOME/config"
9 |
10 | # XXX it's not reading all of the env variables.
11 |
12 | cp "$AKASH_BOOT_KEYS/priv_validator_state.json" "$AKASH_HOME/data/"
13 | cp "$AKASH_BOOT_DATA/genesis.json" "$AKASH_HOME/config/"
14 | cp "$AKASH_BOOT_KEYS/node_key.json" "$AKASH_HOME/config/"
15 | cp "$AKASH_BOOT_KEYS/priv_validator_key.json" "$AKASH_HOME/config/"
16 |
17 | /bin/akash --home="$AKASH_HOME" --rpc.laddr="$AKASH_RPC_LADDR" start
18 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-node/service.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | name: akash-node
6 | spec:
7 | selector:
8 | app: akash-node
9 | ports:
10 | - name: akash-rpc
11 | port: 26657
12 | - name: akash-p2p
13 | port: 26656
14 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-hostname/cluster-roles.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | kind: ClusterRole
4 | metadata:
5 | name: akash-operator-hostname
6 | labels:
7 | app.kubernetes.io/name: hostname
8 | app.kubernetes.io/instance: hostname-service
9 | app.kubernetes.io/component: operator
10 | app.kubernetes.io/part-of: provider
11 | rules:
12 | - apiGroups:
13 | - networking.k8s.io
14 | resources:
15 | - ingresses
16 | verbs:
17 | - get
18 | - list
19 | - create
20 | - update
21 | - delete
22 | - deletecollection
23 | - watch
24 | - apiGroups:
25 | - ""
26 | resources:
27 | - namespaces
28 | - services
29 | verbs:
30 | - get
31 | - apiGroups:
32 | - akash.network
33 | resources:
34 | - providerhosts
35 | - manifests
36 | verbs:
37 | - get
38 | - list
39 | - watch
40 | - apiGroups:
41 | - ""
42 | resources:
43 | - pods
44 | verbs:
45 | - get
46 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-hostname/ingress.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: networking.k8s.io/v1
3 | kind: Ingress
4 | metadata:
5 | name: akash-hostname-operator
6 | annotations:
7 | nginx.ingress.kubernetes.io/proxy-send-timeout: "60"
8 | nginx.ingress.kubernetes.io/proxy-read-timeout: "60"
9 |
10 | spec:
11 | ingressClassName: "akash-ingress-class"
12 | rules:
13 | - host: akash-hostname-operator.localhost
14 | http:
15 | paths:
16 | - path: /
17 | pathType: Prefix
18 | backend:
19 | service:
20 | name: akash-hostname-operator
21 | port:
22 | name: status
23 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-hostname/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - deployment.yaml
7 | - service.yaml
8 | - ingress.yaml
9 | - role-bindings.yaml
10 | - service-accounts.yaml
11 | - cluster-roles.yaml
12 | configMapGenerator:
13 | - name: operator-hostname
14 | literals:
15 | - k8s-manifest-ns=lease
16 | - prune-interval=600s
17 | - ignore-list-entry-limit=131072
18 | - web-refresh-interval=5s
19 | - retry-delay=3s
20 | - ignore-list-age-limit=2613600s
21 | - event-failure-limit=3
22 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-hostname/role-bindings.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | kind: ClusterRoleBinding
4 | metadata:
5 | name: akash-operator-hostname
6 | labels:
7 | app.kubernetes.io/name: hostname
8 | app.kubernetes.io/instance: hostname-service
9 | app.kubernetes.io/component: operator
10 | app.kubernetes.io/part-of: provider
11 | subjects:
12 | - kind: ServiceAccount
13 | name: operator-hostname
14 | namespace: akash-services
15 | roleRef:
16 | kind: ClusterRole
17 | name: akash-operator-hostname
18 | apiGroup: rbac.authorization.k8s.io
19 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-hostname/service-accounts.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: ServiceAccount
4 | metadata:
5 | name: operator-hostname
6 | labels:
7 | app.kubernetes.io/name: hostname
8 | app.kubernetes.io/instance: hostname-service
9 | app.kubernetes.io/component: operator
10 | app.kubernetes.io/part-of: provider
11 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-hostname/service.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | name: operator-hostname
6 | labels:
7 | app.kubernetes.io/name: hostname
8 | app.kubernetes.io/instance: hostname-service
9 | app.kubernetes.io/component: operator
10 | app.kubernetes.io/part-of: provider
11 | spec:
12 | selector:
13 | app.kubernetes.io/name: hostname
14 | app.kubernetes.io/instance: hostname-service
15 | app.kubernetes.io/component: operator
16 | app.kubernetes.io/part-of: provider
17 | ports:
18 | - name: rest
19 | port: 8080
20 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-inventory/config.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: v1
3 | cluster_storage:
4 | - default
5 | - beta2
6 | exclude:
7 | nodes: []
8 | node_storage: []
9 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-inventory/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - service-accounts.yaml
7 | - cluster-roles.yaml
8 | - role-bindings.yaml
9 | - service.yaml
10 | - deployment.yaml
11 | configMapGenerator:
12 | - name: operator-inventory
13 | files:
14 | - config.yaml
15 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-inventory/role-bindings.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | kind: ClusterRoleBinding
4 | metadata:
5 | name: operator-inventory
6 | labels:
7 | akash.network: "true"
8 | app.kubernetes.io/name: inventory
9 | app.kubernetes.io/instance: inventory-service
10 | app.kubernetes.io/component: operator
11 | app.kubernetes.io/part-of: provider
12 | roleRef:
13 | apiGroup: rbac.authorization.k8s.io
14 | kind: ClusterRole
15 | name: akash-operator-inventory
16 | subjects:
17 | - kind: ServiceAccount
18 | name: operator-inventory
19 | namespace: akash-services
20 | ---
21 | apiVersion: rbac.authorization.k8s.io/v1
22 | kind: ClusterRoleBinding
23 | metadata:
24 | name: operator-inventory-hardware-discovery
25 | labels:
26 | akash.network: "true"
27 | app.kubernetes.io/name: inventory
28 | app.kubernetes.io/instance: inventory-hardware-discovery
29 | app.kubernetes.io/component: operator
30 | app.kubernetes.io/part-of: provider
31 | roleRef:
32 | apiGroup: rbac.authorization.k8s.io
33 | kind: ClusterRole
34 | name: akash-operator-inventory-hardware-discovery
35 | subjects:
36 | - kind: ServiceAccount
37 | name: operator-inventory-hardware-discovery
38 | namespace: akash-services
39 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-inventory/service-accounts.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: ServiceAccount
4 | metadata:
5 | name: operator-inventory
6 | namespace: akash-services
7 | labels:
8 | akash.network: "true"
9 | app.kubernetes.io/name: inventory
10 | app.kubernetes.io/instance: inventory-service
11 | app.kubernetes.io/component: operator
12 | app.kubernetes.io/part-of: provider
13 | automountServiceAccountToken: true
14 | ---
15 | apiVersion: v1
16 | kind: ServiceAccount
17 | metadata:
18 | name: operator-inventory-hardware-discovery
19 | namespace: akash-services
20 | labels:
21 | akash.network: "true"
22 | app.kubernetes.io/name: inventory
23 | app.kubernetes.io/instance: inventory-hardware-discovery
24 | app.kubernetes.io/component: operator
25 | app.kubernetes.io/part-of: provider
26 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-inventory/service.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | labels:
6 | akash.network: "true"
7 | app.kubernetes.io/name: inventory
8 | app.kubernetes.io/instance: inventory-service
9 | app.kubernetes.io/component: operator
10 | app.kubernetes.io/part-of: provider
11 | name: operator-inventory
12 | namespace: akash-services
13 | spec:
14 | type: ClusterIP
15 | ports:
16 | - name: rest
17 | port: 8080
18 | targetPort: rest
19 | appProtocol: http
20 | - name: grpc
21 | port: 8081
22 | targetPort: grpc
23 | appProtocol: tcp
24 | selector:
25 | app.kubernetes.io/name: inventory
26 | app.kubernetes.io/instance: inventory-service
27 | app.kubernetes.io/component: operator
28 | app.kubernetes.io/part-of: provider
29 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-ip/cluster-roles.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | kind: ClusterRole
4 | metadata:
5 | name: akash-operator-ip
6 | labels:
7 | app.kubernetes.io/name: ip
8 | app.kubernetes.io/instance: ip-service
9 | app.kubernetes.io/component: operator
10 | app.kubernetes.io/part-of: provider
11 | rules:
12 | - apiGroups:
13 | - ""
14 | resources:
15 | - services
16 | verbs:
17 | - get
18 | - list
19 | - create
20 | - update
21 | - delete
22 | - deletecollection
23 | - watch
24 | - apiGroups:
25 | - ""
26 | resources:
27 | - services/proxy
28 | verbs:
29 | - get
30 | - apiGroups:
31 | - ""
32 | resources:
33 | - configmaps
34 | verbs:
35 | - get
36 | - list
37 | - watch
38 | - apiGroups:
39 | - akash.network
40 | resources:
41 | - providerleasedips
42 | verbs:
43 | - get
44 | - list
45 | - watch
46 | - apiGroups:
47 | - ""
48 | resources:
49 | - namespaces
50 | verbs:
51 | - get
52 | - apiGroups:
53 | - ""
54 | resources:
55 | - pods
56 | verbs:
57 | - get
58 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-ip/ingress.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: networking.k8s.io/v1
3 | kind: Ingress
4 | metadata:
5 | name: operator-ip
6 | namespace: akash-services
7 | annotations:
8 | nginx.ingress.kubernetes.io/proxy-send-timeout: "60"
9 | nginx.ingress.kubernetes.io/proxy-read-timeout: "60"
10 | labels:
11 | app.kubernetes.io/name: ip
12 | app.kubernetes.io/instance: ip-service
13 | app.kubernetes.io/component: operator
14 | app.kubernetes.io/part-of: provider
15 | spec:
16 | ingressClassName: "akash-ingress-class"
17 | rules:
18 | - host: akash-operator-ip.localhost
19 | http:
20 | paths:
21 | - path: /
22 | pathType: Prefix
23 | backend:
24 | service:
25 | name: operator-ip
26 | port:
27 | name: rest
28 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-ip/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - deployment.yaml
7 | - service.yaml
8 | - ingress.yaml
9 | - role-bindings.yaml
10 | - service-accounts.yaml
11 | - cluster-roles.yaml
12 | configMapGenerator:
13 | - name: operator-ip
14 | literals:
15 | - k8s-manifest-ns=lease
16 | - prune-interval=600s
17 | - ignore-list-entry-limit=131072
18 | - web-refresh-interval=5s
19 | - retry-delay=3s
20 | - ignore-list-age-limit=2613600s
21 | - event-failure-limit=3
22 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-ip/role-bindings.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | kind: ClusterRoleBinding
4 | metadata:
5 | name: akash-operator-ip
6 | labels:
7 | app.kubernetes.io/name: ip
8 | app.kubernetes.io/instance: ip-service
9 | app.kubernetes.io/component: operator
10 | app.kubernetes.io/part-of: provider
11 | subjects:
12 | - kind: ServiceAccount
13 | name: operator-ip
14 | namespace: akash-services
15 | roleRef:
16 | kind: ClusterRole
17 | name: akash-operator-ip
18 | apiGroup: rbac.authorization.k8s.io
19 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-ip/service-accounts.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: ServiceAccount
4 | metadata:
5 | name: operator-ip
6 | namespace: akash-services
7 | labels:
8 | app.kubernetes.io/name: ip
9 | app.kubernetes.io/instance: ip-service
10 | app.kubernetes.io/component: operator
11 | app.kubernetes.io/part-of: provider
12 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-operator-ip/service.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | name: operator-ip
6 | namespace: akash-services
7 | labels:
8 | app.kubernetes.io/name: ip
9 | app.kubernetes.io/instance: ip-service
10 | app.kubernetes.io/component: operator
11 | app.kubernetes.io/part-of: provider
12 | spec:
13 | selector:
14 | app.kubernetes.io/name: ip
15 | app.kubernetes.io/instance: ip-service
16 | app.kubernetes.io/component: operator
17 | app.kubernetes.io/part-of: provider
18 | ports:
19 | - name: rest
20 | port: 8080
21 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-provider/ingress.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: networking.k8s.io/v1
3 | kind: Ingress
4 | metadata:
5 | name: akash-provider
6 | annotations:
7 | nginx.ingress.kubernetes.io/ssl-passthrough: "true"
8 | nginx.ingress.kubernetes.io/backend-protocol: "https"
9 | nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
10 | nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
11 | spec:
12 | ingressClassName: "akash-ingress-class"
13 | rules:
14 | - host: akash-provider.localhost
15 |
16 | http:
17 | paths:
18 | - path: /
19 | pathType: Prefix
20 | backend:
21 | service:
22 | name: akash-provider
23 | port:
24 | name: gateway
25 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-provider/rbac.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: rbac.authorization.k8s.io/v1
3 | kind: ClusterRoleBinding
4 | metadata:
5 | name: akash-provider-admin
6 | subjects:
7 | - kind: ServiceAccount
8 | name: akash-provider
9 | roleRef:
10 | kind: ClusterRole
11 | name: cluster-admin
12 | apiGroup: rbac.authorization.k8s.io
13 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-provider/run.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -xe
4 |
5 | ##
6 | # Configuration sanity check
7 | ##
8 |
9 | # shellcheck disable=SC2015
10 | [ -f "$AKASH_BOOT_KEYS/key.txt" ] && [ -f "$AKASH_BOOT_KEYS/key-pass.txt" ] || {
11 | echo "Key information not found; AKASH_BOOT_KEYS is not configured properly"
12 | exit 1
13 | }
14 |
15 | env | sort
16 |
17 | ##
18 | # Import key. AKASH_FROM contains key name
19 | ##
20 | /bin/akash keys import "$AKASH_FROM" "$AKASH_BOOT_KEYS/key.txt" < "$AKASH_BOOT_KEYS/key-pass.txt"
21 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-provider/service.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Service
4 | metadata:
5 | name: provider-service
6 | namespace: akash-services
7 | labels:
8 | app.kubernetes.io/name: provider
9 | app.kubernetes.io/instance: provider-service
10 | app.kubernetes.io/component: operator
11 | app.kubernetes.io/part-of: provider
12 | spec:
13 | selector:
14 | app.kubernetes.io/name: provider
15 | app.kubernetes.io/instance: provider-service
16 | app.kubernetes.io/component: operator
17 | app.kubernetes.io/part-of: provider
18 | ports:
19 | - name: gateway
20 | port: 8443
21 | - name: grpc
22 | port: 8444
23 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-provider/service_account.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: ServiceAccount
4 | metadata:
5 | name: akash-provider
6 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-services/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - network-policies.yaml
7 |
--------------------------------------------------------------------------------
/_docs/kustomize/akash-services/network-policies.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: networking.k8s.io/v1
3 | kind: NetworkPolicy
4 | metadata:
5 | name: akash-services-default-deny-ingress
6 | spec:
7 | podSelector:
8 | matchLabels: {}
9 | policyTypes:
10 | - Ingress
11 | ---
12 | apiVersion: networking.k8s.io/v1
13 | kind: NetworkPolicy
14 | metadata:
15 | name: akash-services-allow-akash-services
16 | spec:
17 | podSelector:
18 | matchLabels: {}
19 | ingress:
20 | - from:
21 | - namespaceSelector:
22 | matchLabels:
23 | akash.network/name: akash-services
24 | ---
25 | apiVersion: networking.k8s.io/v1
26 | kind: NetworkPolicy
27 | metadata:
28 | name: akash-services-allow-ingress-nginx
29 | spec:
30 | podSelector:
31 | matchLabels: {}
32 | ingress:
33 | - from:
34 | - namespaceSelector:
35 | matchLabels:
36 | app.kubernetes.io/name: ingress-nginx
37 |
--------------------------------------------------------------------------------
/_docs/kustomize/networking/namespace.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: v1
3 | kind: Namespace
4 | metadata:
5 | name: akash-services
6 | labels:
7 | name: akash-services
8 | akash.network: "true"
9 | akash.network/name: akash-services
10 | ---
11 | apiVersion: v1
12 | kind: Namespace
13 | metadata:
14 | name: lease
15 | labels:
16 | name: lease
17 | akash.network: "true"
18 |
--------------------------------------------------------------------------------
/_docs/kustomize/networking/network-policy-default-ns-deny.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: networking.k8s.io/v1
3 | kind: NetworkPolicy
4 | metadata:
5 | name: default-deny-ingress
6 | namespace: default
7 | spec:
8 | podSelector:
9 | matchLabels: {}
10 | policyTypes:
11 | - Ingress
12 | - Egress
13 |
--------------------------------------------------------------------------------
/_docs/kustomize/redis/kustomization.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: kustomize.config.k8s.io/v1beta1
2 | kind: Kustomization
3 | namespace: akash-services
4 | resources:
5 | - statefulset.yaml
6 | - service.yaml
7 | - service_account.yaml
8 | commonLabels:
9 | app.kubernetes.io/instance: redis
10 | app.kubernetes.io/name: redis
11 |
--------------------------------------------------------------------------------
/_docs/kustomize/redis/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: redis
5 | namespace: akash-services
6 | labels:
7 | app.kubernetes.io/instance: redis
8 | app.kubernetes.io/name: redis
9 | spec:
10 | type: ClusterIP
11 | ports:
12 | - name: redis
13 | port: 6379
14 | selector:
15 | app.kubernetes.io/instance: redis
16 | app.kubernetes.io/name: redis
17 |
--------------------------------------------------------------------------------
/_docs/kustomize/redis/statefulset.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: StatefulSet
3 | metadata:
4 | name: redis
5 | namespace: akash-services
6 | labels:
7 | app.kubernetes.io/instance: redis
8 | app.kubernetes.io/name: redis
9 | spec:
10 | serviceName: redis
11 | replicas: 1
12 | selector:
13 | matchLabels:
14 | app.kubernetes.io/instance: redis
15 | app.kubernetes.io/name: redis
16 | template:
17 | metadata:
18 | annotations: {}
19 | labels:
20 | app.kubernetes.io/instance: redis
21 | app.kubernetes.io/name: redis
22 | spec:
23 | containers:
24 | - name: redis
25 | image: bitnami/redis:7.0
26 | imagePullPolicy: IfNotPresent
27 | ports:
28 | - containerPort: 6379
29 | name: redis
30 | resources:
31 | env:
32 | - name: ALLOW_EMPTY_PASSWORD
33 | value: no
34 | - name: REDIS_PASSWORD
35 | value: "securepassword"
36 | volumeMounts:
37 | - name: redis-data
38 | mountPath: /data
39 | volumeClaimTemplates:
40 | - metadata:
41 | name: redis-data
42 | spec:
43 | accessModes: [ "ReadWriteOnce" ]
44 | resources:
45 | requests:
46 | storage: 1Gi
47 | storageClassName: "default"
48 |
--------------------------------------------------------------------------------
/_docs/kustomize/storage/storageclass.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: storage.k8s.io/v1
2 | kind: StorageClass
3 | metadata:
4 | name: beta2
5 | labels:
6 | akash.network: "true"
7 | provisioner: rancher.io/local-path
8 | reclaimPolicy: Delete
9 | volumeBindingMode: WaitForFirstConsumer
10 | ---
11 | apiVersion: storage.k8s.io/v1
12 | kind: StorageClass
13 | metadata:
14 | name: default
15 | labels:
16 | akash.network: "true"
17 | provisioner: rancher.io/local-path
18 | reclaimPolicy: Delete
19 | volumeBindingMode: WaitForFirstConsumer
20 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-node/docker-image.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - op: replace
3 | path: /spec/template/spec/containers/0/image
4 | value: ghcr.io/akash-network/node:stable
5 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-node/gateway-host.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - op: replace
3 | path: /spec/rules/0/host
4 | value: akash.localhost
5 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-node/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - ../../../../../_docs/kustomize/akash-node
7 |
8 | configMapGenerator:
9 | ##
10 | # cosmos-sdk app config (app.toml) overrides
11 | ##
12 | - name: akash-app-config
13 | behavior: merge
14 | literals: []
15 | # - pruning=syncable
16 |
17 | ##
18 | # tendermint node config (config.toml) overrides
19 | ##
20 | - name: akash-config
21 | behavior: merge
22 | literals: []
23 | # - moniker=node0
24 |
25 | - name: akash-data
26 | behavior: merge
27 | files:
28 | - cache/config/genesis.json
29 |
30 | secretGenerator:
31 | - name: akash-keys
32 | behavior: replace
33 | files:
34 | - cache/config/node_key.json
35 | - cache/config/priv_validator_key.json
36 | - cache/data/priv_validator_state.json
37 |
38 | patches:
39 |
40 | ##
41 | # Configure gateway host in `gateway-host.yaml`. This
42 | # will be the hostname for rpc over port 80.
43 | ##
44 |
45 | - path: gateway-host.yaml
46 | target:
47 | group: networking.k8s.io
48 | version: v1
49 | kind: Ingress
50 | name: akash-node
51 | - path: docker-image.yaml
52 | target:
53 | kind: Deployment
54 | group: apps
55 | name: akash-node
56 | version: v1
57 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-operator-hostname/docker-image.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - op: replace
3 | path: /spec/template/spec/containers/0/image
4 | value: ghcr.io/akash-network/provider:stable
5 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-operator-hostname/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - ../../../../../_docs/kustomize/akash-operator-hostname
7 | patches:
8 | - path: docker-image.yaml
9 | target:
10 | kind: Deployment
11 | group: apps
12 | name: operator-hostname
13 | version: v1
14 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-operator-inventory/docker-image.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - op: replace
3 | path: /spec/template/spec/containers/0/image
4 | value: ghcr.io/akash-network/provider:stable
5 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-operator-inventory/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - ../../../../../_docs/kustomize/akash-operator-inventory
7 |
8 | patches:
9 | - path: docker-image.yaml
10 | target:
11 | kind: Deployment
12 | group: apps
13 | name: operator-inventory
14 | version: v1
15 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-operator-ip/docker-image.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - op: replace
3 | path: /spec/template/spec/containers/0/image
4 | value: ghcr.io/akash-network/provider:stable
5 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-operator-ip/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - ../../../../../_docs/kustomize/akash-operator-ip
7 | patches:
8 | - path: docker-image.yaml
9 | target:
10 | kind: Deployment
11 | group: apps
12 | name: operator-ip
13 | version: v1
14 |
15 | configMapGenerator:
16 | - name: operator-ip
17 | behavior: merge
18 | envs:
19 | - configmap.yaml
20 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-provider/docker-image.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - op: replace
3 | path: /spec/template/spec/initContainers/0/image
4 | value: ghcr.io/akash-network/node:stable
5 | - op: replace
6 | path: /spec/template/spec/containers/0/image
7 | value: ghcr.io/akash-network/provider:stable
8 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-provider/gateway-host.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | - op: replace
3 | path: /spec/rules/0/host
4 | value: akash-provider.localhost
5 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/akash-provider/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - ../../../../../_docs/kustomize/akash-provider
7 | generatorOptions:
8 | disableNameSuffixHash: true
9 | configMapGenerator:
10 | - name: provider-client-config
11 | behavior: merge
12 | literals:
13 | - AKASH_NODE=http://akash-node:26657
14 | - AKASH_CHAIN_ID=local
15 |
16 | ##
17 | # Akash provider service option overrides
18 | ##
19 | - name: provider-config
20 | behavior: merge
21 | literals:
22 | - AP_INGRESS_DOMAIN=app.localhost
23 | - AP_CLUSTER_PUBLIC_HOSTNAME=app.localhost
24 | - AP_CLUSTER_NODE_PORT_QUANTITY=100
25 | - AP_BID_PRICE_STRATEGY=randomRange
26 | - AP_DEPLOYMENT_RUNTIME_CLASS=none
27 | # - AP_INGRESS_STATIC_HOSTS=true
28 |
29 | patches:
30 |
31 | ##
32 | # Configure gateway host in `gateway-host.yaml`. Its value
33 | # should be the hostname from the on-chain Provider.HostURI
34 | # field.
35 | ##
36 |
37 | - path: gateway-host.yaml
38 | target:
39 | group: networking.k8s.io
40 | version: v1
41 | kind: Ingress
42 | name: akash-provider
43 | - path: docker-image.yaml
44 | target:
45 | kind: Deployment
46 | group: apps
47 | name: provider-service
48 | version: v1
49 |
50 | secretGenerator:
51 | - name: provider-keys
52 | behavior: replace
53 | files:
54 | - cache/key.txt
55 | - cache/key-pass.txt
56 | - cache/provider-cert.pem
57 |
--------------------------------------------------------------------------------
/_docs/kustomize/templates/redis/kustomization.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: kustomize.config.k8s.io/v1beta1
3 | kind: Kustomization
4 | namespace: akash-services
5 | resources:
6 | - ../../../../../_docs/kustomize/redis
7 |
--------------------------------------------------------------------------------
/_docs/marketplace.md:
--------------------------------------------------------------------------------
1 | # Marketplace State Machine
2 |
3 | Please see [here](../../docs/design/marketplace.md) for most up-to-date documentation.
--------------------------------------------------------------------------------
/_docs/mtls.md:
--------------------------------------------------------------------------------
1 | # Authentication with mTLS
2 |
3 | Please see [here](../../docs/design/mtls.md) for most up-to-date documentation.
--------------------------------------------------------------------------------
/_docs/provider.yaml:
--------------------------------------------------------------------------------
1 | host: https://localhost:8443
2 | attributes:
3 | - key: region
4 | value: us-west
5 | - key: location
6 | value:
7 | - key: tier
8 | value: 5
9 | - key: hostname
10 | value: ewr1
11 | capabilities:
12 | cpu:
13 | - arch: amd64
14 | vendor: amd
15 | memory:
16 | gpu:
17 | - vendor: nvidia|amd
18 | storage:
19 | - class: default
20 | persistent: true
21 | - class: beta3
22 | persistent: true
23 | ip-leases:
24 | blocks:
25 | - /29
26 |
--------------------------------------------------------------------------------
/_docs/provider/kube/metallb-service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | labels:
5 | component: controller
6 | name: controller
7 | namespace: metallb-system
8 | spec:
9 | selector:
10 | component: controller
11 | app: metallb
12 | ports:
13 | - protocol: TCP
14 | name: monitoring
15 | port: 7472
16 | ---
17 | apiVersion: networking.k8s.io/v1
18 | kind: NetworkPolicy
19 | metadata:
20 | name: from-akash
21 | namespace: metallb-system
22 | spec:
23 | podSelector:
24 | matchLabels:
25 | app: metallb
26 | component: controller
27 | policyTypes:
28 | - Ingress
29 | ingress:
30 | - from:
31 | - namespaceSelector:
32 | matchLabels:
33 | kubernetes.io/metadata.name: akash-services
34 | podSelector:
35 | matchLabels: {}
36 |
--------------------------------------------------------------------------------
/_docs/rook/prod/akash-deployments-pool.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: ceph.rook.io/v1
2 | kind: CephBlockPool
3 | metadata:
4 | name: akash-deployments
5 | namespace: rook-ceph
6 | spec:
7 | failureDomain: host
8 | replicated:
9 | size: 3
10 |
--------------------------------------------------------------------------------
/_docs/rook/prod/akash-deployments-storageclass.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: storage.k8s.io/v1
2 | kind: StorageClass
3 | metadata:
4 | annotations:
5 | storageclass.kubernetes.io/is-default-class: "true"
6 | name: beta2
7 | labels:
8 | akash.network: "true"
9 | provisioner: rook-ceph.rbd.csi.ceph.com
10 | parameters:
11 | pool: akash-deployments
12 |
13 | # The value of "clusterID" MUST be the same as the one in which your rook cluster exist
14 | clusterID: rook-ceph
15 |
16 | # RBD image format. Defaults to "2".
17 | imageFormat: "2"
18 |
19 | # RBD image features. Available for imageFormat: "2". CSI RBD currently supports only `layering` feature.
20 | imageFeatures: layering
21 |
22 | # Specify the filesystem type of the volume. If not specified, it will use `ext4`.
23 | csi.storage.k8s.io/fstype: ext4
24 |
25 | csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
26 | csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph # namespace:cluster
27 | csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
28 | csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph # namespace:cluster
29 | csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
30 | csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph # namespace:cluster
31 | reclaimPolicy: Delete
32 |
--------------------------------------------------------------------------------
/_docs/rook/prod/akash-nodes-pool.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: ceph.rook.io/v1
2 | kind: CephBlockPool
3 | metadata:
4 | name: akash-nodes
5 | namespace: rook-ceph
6 | spec:
7 | failureDomain: host
8 | replicated:
9 | size: 3
10 |
--------------------------------------------------------------------------------
/_docs/rook/prod/akash-nodes-storageclass.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: storage.k8s.io/v1
2 | kind: StorageClass
3 | metadata:
4 | name: akash-nodes
5 | labels:
6 | akash.network: "true"
7 | provisioner: rook-ceph.rbd.csi.ceph.com
8 | parameters:
9 | pool: akash-nodes
10 |
11 | # The value of "clusterID" MUST be the same as the one in which your rook cluster exist
12 | clusterID: rook-ceph
13 |
14 | # RBD image format. Defaults to "2".
15 | imageFormat: "2"
16 |
17 | # RBD image features. Available for imageFormat: "2". CSI RBD currently supports only `layering` feature.
18 | imageFeatures: layering
19 |
20 | # Specify the filesystem type of the volume. If not specified, it will use `ext4`.
21 | csi.storage.k8s.io/fstype: ext4
22 |
23 | csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
24 | csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph # namespace:cluster
25 | csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
26 | csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph # namespace:cluster
27 | csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
28 | csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph # namespace:cluster
29 | reclaimPolicy: Retain
30 |
--------------------------------------------------------------------------------
/_docs/rook/prod/toolbox.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: rook-ceph-tools
5 | namespace: rook-ceph # namespace:cluster
6 | labels:
7 | app: rook-ceph-tools
8 | spec:
9 | replicas: 1
10 | selector:
11 | matchLabels:
12 | app: rook-ceph-tools
13 | template:
14 | metadata:
15 | labels:
16 | app: rook-ceph-tools
17 | spec:
18 | dnsPolicy: ClusterFirstWithHostNet
19 | containers:
20 | - name: rook-ceph-tools
21 | image: rook/ceph:v1.7.6
22 | command: ["/tini"]
23 | args: ["-g", "--", "/usr/local/bin/toolbox.sh"]
24 | imagePullPolicy: IfNotPresent
25 | env:
26 | - name: ROOK_CEPH_USERNAME
27 | valueFrom:
28 | secretKeyRef:
29 | name: rook-ceph-mon
30 | key: ceph-username
31 | - name: ROOK_CEPH_SECRET
32 | valueFrom:
33 | secretKeyRef:
34 | name: rook-ceph-mon
35 | key: ceph-secret
36 | volumeMounts:
37 | - mountPath: /etc/ceph
38 | name: ceph-config
39 | - name: mon-endpoint-volume
40 | mountPath: /etc/rook
41 | volumes:
42 | - name: mon-endpoint-volume
43 | configMap:
44 | name: rook-ceph-mon-endpoints
45 | items:
46 | - key: data
47 | path: mon-endpoints
48 | - name: ceph-config
49 | emptyDir: {}
50 | tolerations:
51 | - key: "node.kubernetes.io/unreachable"
52 | operator: "Exists"
53 | effect: "NoExecute"
54 | tolerationSeconds: 5
55 |
--------------------------------------------------------------------------------
/_docs/rook/test/aio.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: DaemonSet
3 | metadata:
4 | name: rook-aio
5 | namespace: rook-ceph
6 | spec:
7 | selector:
8 | matchLabels:
9 | name: rook-aio
10 | template:
11 | metadata:
12 | labels:
13 | name: rook-aio
14 | spec:
15 | tolerations:
16 | - key: node-role.kubernetes.io/master
17 | effect: NoSchedule
18 | initContainers:
19 | - name: create-sysctl-file
20 | image: busybox
21 | imagePullPolicy: IfNotPresent
22 | command: ['/bin/sh', '-c', 'echo fs.aio-max-nr=1048576 > /etc/sysctl.d/98-rook-ceph-aio.conf']
23 | volumeMounts:
24 | - name: sysctld
25 | mountPath: /etc/sysctl.d
26 | - name: run-sysctl
27 | image: alpine:3.6
28 | imagePullPolicy: IfNotPresent
29 | command: ['/bin/sh', '-c', 'sysctl -w fs.aio-max-nr=1048576']
30 | securityContext:
31 | privileged: true
32 | volumeMounts:
33 | - name: sysctld
34 | mountPath: /etc/sysctl.d
35 | - name: modifysys
36 | mountPath: /sys
37 | containers:
38 | - name: rook-aio
39 | image: busybox
40 | imagePullPolicy: IfNotPresent
41 | command: ['/bin/tail']
42 | args: ['-f','/dev/null']
43 | volumeMounts:
44 | - name: sysctld
45 | mountPath: /etc/sysctl.d
46 | terminationGracePeriodSeconds: 30
47 | volumes:
48 | - name: sysctld
49 | hostPath:
50 | path: /etc/sysctl.d
51 | - name: modifysys
52 | hostPath:
53 | path: /sys
54 |
--------------------------------------------------------------------------------
/_docs/rook/test/akash-deployments-pool.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: ceph.rook.io/v1
2 | kind: CephBlockPool
3 | metadata:
4 | name: akash-deployments
5 | namespace: rook-ceph
6 | spec:
7 | failureDomain: host
8 | replicated:
9 | size: 1
10 |
--------------------------------------------------------------------------------
/_docs/rook/test/akash-deployments-storageclass.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: storage.k8s.io/v1
2 | kind: StorageClass
3 | metadata:
4 | annotations:
5 | storageclass.kubernetes.io/is-default-class: "true"
6 | name: beta2
7 | labels:
8 | akash.network: "true"
9 | provisioner: rook-ceph.rbd.csi.ceph.com
10 | parameters:
11 | pool: akash-deployments
12 |
13 | # The value of "clusterID" MUST be the same as the one in which your rook cluster exist
14 | clusterID: rook-ceph
15 |
16 | # RBD image format. Defaults to "2".
17 | imageFormat: "2"
18 |
19 | # RBD image features. Available for imageFormat: "2". CSI RBD currently supports only `layering` feature.
20 | imageFeatures: layering
21 |
22 | # Specify the filesystem type of the volume. If not specified, it will use `ext4`.
23 | csi.storage.k8s.io/fstype: ext4
24 |
25 | csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
26 | csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph # namespace:cluster
27 | csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
28 | csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph # namespace:cluster
29 | csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
30 | csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph # namespace:cluster
31 | reclaimPolicy: Delete
32 |
--------------------------------------------------------------------------------
/_docs/rook/test/akash-nodes-pool.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: ceph.rook.io/v1
2 | kind: CephBlockPool
3 | metadata:
4 | name: akash-nodes
5 | namespace: rook-ceph
6 | spec:
7 | failureDomain: host
8 | replicated:
9 | size: 1
10 |
--------------------------------------------------------------------------------
/_docs/rook/test/akash-nodes-storageclass.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: storage.k8s.io/v1
2 | kind: StorageClass
3 | metadata:
4 | name: akash-nodes
5 | labels:
6 | akash.network: "true"
7 | provisioner: rook-ceph.rbd.csi.ceph.com
8 | parameters:
9 | pool: akash-nodes
10 |
11 | # The value of "clusterID" MUST be the same as the one in which your rook cluster exist
12 | clusterID: rook-ceph
13 |
14 | # RBD image format. Defaults to "2".
15 | imageFormat: "2"
16 |
17 | # RBD image features. Available for imageFormat: "2". CSI RBD currently supports only `layering` feature.
18 | imageFeatures: layering
19 |
20 | # Specify the filesystem type of the volume. If not specified, it will use `ext4`.
21 | csi.storage.k8s.io/fstype: ext4
22 |
23 | csi.storage.k8s.io/provisioner-secret-name: rook-csi-rbd-provisioner
24 | csi.storage.k8s.io/provisioner-secret-namespace: rook-ceph # namespace:cluster
25 | csi.storage.k8s.io/controller-expand-secret-name: rook-csi-rbd-provisioner
26 | csi.storage.k8s.io/controller-expand-secret-namespace: rook-ceph # namespace:cluster
27 | csi.storage.k8s.io/node-stage-secret-name: rook-csi-rbd-node
28 | csi.storage.k8s.io/node-stage-secret-namespace: rook-ceph # namespace:cluster
29 | reclaimPolicy: Retain
30 |
--------------------------------------------------------------------------------
/_docs/rook/test/toolbox.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: rook-ceph-tools
5 | namespace: rook-ceph # namespace:cluster
6 | labels:
7 | app: rook-ceph-tools
8 | spec:
9 | replicas: 1
10 | selector:
11 | matchLabels:
12 | app: rook-ceph-tools
13 | template:
14 | metadata:
15 | labels:
16 | app: rook-ceph-tools
17 | spec:
18 | dnsPolicy: ClusterFirstWithHostNet
19 | containers:
20 | - name: rook-ceph-tools
21 | image: rook/ceph:v1.7.6
22 | command: ["/tini"]
23 | args: ["-g", "--", "/usr/local/bin/toolbox.sh"]
24 | imagePullPolicy: IfNotPresent
25 | env:
26 | - name: ROOK_CEPH_USERNAME
27 | valueFrom:
28 | secretKeyRef:
29 | name: rook-ceph-mon
30 | key: ceph-username
31 | - name: ROOK_CEPH_SECRET
32 | valueFrom:
33 | secretKeyRef:
34 | name: rook-ceph-mon
35 | key: ceph-secret
36 | volumeMounts:
37 | - mountPath: /etc/ceph
38 | name: ceph-config
39 | - name: mon-endpoint-volume
40 | mountPath: /etc/rook
41 | volumes:
42 | - name: mon-endpoint-volume
43 | configMap:
44 | name: rook-ceph-mon-endpoints
45 | items:
46 | - key: data
47 | path: mon-endpoints
48 | - name: ceph-config
49 | emptyDir: {}
50 | tolerations:
51 | - key: "node.kubernetes.io/unreachable"
52 | operator: "Exists"
53 | effect: "NoExecute"
54 | tolerationSeconds: 5
55 |
--------------------------------------------------------------------------------
/_docs/testing.md:
--------------------------------------------------------------------------------
1 | # Testing
2 |
3 | Please see [here](../../docs/design/testing.md) for most up-to-date documentation.
--------------------------------------------------------------------------------
/_run/.env:
--------------------------------------------------------------------------------
1 | AKASH_KEYRING_BACKEND=test
2 | AKASH_GAS_ADJUSTMENT=2
3 | AKASH_CHAIN_ID=local
4 | AKASH_YES=true
5 | AKASH_GAS_PRICES=0.025uakt
6 | AKASH_GAS=auto
7 | AKASH_NODE=http://localhost:26657
8 |
9 | AP_HOME=${AKASH_HOME}
10 | AP_KEYRING_BACKEND=${AKASH_KEYRING_BACKEND}
11 | AP_GAS_ADJUSTMENT=${AKASH_GAS_ADJUSTMENT}
12 | AP_CHAIN_ID=${AKASH_CHAIN_ID}
13 | AP_YES=${AKASH_YES}
14 | AP_GAS_PRICES=${AKASH_GAS_PRICES}
15 | AP_GAS=${AKASH_GAS}
16 | AP_NODE=${AKASH_NODE}
17 |
--------------------------------------------------------------------------------
/_run/.envrc:
--------------------------------------------------------------------------------
1 | source_up .envrc
2 |
3 | if ! has grpcurl ; then
4 | echo -e "\033[31mgrpcurl is not installed"; exit 1
5 | fi
6 |
7 |
8 | if ! has tqdm ; then
9 | echo -e "\033[31mtqdm is not installed. https://github.com/tqdm/tqdm"; exit 1
10 | fi
11 |
12 | dotenv .env
13 |
--------------------------------------------------------------------------------
/_run/.envrc_run:
--------------------------------------------------------------------------------
1 | source_up .envrc
2 |
3 | AP_RUN_NAME=$(basename "$(pwd)")
4 | AP_RUN_DIR="${DEVCACHE_RUN}/${AP_RUN_NAME}"
5 |
6 | export AKASH_HOME="${AP_RUN_DIR}/.akash"
7 | export AP_RUN_NAME
8 | export AP_RUN_DIR
9 |
--------------------------------------------------------------------------------
/_run/common-base.mk:
--------------------------------------------------------------------------------
1 | include $(abspath $(CURDIR)/../../make/init.mk)
2 |
3 | ifeq ($(AP_RUN_NAME),)
4 | $(error "AP_RUN_NAME is not set")
5 | endif
6 |
7 | ifeq ($(AP_RUN_DIR),)
8 | $(error "AP_RUN_DIR is not set")
9 | endif
10 |
11 | ifneq ($(AKASH_HOME),)
12 | ifneq ($(DIRENV_FILE),$(CURDIR)/.envrc)
13 | $(error "AKASH_HOME is set by the upper dir (probably in ~/.bashrc|~/.zshrc), \
14 | but direnv does not seem to be configured. \
15 | Ensure direnv is installed and hooked to your shell profile. Refer to the documentation for details. \
16 | ")
17 | endif
18 | else
19 | $(error "AKASH_HOME is not set")
20 | endif
21 |
22 | .PHONY: bins
23 | bins:
24 | ifneq ($(SKIP_BUILD), true)
25 | make -C $(AP_ROOT) bins
26 | endif
27 |
--------------------------------------------------------------------------------
/_run/common-helm.mk:
--------------------------------------------------------------------------------
1 | HELM_CHARTS ?=
2 |
3 | LOKI_VERSION ?= 2.9.1
4 | PROMTAIL_VERSION ?= 3.11.0
5 | GRAFANA_VERSION ?= 6.21.2
6 |
7 | .PHONY: kube-install-helm-charts
8 | kube-install-helm-charts: $(patsubst %, kube-install-helm-chart-%,$(HELM_CHARTS))
9 |
10 | # Create a kubernetes cluster with multi-tenant loki, promtail and grafana integrated for logging.
11 | # See: https://www.scaleway.com/en/docs/tutorials/manage-k8s-logging-loki/ for more info.
12 | .PHONY: kube-install-helm-chart-loki
13 | kube-install-helm-chart-loki:
14 | helm repo add grafana https://grafana.github.io/helm-charts
15 | helm repo update
16 | helm upgrade --install loki grafana/loki \
17 | --version $(LOKI_VERSION) \
18 | --create-namespace \
19 | --namespace loki-stack \
20 | --set persistence.enabled=true,persistence.size=10Gi,config.auth_enabled=true
21 | helm upgrade --install promtail grafana/promtail \
22 | --version $(PROMTAIL_VERSION) \
23 | --namespace loki-stack \
24 | -f ../promtail-values.yaml
25 | helm upgrade --install grafana grafana/grafana \
26 | --version $(GRAFANA_VERSION) \
27 | --namespace loki-stack \
28 | --set persistence.enabled=true,persistence.type=pvc,persistence.size=10Gi
29 |
--------------------------------------------------------------------------------
/_run/common-kind-vars.mk:
--------------------------------------------------------------------------------
1 | # KIND_NAME NOTE: 'kind' string literal is default for the GH actions
2 | # KinD, it's fine to use other names locally, however in GH container name
3 | # is configured by engineerd/setup-kind. `kind-control-plane` is the docker
4 | # image's name in GH Actions.
5 | KIND_NAME ?= $(shell basename $$PWD)
6 |
7 | export KIND_NAME
8 |
9 | ifeq (, $(KINDEST_VERSION))
10 | $(error "KINDEST_VERSION is not set")
11 | endif
12 |
13 | KIND_HTTP_PORT = $(shell docker inspect \
14 | --type container "$(KIND_NAME)-control-plane" \
15 | --format '{{index .NetworkSettings.Ports "80/tcp" 0 "HostPort"}}')
16 |
17 | KIND_HTTP_IP = $(shell docker inspect \
18 | --type container "$(KIND_NAME)-control-plane" \
19 | --format '{{index .NetworkSettings.Ports "80/tcp" 0 "HostIp"}}')
20 |
21 | KIND_K8S_IP = $(shell docker inspect \
22 | --type container "$(KIND_NAME)-control-plane" \
23 | --format '{{index .NetworkSettings.Ports "6443/tcp" 0 "HostIp"}}')
24 |
25 | # KIND_PORT_BINDINGS deliberately redirects stderr to /dev/null
26 | # in order to suppress message Error: No such object: kube-control-plane
27 | # during cluster setup
28 | # it is a bit doggy way but seems to do the job
29 | KIND_PORT_BINDINGS = $(shell docker inspect "$(KIND_NAME)-control-plane" \
30 | --format '{{index .NetworkSettings.Ports "80/tcp" 0 "HostPort"}}' 2> /dev/null)
31 |
--------------------------------------------------------------------------------
/_run/common-kind.mk:
--------------------------------------------------------------------------------
1 | # KIND_NAME NOTE: 'kind' string literal is default for the GH actions
2 | # KinD, it's fine to use other names locally, however in GH container name
3 | # is configured by engineerd/setup-kind. `kind-control-plane` is the docker
4 | # image's name in GH Actions.
5 | include $(AP_ROOT)/_run/common-kind-vars.mk
6 |
7 | KIND_IMG ?= kindest/node:$(KINDEST_VERSION)
8 | K8S_CONTEXT ?= $(shell kubectl config current-context)
9 | SETUP_KIND := $(AP_ROOT)/script/setup-kind.sh
10 | KIND_CONFIG ?= default
11 | KIND_CONFIG_FILE := $(shell "$(SETUP_KIND)" config-file $$PWD $(KIND_CONFIG))
12 |
13 | .PHONY: app-http-port
14 | app-http-port:
15 | @echo $(KIND_HTTP_PORT)
16 |
17 | .PHONY: kind-k8s-ip
18 | kind-k8s-ip:
19 | @echo $(KIND_K8S_IP)
20 |
21 | .PHONY: kind-port-bindings
22 | kind-port-bindings: $(KIND)
23 | @echo $(KIND_PORT_BINDINGS)
24 |
25 | .INTERMEDIATE: kube-cluster-create-kind
26 | kube-cluster-create-kind: $(KIND)
27 | $(KIND) create cluster --config "$(KIND_CONFIG_FILE)" --name "$(KIND_NAME)" --image "$(KIND_IMG)"
28 |
29 | .PHONY: kube-cluster-delete-kind
30 | kube-cluster-delete-kind: $(KIND)
31 | $(KIND) delete cluster --name "$(KIND_NAME)"
32 | rm -rf $(KUBE_CREATE)
33 |
--------------------------------------------------------------------------------
/_run/common-minikube.mk:
--------------------------------------------------------------------------------
1 | INGRESS_CONFIG_PATH ?= ../ingress-nginx.yaml
2 |
3 | MINIKUBE_VM_DRIVER ?=
4 | MINIKUBE_IP = $(shell minikube ip)
5 | MINIKUBE_INVOKE = VM_DRIVER=$(MINIKUBE_VM_DRIVER) ROOK_PATH=$(AP_ROOT)/_docs/rook/test $(AP_ROOT)/script/setup-minikube.sh
6 |
7 | .PHONY: minikube-cluster-create
8 | minikube-cluster-create:
9 | $(MINIKUBE_INVOKE) up
10 | $(MINIKUBE_INVOKE) akash-setup
11 | kubectl apply -f ../ingress-nginx-class.yaml
12 | kubectl apply -f "$(INGRESS_CONFIG_PATH)"
13 | $(MINIKUBE_INVOKE) deploy-rook
14 |
15 | .PHONY: minikube-cluster-delete
16 | minikube-cluster-delete:
17 | $(MINIKUBE_INVOKE) clean
18 |
19 | .PHONY: ip
20 | ip:
21 | @echo $(MINIKUBE_IP)
22 |
--------------------------------------------------------------------------------
/_run/kind-config-calico.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | kind: Cluster
3 | apiVersion: kind.x-k8s.io/v1alpha4
4 | networking:
5 | disableDefaultCNI: true
6 | #podSubnet: 192.168.0.0/16 # Default Calico subnet
7 | nodes:
8 | - role: control-plane
9 | kubeadmConfigPatches:
10 | - kind: InitConfiguration
11 | nodeRegistration:
12 | kubeletExtraArgs:
13 | node-labels: "ingress-ready=true"
14 | extraPortMappings:
15 | - containerPort: 80
16 | protocol: TCP
17 | - containerPort: 443
18 | protocol: TCP
19 |
--------------------------------------------------------------------------------
/_run/kube-config-metal-lb-ip.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | namespace: metallb-system
5 | name: config
6 | data:
7 | config: |
8 | address-pools:
9 | - name: default
10 | protocol: layer2
11 | addresses:
12 | - 24.0.0.1-24.0.0.100
13 |
--------------------------------------------------------------------------------
/_run/kube/.envrc:
--------------------------------------------------------------------------------
1 | ../.envrc_run
--------------------------------------------------------------------------------
/_run/kube/.gitignore:
--------------------------------------------------------------------------------
1 | cache/
2 |
--------------------------------------------------------------------------------
/_run/kube/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine
2 |
3 | ADD ./test.sh /bin/
4 |
5 | ENTRYPOINT /bin/test.sh
6 |
--------------------------------------------------------------------------------
/_run/kube/Makefile:
--------------------------------------------------------------------------------
1 | KUBE_SETUP_PREREQUISITES ?= \
2 |
3 | KUBE_CLUSTER_CREATE_TYPE := kind
4 | KUBE_SSH_NODES := kind
5 |
6 | KUSTOMIZE_INSTALLS ?= \
7 | akash-operator-hostname \
8 | akash-operator-inventory \
9 | akash-operator-ip
10 |
11 | include ../common.mk
12 | include ../common-commands.mk
13 | include ../common-kube.mk
14 |
15 | SDL_PATH ?= grafana.yaml
16 |
17 | GATEWAY_HOSTNAME ?= localhost
18 | GATEWAY_HOST ?= $(GATEWAY_HOSTNAME):8443
19 | GATEWAY_ENDPOINT ?= https://$(GATEWAY_HOST)
20 |
21 | .PHONY: provider-run
22 | provider-run:
23 | $(PROVIDER_SERVICES) run \
24 | --from "$(PROVIDER_KEY_NAME)" \
25 | --cluster-k8s \
26 | --gateway-listen-address "$(GATEWAY_HOST)" \
27 | --deployment-ingress-static-hosts true \
28 | --deployment-ingress-domain "$(GATEWAY_HOSTNAME)" \
29 | --cluster-node-port-quantity 100 \
30 | --cluster-public-hostname "$(GATEWAY_HOSTNAME)" \
31 | --bid-price-strategy "randomRange" \
32 | --deployment-runtime-class "none" \
33 | --ip-operator=true
34 |
35 | .PHONY: provider-lease-ping
36 | provider-lease-ping:
37 | curl -sIH "Host: hello.localhost" localhost:$(KIND_HTTP_PORT)
38 |
39 | .PHONY: hostname-operator
40 | hostname-operator:
41 | $(PROVIDER_SERVICES) hostname-operator
42 |
43 | .PHONY: clean-kube
44 | clean-kube:
45 |
46 | .PHONY: kube-deployments-rollout
47 | kube-deployments-rollout: #$(patsubst %, kube-deployment-rollout-%,$(KUSTOMIZE_INSTALLS))
48 |
49 | .PHONY: kube-setup-kube
50 | kube-setup-kube:
51 |
--------------------------------------------------------------------------------
/_run/kube/deployment.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | as: 80
10 | http_options:
11 | max_body_size: 2097152
12 | next_cases:
13 | - off
14 | accept:
15 | - hello.localhost
16 | to:
17 | - global: true
18 | bew:
19 | image: quay.io/ovrclk/demo-app
20 | expose:
21 | - port: 80
22 | as: 80
23 | accept:
24 | - hello1.localhost
25 | to:
26 | - global: true
27 |
28 | profiles:
29 | compute:
30 | web:
31 | resources:
32 | cpu:
33 | units: 0.1
34 | memory:
35 | size: 16Mi
36 | storage:
37 | size: 128Mi
38 | placement:
39 | westcoast:
40 | attributes:
41 | region: us-west
42 | pricing:
43 | web:
44 | denom: uakt
45 | amount: 1000
46 |
47 | deployment:
48 | web:
49 | westcoast:
50 | profile: web
51 | count: 1
52 | bew:
53 | westcoast:
54 | profile: web
55 | count: 1
--------------------------------------------------------------------------------
/_run/kube/grafana.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | grafana:
6 | image: grafana/grafana
7 | expose:
8 | - port: 3000
9 | as: 80
10 | to:
11 | - global: true
12 | accept:
13 | - webdistest.localhost
14 | params:
15 | storage:
16 | data:
17 | mount: /var/lib/grafana
18 | profiles:
19 | compute:
20 | grafana:
21 | resources:
22 | cpu:
23 | units: 1
24 | memory:
25 | size: 1Gi
26 | storage:
27 | - size: 512Mi
28 | - name: data
29 | size: 1Gi
30 | attributes:
31 | persistent: true
32 | class: beta2
33 | placement:
34 | westcoast:
35 | attributes:
36 | region: us-west
37 | pricing:
38 | grafana:
39 | denom: uakt
40 | amount: 1000
41 | deployment:
42 | grafana:
43 | westcoast:
44 | profile: grafana
45 | count: 1
46 |
--------------------------------------------------------------------------------
/_run/kube/key.key:
--------------------------------------------------------------------------------
1 | -----BEGIN TENDERMINT PRIVATE KEY-----
2 | kdf: bcrypt
3 | salt: EAE151E3A990D0509979F9F8D2387C20
4 | type: secp256k1
5 |
6 | /LtGnQIsFnwa4QZzMlzQANGT43ayv/0P50Cfcoz0muXP3mvUsHu/ifdN9WV1vryO
7 | /EdmbmBIkgq7G3L0YpU85Lu5/+O5nNN3erLtQk0=
8 | =0Zx3
9 | -----END TENDERMINT PRIVATE KEY-----
10 |
--------------------------------------------------------------------------------
/_run/kube/key2.key:
--------------------------------------------------------------------------------
1 | -----BEGIN TENDERMINT PRIVATE KEY-----
2 | kdf: bcrypt
3 | salt: CF5040F935D19E50F32924074482B533
4 | type: secp256k1
5 |
6 | M/HGSTz9+SQtYnftu9txVfX/qibznv4sEcVgt2PXdxZpWQNSqHiHIhQeQ1ZmCsWd
7 | GhQ8l3AhaLgBk5qsHO8R9eA1aQ3TGep0WtDgKA4=
8 | =XYTy
9 | -----END TENDERMINT PRIVATE KEY-----
10 |
--------------------------------------------------------------------------------
/_run/kube/kind-config-80.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | kind: Cluster
3 | apiVersion: kind.x-k8s.io/v1alpha4
4 | nodes:
5 | - role: control-plane
6 | kubeadmConfigPatches:
7 | - |
8 | kind: InitConfiguration
9 | nodeRegistration:
10 | kubeletExtraArgs:
11 | node-labels: "ingress-ready=true"
12 | extraPortMappings:
13 | - containerPort: 80
14 | hostPort: 80
15 | protocol: TCP
16 |
--------------------------------------------------------------------------------
/_run/kube/kind-config.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | kind: Cluster
3 | apiVersion: kind.x-k8s.io/v1alpha4
4 | nodes:
5 | - role: control-plane
6 | kubeadmConfigPatches:
7 | - |
8 | kind: InitConfiguration
9 | nodeRegistration:
10 | kubeletExtraArgs:
11 | node-labels: "ingress-ready=true"
12 | extraPortMappings:
13 | - containerPort: 80
14 | protocol: TCP
15 |
--------------------------------------------------------------------------------
/_run/kube/provider.yaml:
--------------------------------------------------------------------------------
1 | host: https://localhost:8443
2 | jwt-host: https://localhost:8444
3 | attributes:
4 | - key: region
5 | value: us-west
6 | - key: capabilities/storage/1/persistent
7 | value: true
8 | - key: capabilities/storage/1/class
9 | value: default
10 | - key: capabilities/storage/2/persistent
11 | value: true
12 | - key: capabilities/storage/2/class
13 | value: beta2
14 | - key: capabilities/storage/3/class
15 | value: ram
16 | - key: capabilities/storage/3/persistent
17 | value: false
18 |
19 |
--------------------------------------------------------------------------------
/_run/kube/test.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | xmrig:
6 | image: cryptoandcoffee/akash-xmrig:1
7 | expose:
8 | - port: 8080
9 | as: 80
10 | proto: tcp
11 | to:
12 | - global: true
13 | env:
14 | - "WALLET=solo:4AbG74FRUHYXBLkvqM1f7QH3UXGkhLetKdxS7U7BHkyfMF4nfx99GvN1REwYQHAeVLLy4Qa5gXXkfS4pSHHUWwdVFifDo5K"
15 | - "POOL=pool.hashvault.pro:80"
16 | - "RANDOMX_MODE=auto" #accepts auto-fast-light
17 | - "RANDOMX_1GB=true"
18 | - "TLS=true" #If supported by pool
19 | - "TLS_FINGERPRINT=420c7850e09b7c0bdcf748a7da9eb3647daf8515718f36d9ccfdd6b9ff834b14" #Can be blank
20 | profiles:
21 | compute:
22 | xmrig:
23 | resources:
24 | cpu:
25 | units: 6
26 | memory:
27 | size: 1Gi
28 | storage:
29 | size: 128Mi
30 | placement:
31 | akash:
32 | pricing:
33 | xmrig:
34 | denom: uakt
35 | amount: 10000000
36 | deployment:
37 | xmrig:
38 | akash:
39 | profile: xmrig
40 | count: 6
41 |
--------------------------------------------------------------------------------
/_run/minikube/.envrc:
--------------------------------------------------------------------------------
1 | source_up .envrc
2 |
3 | export AKASH_HOME=$DEVCACHE_RUN/minikube/.akash
4 |
--------------------------------------------------------------------------------
/_run/minikube/Makefile:
--------------------------------------------------------------------------------
1 | include ../common.mk
2 | include ../common-commands.mk
3 | include ../common-minikube.mk
4 |
5 | #SDL_PATH = grafana.yaml
6 |
7 | GATEWAY_HOSTNAME ?= localhost
8 | GATEWAY_HOST ?= $(GATEWAY_HOSTNAME):8443
9 | GATEWAY_ENDPOINT ?= https://$(GATEWAY_HOST)
10 |
11 | .PHONY: provider-run
12 | provider-run:
13 | $(PROVIDER_SERVICES) run \
14 | --from "$(PROVIDER_KEY_NAME)" \
15 | --cluster-k8s \
16 | --gateway-listen-address "$(GATEWAY_HOST)" \
17 | --deployment-ingress-static-hosts true \
18 | --deployment-ingress-domain "$(GATEWAY_HOSTNAME)" \
19 | --cluster-node-port-quantity 100 \
20 | --cluster-public-hostname "$(GATEWAY_HOSTNAME)" \
21 | --bid-price-strategy "randomRange" \
22 | --deployment-runtime-class "none"
23 |
24 | .PHONY: provider-lease-status
25 | provider-lease-status:
26 | $(PROVIDER_SERVICES) lease-status \
27 | --dseq "$(DSEQ)" \
28 | --gseq "$(GSEQ)" \
29 | --oseq "$(OSEQ)" \
30 | --from "$(KEY_NAME)" \
31 | --provider "$(PROVIDER_ADDRESS)"
32 |
33 | .PHONY: provider-service-status
34 | provider-service-status:
35 | $(PROVIDER_SERVICES) lease-status \
36 | --dseq "$(DSEQ)" \
37 | --gseq "$(GSEQ)" \
38 | --oseq "$(OSEQ)" \
39 | --from "$(KEY_NAME)" \
40 | --provider "$(PROVIDER_ADDRESS)"
41 |
42 | .PHONY: provider-lease-ping
43 | provider-lease-ping:
44 | curl -sIH "Host: hello.localhost" localhost:$(KIND_HTTP_PORT)
45 |
46 | .PHONY: clean-$(AP_RUN_NAME)
47 | clean-$(AP_RUN_NAME):
48 |
49 | .PHONY: hostname-operator-run
50 | hostname-operator-run:
51 | $(PROVIDER_SERVICES) provider hostname-operator
52 |
--------------------------------------------------------------------------------
/_run/minikube/deployment.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | grafana:
6 | image: grafana/grafana
7 | expose:
8 | - port: 3000
9 | as: 80
10 | to:
11 | - global: true
12 | accept:
13 | - webdistest.localhost
14 | params:
15 | storage:
16 | data:
17 | mount: /var/lib/grafana
18 | profiles:
19 | compute:
20 | grafana:
21 | resources:
22 | cpu:
23 | units: 1
24 | memory:
25 | size: 1Gi
26 | storage:
27 | - size: 512Mi
28 | - name: data
29 | size: 1Gi
30 | attributes:
31 | persistent: true
32 | class: beta2
33 | placement:
34 | westcoast:
35 | attributes:
36 | region: us-west
37 | pricing:
38 | grafana:
39 | denom: uakt
40 | amount: 1000
41 | deployment:
42 | grafana:
43 | westcoast:
44 | profile: grafana
45 | count: 1
46 |
--------------------------------------------------------------------------------
/_run/minikube/provider.yaml:
--------------------------------------------------------------------------------
1 | host: https://localhost:8443
2 | attributes:
3 | - key: region
4 | value: us-west
5 | - key: capabilities/storage/1/persistent
6 | value: true
7 | - key: capabilities/storage/1/class
8 | value: default
9 | - key: capabilities/storage/2/persistent
10 | value: true
11 | - key: capabilities/storage/2/class
12 | value: beta2
13 |
--------------------------------------------------------------------------------
/_run/promtail-values.yaml:
--------------------------------------------------------------------------------
1 | config:
2 | lokiAddress: http://loki.loki-stack:3100/loki/api/v1/push
3 | snippets:
4 | pipelineStages:
5 | - cri: {}
6 | - tenant:
7 | source: namespace
--------------------------------------------------------------------------------
/_run/single/.envrc:
--------------------------------------------------------------------------------
1 | source_up .envrc
2 |
3 | export AKASH_HOME=$DEVCACHE_RUN/single/.akash
4 |
--------------------------------------------------------------------------------
/_run/single/Makefile:
--------------------------------------------------------------------------------
1 | KUSTOMIZE_INSTALLS ?= \
2 | akash-node \
3 | akash-provider \
4 | akash-operator-hostname \
5 | akash-operator-inventory
6 |
7 | KUBE_UPLOAD_AKASH_IMAGE := true
8 |
9 | export AKASH_NODE = http://akash.localhost:$(KIND_PORT_BINDINGS)
10 | export AP_NODE = $(AKASH_NODE)
11 |
12 | include ../common.mk
13 | include ../common-commands.mk
14 | include ../common-kube.mk
15 |
16 | PROVIDER_HOSTNAME = akash-provider.localhost
17 | GATEWAY_ENDPOINT ?= https://akash-provider.localhost
18 |
19 | .PHONY: kube-namespace-setup
20 | kube-namespace-setup:
21 | kubectl apply -f "$(KUSTOMIZE_ROOT)/networking"
22 |
23 | .PHONY: provider-lease-ping
24 | provider-lease-ping:
25 | curl -sIH "Host: hello.localhost" localhost:$(KIND_HTTP_PORT)
26 |
27 | PHONY: clean-single
28 | clean-single:
29 |
30 | .PHONY: kube-deployments-rollout
31 | kube-deployments-rollout: kind-deployment-rollout-akash-node
32 |
33 | .PHONY: kube-setup-single
34 | kube-setup-single: akash-node-ready provider-create
35 |
--------------------------------------------------------------------------------
/_run/single/deployment.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | as: 80
10 | accept:
11 | - hello.localhost
12 | to:
13 | - global: true
14 | bew:
15 | image: quay.io/ovrclk/demo-app
16 | expose:
17 | - port: 80
18 | as: 80
19 | accept:
20 | - hello1.localhost
21 | to:
22 | - global: true
23 |
24 | profiles:
25 | compute:
26 | web:
27 | resources:
28 | cpu:
29 | units: 0.1
30 | memory:
31 | size: 16Mi
32 | storage:
33 | size: 128Mi
34 | placement:
35 | westcoast:
36 | attributes:
37 | region: us-west
38 | pricing:
39 | web:
40 | denom: uakt
41 | amount: 1000
42 |
43 | deployment:
44 | web:
45 | westcoast:
46 | profile: web
47 | count: 1
48 | bew:
49 | westcoast:
50 | profile: web
51 | count: 1
--------------------------------------------------------------------------------
/_run/single/deployment2.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: chentex/random-logger
7 | expose:
8 | - port: 80
9 | as: 80
10 | accept:
11 | - hello.localhost
12 | to:
13 | - global: true
14 | bew:
15 | image: chentex/random-logger
16 | expose:
17 | - port: 80
18 | as: 80
19 | accept:
20 | - hello1.localhost
21 | to:
22 | - global: true
23 |
24 | profiles:
25 | compute:
26 | web:
27 | resources:
28 | cpu:
29 | units: 0.1
30 | memory:
31 | size: 16Mi
32 | storage:
33 | size: 128Mi
34 | placement:
35 | westcoast:
36 | attributes:
37 | region: us-west
38 | pricing:
39 | web:
40 | denom: uakt
41 | amount: 1000
42 |
43 | deployment:
44 | web:
45 | westcoast:
46 | profile: web
47 | count: 1
48 | bew:
49 | westcoast:
50 | profile: web
51 | count: 1
--------------------------------------------------------------------------------
/_run/single/kind-config.yaml:
--------------------------------------------------------------------------------
1 | kind: Cluster
2 | apiVersion: kind.x-k8s.io/v1alpha4
3 | nodes:
4 | - role: control-plane
5 | kubeadmConfigPatches:
6 | - |
7 | kind: InitConfiguration
8 | nodeRegistration:
9 | kubeletExtraArgs:
10 | node-labels: "ingress-ready=true"
11 | extraPortMappings:
12 | - containerPort: 80
13 | hostPort: 80
14 | protocol: TCP
15 | - containerPort: 443
16 | hostPort: 443
17 | protocol: TCP
18 |
--------------------------------------------------------------------------------
/_run/single/provider.yaml:
--------------------------------------------------------------------------------
1 | host: https://akash-provider.localhost
2 | attributes:
3 | - key: region
4 | value: us-west
5 |
--------------------------------------------------------------------------------
/_run/ssh/.envrc:
--------------------------------------------------------------------------------
1 | source_up .envrc
2 |
3 | dotenv_if_exists dev.env
4 |
5 | source_env ~/projects/akash/gpu
6 |
7 | export AKASH_HOME=$DEVCACHE_RUN/ssh/.akash
8 | export AKASH_KUBECONFIG=$KUBECONFIG
9 | export AP_KUBECONFIG=$KUBECONFIG
10 |
--------------------------------------------------------------------------------
/_run/ssh/.gitignore:
--------------------------------------------------------------------------------
1 | cache/
2 |
--------------------------------------------------------------------------------
/_run/ssh/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine
2 |
3 | ADD ./test.sh /bin/
4 |
5 | ENTRYPOINT /bin/test.sh
6 |
--------------------------------------------------------------------------------
/_run/ssh/Makefile:
--------------------------------------------------------------------------------
1 | KUBE_SETUP_PREREQUISITES ?= \
2 |
3 | KUBE_UPLOAD_AKASH_IMAGE ?= true
4 | KUBE_CLUSTER_CREATE_TYPE := ssh
5 |
6 | KUBE_DOCKER_IMAGE_ARCH := amd64
7 |
8 | KUSTOMIZE_INSTALLS ?= \
9 | akash-operator-hostname \
10 | akash-operator-inventory \
11 | akash-operator-ip
12 |
13 | SDL_PATH ?= gpu.yaml
14 |
15 | include ../common.mk
16 | include ../common-commands.mk
17 | include ../common-kube.mk
18 |
19 | GATEWAY_HOSTNAME ?= localhost
20 | GATEWAY_HOST ?= $(GATEWAY_HOSTNAME):8443
21 | GATEWAY_ENDPOINT ?= https://$(GATEWAY_HOST)
22 |
23 | .PHONY: provider-run
24 | provider-run:
25 | $(PROVIDER_SERVICES) run \
26 | --from "$(PROVIDER_KEY_NAME)" \
27 | --cluster-k8s \
28 | --gateway-listen-address "$(GATEWAY_HOST)" \
29 | --deployment-ingress-static-hosts true \
30 | --deployment-ingress-domain "$(GATEWAY_HOSTNAME)" \
31 | --cluster-node-port-quantity 100 \
32 | --cluster-public-hostname "$(GATEWAY_HOSTNAME)" \
33 | --bid-price-strategy "randomRange" \
34 | --deployment-runtime-class "none" \
35 | --ip-operator=false
36 |
37 | .PHONY: provider-lease-ping
38 | provider-lease-ping:
39 | curl -sIH "Host: hello.localhost" localhost:$(KIND_HTTP_PORT)
40 |
41 | .PHONY: clean-gpu
42 | clean-gpu:
43 |
44 | .PHONY: kind-deployments-rollout
45 | kind-deployments-rollout:
46 |
47 | .PHONY: kube-cluster-setup-gpu
48 | kube-cluster-setup-gpu: init \
49 | kube-prepare-images \
50 | kube-upload-images \
51 | kustomize-init \
52 | kustomize-deploy-services \
53 | kube-deployments-rollout \
54 | kind-setup-$(KIND_NAME)
55 |
--------------------------------------------------------------------------------
/_run/ssh/deployment.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | as: 80
10 | http_options:
11 | max_body_size: 2097152
12 | next_cases:
13 | - off
14 | accept:
15 | - hello.localhost
16 | to:
17 | - global: true
18 | bew:
19 | image: quay.io/ovrclk/demo-app
20 | expose:
21 | - port: 80
22 | as: 80
23 | accept:
24 | - hello1.localhost
25 | to:
26 | - global: true
27 |
28 | profiles:
29 | compute:
30 | web:
31 | resources:
32 | cpu:
33 | units: 0.1
34 | memory:
35 | size: 16Mi
36 | storage:
37 | size: 128Mi
38 | placement:
39 | westcoast:
40 | attributes:
41 | region: us-west
42 | pricing:
43 | web:
44 | denom: uakt
45 | amount: 1000
46 |
47 | deployment:
48 | web:
49 | westcoast:
50 | profile: web
51 | count: 1
52 | bew:
53 | westcoast:
54 | profile: web
55 | count: 1
--------------------------------------------------------------------------------
/_run/ssh/gpu.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | gpu-test:
6 | image: nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda10.2
7 | expose:
8 | - port: 3000
9 | as: 80
10 | to:
11 | - global: true
12 | accept:
13 | - webdistest.localhost
14 | profiles:
15 | compute:
16 | gpu-test:
17 | resources:
18 | cpu:
19 | units: 1
20 | memory:
21 | size: 1Gi
22 | gpu:
23 | units: 1
24 | storage:
25 | - size: 512Mi
26 | placement:
27 | westcoast:
28 | attributes:
29 | region: us-west
30 | pricing:
31 | gpu-test:
32 | denom: uakt
33 | amount: 1000
34 | deployment:
35 | gpu-test:
36 | westcoast:
37 | profile: gpu-test
38 | count: 1
39 |
--------------------------------------------------------------------------------
/_run/ssh/kind-config-80.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | kind: Cluster
3 | apiVersion: kind.x-k8s.io/v1alpha4
4 | nodes:
5 | - role: control-plane
6 | kubeadmConfigPatches:
7 | - |
8 | kind: InitConfiguration
9 | nodeRegistration:
10 | kubeletExtraArgs:
11 | node-labels: "ingress-ready=true"
12 | extraPortMappings:
13 | - containerPort: 80
14 | hostPort: 80
15 | protocol: TCP
16 |
--------------------------------------------------------------------------------
/_run/ssh/kind-config.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | kind: Cluster
3 | apiVersion: kind.x-k8s.io/v1alpha4
4 | nodes:
5 | - role: control-plane
6 | kubeadmConfigPatches:
7 | - |
8 | kind: InitConfiguration
9 | nodeRegistration:
10 | kubeletExtraArgs:
11 | node-labels: "ingress-ready=true"
12 | extraPortMappings:
13 | - containerPort: 80
14 | protocol: TCP
15 |
--------------------------------------------------------------------------------
/_run/ssh/provider.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | host: https://localhost:8443
3 | jwt-host: https://localhost:8444
4 | attributes:
5 | - key: region
6 | value: us-west
7 | - key: capabilities/storage/1/persistent
8 | value: true
9 | - key: capabilities/storage/1/class
10 | value: default
11 | - key: capabilities/storage/2/persistent
12 | value: true
13 | - key: capabilities/storage/2/class
14 | value: beta2
15 |
--------------------------------------------------------------------------------
/_run/ssh/test.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | xmrig:
6 | image: cryptoandcoffee/akash-xmrig:1
7 | expose:
8 | - port: 8080
9 | as: 80
10 | proto: tcp
11 | to:
12 | - global: true
13 | env:
14 | - "WALLET=solo:4AbG74FRUHYXBLkvqM1f7QH3UXGkhLetKdxS7U7BHkyfMF4nfx99GvN1REwYQHAeVLLy4Qa5gXXkfS4pSHHUWwdVFifDo5K"
15 | - "POOL=pool.hashvault.pro:80"
16 | - "RANDOMX_MODE=auto" #accepts auto-fast-light
17 | - "RANDOMX_1GB=true"
18 | - "TLS=true" #If supported by pool
19 | - "TLS_FINGERPRINT=420c7850e09b7c0bdcf748a7da9eb3647daf8515718f36d9ccfdd6b9ff834b14" #Can be blank
20 | profiles:
21 | compute:
22 | xmrig:
23 | resources:
24 | cpu:
25 | units: 6
26 | memory:
27 | size: 1Gi
28 | storage:
29 | size: 128Mi
30 | placement:
31 | akash:
32 | pricing:
33 | xmrig:
34 | denom: uakt
35 | amount: 10000000
36 | deployment:
37 | xmrig:
38 | akash:
39 | profile: xmrig
40 | count: 6
41 |
--------------------------------------------------------------------------------
/bidengine/config.go:
--------------------------------------------------------------------------------
1 | package bidengine
2 |
3 | import (
4 | "time"
5 |
6 | sdk "github.com/cosmos/cosmos-sdk/types"
7 |
8 | types "github.com/akash-network/akash-api/go/node/types/v1beta3"
9 | )
10 |
11 | type Config struct {
12 | PricingStrategy BidPricingStrategy
13 | Deposit sdk.Coin
14 | BidTimeout time.Duration
15 | Attributes types.Attributes
16 | MaxGroupVolumes int
17 | }
18 |
--------------------------------------------------------------------------------
/bidengine/types.go:
--------------------------------------------------------------------------------
1 | package bidengine
2 |
--------------------------------------------------------------------------------
/client/client.go:
--------------------------------------------------------------------------------
1 | package client
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | "reflect"
7 |
8 | "golang.org/x/net/context"
9 |
10 | sdkclient "github.com/cosmos/cosmos-sdk/client"
11 |
12 | aclient "github.com/akash-network/akash-api/go/node/client"
13 | cltypes "github.com/akash-network/akash-api/go/node/client/types"
14 | "github.com/akash-network/akash-api/go/node/client/v1beta2"
15 | )
16 |
17 | var (
18 | ErrInvalidClient = errors.New("invalid client")
19 | )
20 |
21 | func DiscoverQueryClient(ctx context.Context, cctx sdkclient.Context) (v1beta2.QueryClient, error) {
22 | var cl v1beta2.QueryClient
23 | err := aclient.DiscoverQueryClient(ctx, cctx, func(i interface{}) error {
24 | var valid bool
25 |
26 | if cl, valid = i.(v1beta2.QueryClient); !valid {
27 | return fmt.Errorf("%w: expected %s, actual %s", ErrInvalidClient, reflect.TypeOf(cl), reflect.TypeOf(i))
28 | }
29 |
30 | return nil
31 | })
32 |
33 | if err != nil {
34 | return nil, err
35 | }
36 |
37 | return cl, nil
38 | }
39 |
40 | func DiscoverClient(ctx context.Context, cctx sdkclient.Context, opts ...cltypes.ClientOption) (v1beta2.Client, error) {
41 | var cl v1beta2.Client
42 |
43 | setupFn := func(i interface{}) error {
44 | var valid bool
45 |
46 | if cl, valid = i.(v1beta2.Client); !valid {
47 | return fmt.Errorf("%w: expected %s, actual %s", ErrInvalidClient, reflect.TypeOf(cl), reflect.TypeOf(i))
48 | }
49 |
50 | return nil
51 | }
52 |
53 | err := aclient.DiscoverClient(ctx, cctx, setupFn, opts...)
54 |
55 | if err != nil {
56 | return nil, err
57 | }
58 |
59 | return cl, nil
60 | }
61 |
--------------------------------------------------------------------------------
/cluster/config.go:
--------------------------------------------------------------------------------
1 | package cluster
2 |
3 | import "time"
4 |
5 | type Config struct {
6 | InventoryResourcePollPeriod time.Duration
7 | InventoryResourceDebugFrequency uint
8 | InventoryExternalPortQuantity uint
9 | CPUCommitLevel float64
10 | GPUCommitLevel float64
11 | MemoryCommitLevel float64
12 | StorageCommitLevel float64
13 | BlockedHostnames []string
14 | DeploymentIngressStaticHosts bool
15 | DeploymentIngressDomain string
16 | MonitorMaxRetries uint
17 | MonitorRetryPeriod time.Duration
18 | MonitorRetryPeriodJitter time.Duration
19 | MonitorHealthcheckPeriod time.Duration
20 | MonitorHealthcheckPeriodJitter time.Duration
21 | ClusterSettings map[interface{}]interface{}
22 | }
23 |
24 | func NewDefaultConfig() Config {
25 | return Config{
26 | InventoryResourcePollPeriod: time.Second * 5,
27 | InventoryResourceDebugFrequency: 10,
28 | MonitorMaxRetries: 40,
29 | MonitorRetryPeriod: time.Second * 4, // nolint revive
30 | MonitorRetryPeriodJitter: time.Second * 15,
31 | MonitorHealthcheckPeriod: time.Second * 10, // nolint revive
32 | MonitorHealthcheckPeriodJitter: time.Second * 5,
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/cluster/kube/builder/manifest.go:
--------------------------------------------------------------------------------
1 | package builder
2 |
3 | import (
4 | "github.com/tendermint/tendermint/libs/log"
5 |
6 | crd "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2"
7 | )
8 |
9 | type Manifest interface {
10 | builderBase
11 | Create() (*crd.Manifest, error)
12 | Update(obj *crd.Manifest) (*crd.Manifest, error)
13 | Name() string
14 | }
15 |
16 | // manifest composes the k8s akashv1.Manifest type from LeaseID and
17 | // manifest.Group data.
18 | type manifest struct {
19 | builder
20 | mns string
21 | }
22 |
23 | var _ Manifest = (*manifest)(nil)
24 |
25 | func BuildManifest(log log.Logger, settings Settings, ns string, deployment IClusterDeployment) Manifest {
26 | return &manifest{
27 | builder: builder{
28 | log: log.With("module", "kube-builder"),
29 | settings: settings,
30 | deployment: deployment,
31 | },
32 | mns: ns,
33 | }
34 | }
35 |
36 | func (b *manifest) labels() map[string]string {
37 | return AppendLeaseLabels(b.deployment.LeaseID(), b.builder.labels())
38 | }
39 |
40 | func (b *manifest) Create() (*crd.Manifest, error) {
41 | obj, err := crd.NewManifest(b.mns, b.deployment.LeaseID(), b.deployment.ManifestGroup(), b.deployment.ClusterParams())
42 |
43 | if err != nil {
44 | return nil, err
45 | }
46 | obj.Labels = b.labels()
47 | return obj, nil
48 | }
49 |
50 | func (b *manifest) Update(obj *crd.Manifest) (*crd.Manifest, error) {
51 | m, err := crd.NewManifest(b.mns, b.deployment.LeaseID(), b.deployment.ManifestGroup(), b.deployment.ClusterParams())
52 | if err != nil {
53 | return nil, err
54 | }
55 |
56 | uobj := obj.DeepCopy()
57 |
58 | uobj.Spec = m.Spec
59 | uobj.Labels = b.labels()
60 |
61 | return uobj, nil
62 | }
63 |
64 | func (b *manifest) NS() string {
65 | return b.mns
66 | }
67 |
--------------------------------------------------------------------------------
/cluster/kube/builder/namespace.go:
--------------------------------------------------------------------------------
1 | package builder
2 |
3 | import (
4 | corev1 "k8s.io/api/core/v1"
5 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6 | )
7 |
8 | type NS interface {
9 | builderBase
10 | Create() (*corev1.Namespace, error)
11 | Update(obj *corev1.Namespace) (*corev1.Namespace, error)
12 | }
13 |
14 | type ns struct {
15 | builder
16 | }
17 |
18 | var _ NS = (*ns)(nil)
19 |
20 | func BuildNS(settings Settings, deployment IClusterDeployment) NS {
21 | return &ns{builder: builder{settings: settings, deployment: deployment}}
22 | }
23 |
24 | func (b *ns) labels() map[string]string {
25 | return AppendLeaseLabels(b.deployment.LeaseID(), b.builder.labels())
26 | }
27 |
28 | func (b *ns) Create() (*corev1.Namespace, error) { // nolint:golint,unparam
29 | return &corev1.Namespace{
30 | ObjectMeta: metav1.ObjectMeta{
31 | Name: b.NS(),
32 | Labels: b.labels(),
33 | },
34 | }, nil
35 | }
36 |
37 | func (b *ns) Update(obj *corev1.Namespace) (*corev1.Namespace, error) { // nolint:golint,unparam
38 | uobj := obj.DeepCopy()
39 |
40 | uobj.Name = b.NS()
41 | uobj.Labels = updateAkashLabels(obj.Labels, b.labels())
42 |
43 | return uobj, nil
44 | }
45 |
--------------------------------------------------------------------------------
/cluster/kube/client_common.go:
--------------------------------------------------------------------------------
1 | package kube
2 |
--------------------------------------------------------------------------------
/cluster/kube/errors/errors.go:
--------------------------------------------------------------------------------
1 | package errors
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | )
7 |
8 | var (
9 | ErrKubeClient = errors.New("kube")
10 | ErrInternalError = fmt.Errorf("%w: internal error", ErrKubeClient)
11 | ErrLeaseNotFound = fmt.Errorf("%w: lease not found", ErrKubeClient)
12 | ErrNoDeploymentForLease = fmt.Errorf("%w: no deployments for lease", ErrKubeClient)
13 | ErrNoManifestForLease = fmt.Errorf("%w: no manifest for lease", ErrKubeClient)
14 | ErrNoServiceForLease = fmt.Errorf("%w: no service for that lease", ErrKubeClient)
15 | ErrInvalidHostnameConnection = fmt.Errorf("%w: invalid hostname connection", ErrKubeClient)
16 | ErrNotConfiguredWithSettings = fmt.Errorf("%w: not configured with settings in the context passed to function", ErrKubeClient)
17 | ErrAlreadyExists = fmt.Errorf("%w: resource already exists", ErrKubeClient)
18 | )
19 |
--------------------------------------------------------------------------------
/cluster/kube/operators/clients/hostname/client_test.go:
--------------------------------------------------------------------------------
1 | package hostname
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func TestHostnameOperatorClient(_ *testing.T) {
8 | // TODO: tests here
9 | }
10 |
--------------------------------------------------------------------------------
/cluster/kube/operators/deploy/deploy.go:
--------------------------------------------------------------------------------
1 | package deploy
2 |
--------------------------------------------------------------------------------
/cluster/kube/types/v1beta0/types.go:
--------------------------------------------------------------------------------
1 | package v1beta2
2 |
3 | import (
4 | "crypto/sha256"
5 | "encoding/base32"
6 | "strings"
7 |
8 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta2"
9 | )
10 |
11 | // LeaseIDToNamespace generates a unique sha256 sum for identifying a provider's object name.
12 | func LeaseIDToNamespace(lid mtypes.LeaseID) string {
13 | path := lid.String()
14 | // DNS-1123 label must consist of lower case alphanumeric characters or '-',
15 | // and must start and end with an alphanumeric character
16 | // (e.g. 'my-name', or '123-abc', regex used for validation
17 | // is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')
18 | sha := sha256.Sum224([]byte(path))
19 | return strings.ToLower(base32.HexEncoding.WithPadding(base32.NoPadding).EncodeToString(sha[:]))
20 | }
21 |
--------------------------------------------------------------------------------
/cluster/kube/types/v1beta1/types.go:
--------------------------------------------------------------------------------
1 | package v1beta2
2 |
3 | import (
4 | "crypto/sha256"
5 | "encoding/base32"
6 | "strings"
7 |
8 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta3"
9 | )
10 |
11 | // LeaseIDToNamespace generates a unique sha256 sum for identifying a provider's object name.
12 | func LeaseIDToNamespace(lid mtypes.LeaseID) string {
13 | path := lid.String()
14 | // DNS-1123 label must consist of lower case alphanumeric characters or '-',
15 | // and must start and end with an alphanumeric character
16 | // (e.g. 'my-name', or '123-abc', regex used for validation
17 | // is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')
18 | sha := sha256.Sum224([]byte(path))
19 | return strings.ToLower(base32.HexEncoding.WithPadding(base32.NoPadding).EncodeToString(sha[:]))
20 | }
21 |
--------------------------------------------------------------------------------
/cluster/kube/types/v1beta2/types.go:
--------------------------------------------------------------------------------
1 | package v1beta2
2 |
3 | import (
4 | "crypto/sha256"
5 | "encoding/base32"
6 | "strings"
7 |
8 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
9 | )
10 |
11 | // LeaseIDToNamespace generates a unique sha256 sum for identifying a provider's object name.
12 | func LeaseIDToNamespace(lid mtypes.LeaseID) string {
13 | path := lid.String()
14 | // DNS-1123 label must consist of lower case alphanumeric characters or '-',
15 | // and must start and end with an alphanumeric character
16 | // (e.g. 'my-name', or '123-abc', regex used for validation
17 | // is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')
18 | sha := sha256.Sum224([]byte(path))
19 | return strings.ToLower(base32.HexEncoding.WithPadding(base32.NoPadding).EncodeToString(sha[:]))
20 | }
21 |
--------------------------------------------------------------------------------
/cluster/kube/util/check_inside_kubernetes.go:
--------------------------------------------------------------------------------
1 | package util
2 |
3 | import (
4 | "os"
5 | )
6 |
7 | const (
8 | kubeSecretPath = "/var/run/secrets/kubernetes.io" // nolint:gosec
9 | )
10 |
11 | var insideKubernetes bool
12 |
13 | func init() {
14 | _, err := os.Stat(kubeSecretPath)
15 |
16 | insideKubernetes = err == nil
17 | }
18 |
19 | func IsInsideKubernetes() bool {
20 | return insideKubernetes
21 | }
22 |
--------------------------------------------------------------------------------
/cluster/reservation.go:
--------------------------------------------------------------------------------
1 | package cluster
2 |
3 | import (
4 | dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3"
5 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
6 | atypes "github.com/akash-network/akash-api/go/node/types/v1beta3"
7 |
8 | ctypes "github.com/akash-network/provider/cluster/types/v1beta3"
9 | "github.com/akash-network/provider/cluster/util"
10 | )
11 |
12 | func newReservation(order mtypes.OrderID, resources dtypes.ResourceGroup) *reservation {
13 | return &reservation{
14 | order: order,
15 | resources: resources,
16 | endpointQuantity: util.GetEndpointQuantityOfResourceGroup(resources, atypes.Endpoint_LEASED_IP)}
17 | }
18 |
19 | type reservation struct {
20 | order mtypes.OrderID
21 | resources dtypes.ResourceGroup
22 | adjustedResources dtypes.ResourceUnits
23 | clusterParams interface{}
24 | endpointQuantity uint
25 | allocated bool
26 | ipsConfirmed bool
27 | }
28 |
29 | var _ ctypes.Reservation = (*reservation)(nil)
30 |
31 | func (r *reservation) OrderID() mtypes.OrderID {
32 | return r.order
33 | }
34 |
35 | func (r *reservation) Resources() dtypes.ResourceGroup {
36 | return r.resources
37 | }
38 |
39 | func (r *reservation) SetAllocatedResources(val dtypes.ResourceUnits) {
40 | r.adjustedResources = val
41 | }
42 |
43 | func (r *reservation) GetAllocatedResources() dtypes.ResourceUnits {
44 | return r.adjustedResources
45 | }
46 |
47 | func (r *reservation) SetClusterParams(val interface{}) {
48 | r.clusterParams = val
49 | }
50 |
51 | func (r *reservation) ClusterParams() interface{} {
52 | return r.clusterParams
53 | }
54 |
55 | func (r *reservation) Allocated() bool {
56 | return r.allocated
57 | }
58 |
--------------------------------------------------------------------------------
/cluster/types/v1beta2/directives.go:
--------------------------------------------------------------------------------
1 | package v1beta2
2 |
3 | import (
4 | manifest "github.com/akash-network/akash-api/go/manifest/v2beta1"
5 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta2"
6 | )
7 |
8 | type ConnectHostnameToDeploymentDirective struct {
9 | Hostname string
10 | LeaseID mtypes.LeaseID
11 | ServiceName string
12 | ServicePort int32
13 | ReadTimeout uint32
14 | SendTimeout uint32
15 | NextTimeout uint32
16 | MaxBodySize uint32
17 | NextTries uint32
18 | NextCases []string
19 | }
20 |
21 | type ClusterIPPassthroughDirective struct {
22 | LeaseID mtypes.LeaseID
23 | ServiceName string
24 | Port uint32
25 | ExternalPort uint32
26 | SharingKey string
27 | Protocol manifest.ServiceProtocol
28 | }
29 |
--------------------------------------------------------------------------------
/cluster/types/v1beta2/hostname.go:
--------------------------------------------------------------------------------
1 | package v1beta2
2 |
3 | import (
4 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta2"
5 | )
6 |
7 | type LeaseIDHostnameConnection interface {
8 | GetLeaseID() mtypes.LeaseID
9 | GetHostname() string
10 | GetExternalPort() int32
11 | GetServiceName() string
12 | }
13 |
14 | type ActiveHostname struct {
15 | ID mtypes.LeaseID
16 | Hostname string
17 | }
18 |
19 | type ProviderResourceEvent string
20 |
21 | const (
22 | ProviderResourceAdd = ProviderResourceEvent("add")
23 | ProviderResourceUpdate = ProviderResourceEvent("update")
24 | ProviderResourceDelete = ProviderResourceEvent("delete")
25 | )
26 |
27 | type HostnameResourceEvent interface {
28 | GetLeaseID() mtypes.LeaseID
29 | GetEventType() ProviderResourceEvent
30 | GetHostname() string
31 | GetServiceName() string
32 | GetExternalPort() uint32
33 | }
34 |
--------------------------------------------------------------------------------
/cluster/types/v1beta2/interfaces.go:
--------------------------------------------------------------------------------
1 | package v1beta2
2 |
3 | import (
4 | "context"
5 |
6 | sdktypes "github.com/cosmos/cosmos-sdk/types"
7 |
8 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta2"
9 | )
10 |
11 | type HostnameServiceClient interface {
12 | ReserveHostnames(ctx context.Context, hostnames []string, leaseID mtypes.LeaseID) ([]string, error)
13 | ReleaseHostnames(leaseID mtypes.LeaseID) error
14 | CanReserveHostnames(hostnames []string, ownerAddr sdktypes.Address) error
15 | PrepareHostnamesForTransfer(ctx context.Context, hostnames []string, leaseID mtypes.LeaseID) error
16 | }
17 |
--------------------------------------------------------------------------------
/cluster/types/v1beta2/ip.go:
--------------------------------------------------------------------------------
1 | package v1beta2
2 |
3 | import (
4 | manifest "github.com/akash-network/akash-api/go/manifest/v2beta1"
5 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta2"
6 | )
7 |
8 | type IPResourceEvent interface {
9 | GetLeaseID() mtypes.LeaseID
10 | GetServiceName() string
11 | GetExternalPort() uint32
12 | GetPort() uint32
13 | GetSharingKey() string
14 | GetProtocol() manifest.ServiceProtocol
15 | GetEventType() ProviderResourceEvent
16 | }
17 |
18 | type IPPassthrough interface {
19 | GetLeaseID() mtypes.LeaseID
20 | GetServiceName() string
21 | GetExternalPort() uint32
22 | GetPort() uint32
23 | GetSharingKey() string
24 | GetProtocol() manifest.ServiceProtocol
25 | }
26 |
27 | type IPLeaseState interface {
28 | IPPassthrough
29 | GetIP() string
30 | }
31 |
--------------------------------------------------------------------------------
/cluster/types/v1beta2/reservation.go:
--------------------------------------------------------------------------------
1 | package v1beta2
2 |
3 | import (
4 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta2"
5 | atypes "github.com/akash-network/akash-api/go/node/types/v1beta2"
6 | )
7 |
8 | // Reservation interface implements orders and resources
9 | type Reservation interface {
10 | OrderID() mtypes.OrderID
11 | Resources() atypes.ResourceGroup
12 | Allocated() bool
13 | }
14 |
--------------------------------------------------------------------------------
/cluster/types/v1beta3/clients/hostname/hostname.go:
--------------------------------------------------------------------------------
1 | package hostname
2 |
3 | import (
4 | "context"
5 |
6 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
7 |
8 | ctypes "github.com/akash-network/provider/cluster/types/v1beta3"
9 | )
10 |
11 | type LeaseIDConnection interface {
12 | GetLeaseID() mtypes.LeaseID
13 | GetHostname() string
14 | GetExternalPort() int32
15 | GetServiceName() string
16 | }
17 |
18 | type ResourceEvent interface {
19 | GetLeaseID() mtypes.LeaseID
20 | GetEventType() ctypes.ProviderResourceEvent
21 | GetHostname() string
22 | GetServiceName() string
23 | GetExternalPort() uint32
24 | }
25 |
26 | type Client interface {
27 | Check(ctx context.Context) error
28 | String() string
29 | Stop()
30 | }
31 |
32 | type ActiveHostname struct {
33 | ID mtypes.LeaseID
34 | Hostname string
35 | }
36 |
37 | type ConnectToDeploymentDirective struct {
38 | Hostname string
39 | LeaseID mtypes.LeaseID
40 | ServiceName string
41 | ServicePort int32
42 | ReadTimeout uint32
43 | SendTimeout uint32
44 | NextTimeout uint32
45 | MaxBodySize uint32
46 | NextTries uint32
47 | NextCases []string
48 | }
49 |
--------------------------------------------------------------------------------
/cluster/types/v1beta3/deployment.go:
--------------------------------------------------------------------------------
1 | package v1beta3
2 |
3 | import (
4 | maniv2beta2 "github.com/akash-network/akash-api/go/manifest/v2beta2"
5 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
6 | )
7 |
8 | // IDeployment interface defined with LeaseID and ManifestGroup methods
9 | //
10 | //go:generate mockery --name IDeployment --output ./mocks
11 | type IDeployment interface {
12 | LeaseID() mtypes.LeaseID
13 | ManifestGroup() *maniv2beta2.Group
14 | ClusterParams() interface{}
15 | ResourceVersion() string
16 | }
17 |
18 | type Deployment struct {
19 | Lid mtypes.LeaseID
20 | MGroup *maniv2beta2.Group
21 | CParams interface{}
22 | ResourceVer string
23 | }
24 |
25 | var _ IDeployment = (*Deployment)(nil)
26 |
27 | func (d *Deployment) LeaseID() mtypes.LeaseID {
28 | return d.Lid
29 | }
30 |
31 | func (d *Deployment) ManifestGroup() *maniv2beta2.Group {
32 | return d.MGroup
33 | }
34 |
35 | func (d *Deployment) ClusterParams() interface{} {
36 | return d.CParams
37 | }
38 |
39 | func (d *Deployment) ResourceVersion() string {
40 | return d.ResourceVer
41 | }
42 |
--------------------------------------------------------------------------------
/cluster/types/v1beta3/fromctx/context.go:
--------------------------------------------------------------------------------
1 | package fromctx
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/akash-network/provider/cluster/types/v1beta3/clients/hostname"
7 | "github.com/akash-network/provider/cluster/types/v1beta3/clients/inventory"
8 | "github.com/akash-network/provider/cluster/types/v1beta3/clients/ip"
9 | )
10 |
11 | type CtxKey string
12 |
13 | const (
14 | CtxKeyClientIP = CtxKey("client-ip")
15 | CtxKeyClientHostname = CtxKey("client-hostname")
16 | CtxKeyClientInventory = CtxKey("client-inventory")
17 | )
18 |
19 | func ClientIPFromContext(ctx context.Context) ip.Client {
20 | var res ip.Client
21 |
22 | val := ctx.Value(CtxKeyClientIP)
23 | if val == nil {
24 | return nil
25 | }
26 |
27 | res = val.(ip.Client)
28 | return res
29 | }
30 |
31 | func ClientHostnameFromContext(ctx context.Context) hostname.Client {
32 | var res hostname.Client
33 |
34 | val := ctx.Value(CtxKeyClientHostname)
35 | if val == nil {
36 | return res
37 | }
38 |
39 | res = val.(hostname.Client)
40 | return res
41 | }
42 |
43 | func ClientInventoryFromContext(ctx context.Context) inventory.Client {
44 | var res inventory.Client
45 |
46 | val := ctx.Value(CtxKeyClientInventory)
47 | if val == nil {
48 | return res
49 | }
50 |
51 | res = val.(inventory.Client)
52 | return res
53 | }
54 |
--------------------------------------------------------------------------------
/cluster/types/v1beta3/interfaces.go:
--------------------------------------------------------------------------------
1 | package v1beta3
2 |
3 | import (
4 | mani "github.com/akash-network/akash-api/go/manifest/v2beta2"
5 | )
6 |
7 | type MGroup interface {
8 | ManifestGroup() mani.Group
9 | }
10 |
--------------------------------------------------------------------------------
/cluster/types/v1beta3/reservation.go:
--------------------------------------------------------------------------------
1 | package v1beta3
2 |
3 | import (
4 | dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3"
5 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
6 | )
7 |
8 | //go:generate mockery --name ReservationGroup --output ./mocks
9 | type ReservationGroup interface {
10 | Resources() dtypes.ResourceGroup
11 | SetAllocatedResources(dtypes.ResourceUnits)
12 | GetAllocatedResources() dtypes.ResourceUnits
13 | SetClusterParams(interface{})
14 | ClusterParams() interface{}
15 | }
16 |
17 | // Reservation interface implements orders and resources
18 | //
19 | //go:generate mockery --name Reservation --output ./mocks
20 | type Reservation interface {
21 | OrderID() mtypes.OrderID
22 | Allocated() bool
23 | ReservationGroup
24 | }
25 |
--------------------------------------------------------------------------------
/cluster/util/endpoint_quantity.go:
--------------------------------------------------------------------------------
1 | package util
2 |
3 | import (
4 | dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3"
5 | atypes "github.com/akash-network/akash-api/go/node/types/v1beta3"
6 | )
7 |
8 | func GetEndpointQuantityOfResourceGroup(resources dtypes.ResourceGroup, kind atypes.Endpoint_Kind) uint {
9 | endpoints := make(map[uint32]struct{})
10 | for _, resource := range resources.GetResourceUnits() {
11 | accumEndpointsOfResources(resource.Resources, kind, endpoints)
12 |
13 | }
14 | return uint(len(endpoints))
15 | }
16 |
17 | func accumEndpointsOfResources(r atypes.Resources, kind atypes.Endpoint_Kind, accum map[uint32]struct{}) {
18 | for _, endpoint := range r.Endpoints {
19 | if endpoint.Kind == kind {
20 | accum[endpoint.SequenceNumber] = struct{}{}
21 | }
22 | }
23 | }
24 |
25 | func GetEndpointQuantityOfResourceUnits(r atypes.Resources, kind atypes.Endpoint_Kind) uint {
26 | endpoints := make(map[uint32]struct{})
27 | accumEndpointsOfResources(r, kind, endpoints)
28 |
29 | return uint(len(endpoints))
30 | }
31 |
--------------------------------------------------------------------------------
/cluster/util/ip_sharing_key.go:
--------------------------------------------------------------------------------
1 | package util
2 |
3 | import (
4 | "crypto/sha256"
5 | "encoding/base32"
6 | "fmt"
7 | "io"
8 | "regexp"
9 | "strings"
10 |
11 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
12 | )
13 |
14 | var allowedIPEndpointNameRegex = regexp.MustCompile(`^[a-z\d\-]+$`)
15 |
16 | func MakeIPSharingKey(lID mtypes.LeaseID, endpointName string) string {
17 | effectiveName := endpointName
18 | if !allowedIPEndpointNameRegex.MatchString(endpointName) {
19 | h := sha256.New()
20 | _, err := io.WriteString(h, endpointName)
21 | if err != nil {
22 | panic(err)
23 |
24 | }
25 | effectiveName = strings.ToLower(base32.HexEncoding.WithPadding(base32.NoPadding).EncodeToString(h.Sum(nil)[0:15]))
26 | }
27 | return fmt.Sprintf("%s-ip-%s", lID.GetOwner(), effectiveName)
28 | }
29 |
--------------------------------------------------------------------------------
/cluster/util/ip_sharing_key_test.go:
--------------------------------------------------------------------------------
1 | package util_test
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/akash-network/node/testutil"
7 | "github.com/stretchr/testify/require"
8 |
9 | "github.com/akash-network/provider/cluster/util"
10 | )
11 |
12 | func TestPassesThroughNames(t *testing.T) {
13 | leaseID := testutil.LeaseID(t)
14 |
15 | sharingKey := util.MakeIPSharingKey(leaseID, "foobar")
16 | require.Contains(t, sharingKey, "foobar")
17 | }
18 |
19 | func TestFiltersUnderscore(t *testing.T) {
20 | leaseID := testutil.LeaseID(t)
21 |
22 | sharingKey := util.MakeIPSharingKey(leaseID, "me_you")
23 | require.NotContains(t, sharingKey, "me_you")
24 | }
25 |
26 | func TestFiltersUppercase(t *testing.T) {
27 | leaseID := testutil.LeaseID(t)
28 |
29 | sharingKey := util.MakeIPSharingKey(leaseID, "meYOU")
30 | require.NotContains(t, sharingKey, "meYOU")
31 |
32 | require.Equal(t, sharingKey, leaseID.GetOwner()+"-ip-ps9pn7rkocct7m9ivtovuktb")
33 | }
34 |
--------------------------------------------------------------------------------
/cluster/util/lease_id_to_namespace.go:
--------------------------------------------------------------------------------
1 | package util
2 |
3 | import (
4 | "crypto/sha256"
5 | "encoding/base32"
6 | "strings"
7 |
8 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
9 | )
10 |
11 | // LeaseIDToNamespace generates a unique sha256 sum for identifying a provider's object name.
12 | func LeaseIDToNamespace(lid mtypes.LeaseID) string {
13 | path := lid.String()
14 | // DNS-1123 label must consist of lower case alphanumeric characters or '-',
15 | // and must start and end with an alphanumeric character
16 | // (e.g. 'my-name', or '123-abc', regex used for validation
17 | // is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')
18 | sha := sha256.Sum224([]byte(path))
19 | return strings.ToLower(base32.HexEncoding.WithPadding(base32.NoPadding).EncodeToString(sha[:]))
20 | }
21 |
--------------------------------------------------------------------------------
/cluster/util/service_discovery_agent_static.go:
--------------------------------------------------------------------------------
1 | package util
2 |
3 | import (
4 | "context"
5 | "fmt"
6 | "net"
7 | )
8 |
9 | // A type that does nothing but return a result that is already existent
10 | type staticServiceDiscoveryAgent net.SRV
11 |
12 | func (staticServiceDiscoveryAgent) Stop() {}
13 | func (staticServiceDiscoveryAgent) DiscoverNow() {}
14 | func (ssda staticServiceDiscoveryAgent) GetClient(_ context.Context, isHTTPS, secure bool) (ServiceClient, error) {
15 | proto := "http"
16 | if isHTTPS {
17 | proto = "https"
18 | }
19 | url := fmt.Sprintf("%s://%v:%v", proto, ssda.Target, ssda.Port)
20 | return newHTTPWrapperServiceClient(isHTTPS, secure, url), nil
21 | }
22 |
--------------------------------------------------------------------------------
/cluster/util/service_discovery_agent_types.go:
--------------------------------------------------------------------------------
1 | package util
2 |
3 | import (
4 | "context"
5 | "io"
6 | "net/http"
7 |
8 | "github.com/boz/go-lifecycle"
9 | "github.com/tendermint/tendermint/libs/log"
10 | )
11 |
12 | type ServiceDiscoveryAgent interface {
13 | Stop()
14 | GetClient(ctx context.Context, isHTTPS, secure bool) (ServiceClient, error)
15 | DiscoverNow()
16 | }
17 |
18 | type ServiceClient interface {
19 | CreateRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error)
20 | DoRequest(req *http.Request) (*http.Response, error)
21 | }
22 |
23 | type serviceDiscoveryAgent struct {
24 | ctx context.Context
25 | serviceName string
26 | namespace string
27 | portName string
28 | lc lifecycle.Lifecycle
29 |
30 | discoverch chan struct{}
31 |
32 | requests chan serviceDiscoveryRequest
33 | pendingRequests []serviceDiscoveryRequest
34 | result clientFactory
35 | log log.Logger
36 | }
37 |
38 | type serviceDiscoveryRequest struct {
39 | errCh chan<- error
40 | resultCh chan<- clientFactory
41 | }
42 |
43 | type clientFactory func(isHttps, secure bool) ServiceClient
44 |
45 | type httpWrapperServiceClient struct {
46 | httpClient *http.Client
47 | url string
48 | }
49 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/clusterns.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "fmt"
5 |
6 | mcli "github.com/akash-network/node/x/market/client/cli"
7 | "github.com/spf13/cobra"
8 |
9 | cutil "github.com/akash-network/provider/cluster/util"
10 | )
11 |
12 | func clusterNSCmd() *cobra.Command {
13 | cmd := &cobra.Command{
14 | Use: "show-cluster-ns",
15 | Aliases: []string{"cluster-ns"},
16 | Short: "print cluster namespace for given lease ID",
17 | Args: cobra.ExactArgs(0),
18 | SilenceUsage: true,
19 | RunE: func(cmd *cobra.Command, _ []string) error {
20 | lid, err := mcli.LeaseIDFromFlags(cmd.Flags())
21 | if err != nil {
22 | return err
23 | }
24 | fmt.Println(cutil.LeaseIDToNamespace(lid))
25 | return nil
26 | },
27 | }
28 | mcli.AddLeaseIDFlags(cmd.Flags())
29 | mcli.MarkReqLeaseIDFlags(cmd)
30 | return cmd
31 | }
32 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/flags/flags.go:
--------------------------------------------------------------------------------
1 | package flags
2 |
3 | const (
4 | FlagK8sManifestNS = "k8s-manifest-ns"
5 |
6 | FlagListenAddress = "listen"
7 | FlagPruneInterval = "prune-interval"
8 |
9 | FlagWebRefreshInterval = "web-refresh-interval"
10 | FlagRetryDelay = "retry-delay"
11 |
12 | FlagKubeConfig = "kubeconfig"
13 | )
14 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/flags/kube_config.go:
--------------------------------------------------------------------------------
1 | package flags
2 |
3 | import (
4 | "github.com/spf13/cobra"
5 | "github.com/spf13/viper"
6 | )
7 |
8 | const (
9 | KubeConfigDefaultPath = "$HOME/.kube/config"
10 | )
11 |
12 | func AddKubeConfigPathFlag(cmd *cobra.Command) error {
13 | cmd.PersistentFlags().String(FlagKubeConfig, "$HOME/.kube/config", "kubernetes configuration file path")
14 | if err := viper.BindEnv(FlagKubeConfig, "KUBECONFIG"); err != nil {
15 | return err
16 | }
17 |
18 | return viper.BindPFlag(FlagKubeConfig, cmd.PersistentFlags().Lookup(FlagKubeConfig))
19 | }
20 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/helpers_test.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "bytes"
5 | "encoding/json"
6 | "fmt"
7 | "net/url"
8 | "testing"
9 |
10 | "github.com/pkg/errors"
11 | "github.com/stretchr/testify/require"
12 | )
13 |
14 | var expectedErrMsgForRPC = "^error communicating with RPC.+$"
15 |
16 | func TestUnwrappingRPCJSONError(t *testing.T) {
17 | buf := &bytes.Buffer{}
18 | buf.WriteString("{foo:bar}") // some invalid json
19 | dec := json.NewDecoder(buf)
20 | var x interface{}
21 | err := dec.Decode(&x)
22 | require.Error(t, err)
23 | require.IsType(t, &json.SyntaxError{}, err)
24 |
25 | wrappedErr := fmt.Errorf("%w: test error", err)
26 | err = markRPCServerError(wrappedErr)
27 | require.Error(t, err)
28 | require.Regexp(t, expectedErrMsgForRPC, err)
29 | }
30 |
31 | func TestUnwrappingURLError(t *testing.T) {
32 | urlErr := &url.Error{
33 | Op: "GET",
34 | URL: "a",
35 | Err: errors.New("test error thing"),
36 | }
37 | require.Error(t, urlErr)
38 |
39 | wrappedErr := fmt.Errorf("%w: test error", urlErr)
40 | err := markRPCServerError(wrappedErr)
41 | require.Error(t, err)
42 | require.Regexp(t, expectedErrMsgForRPC, err)
43 | }
44 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/metrics.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "github.com/gorilla/mux"
5 | "github.com/prometheus/client_golang/prometheus"
6 | "github.com/prometheus/client_golang/prometheus/promhttp"
7 | )
8 |
9 | func makeMetricsRouter() *mux.Router {
10 | router := mux.NewRouter()
11 | router.Handle("/metrics", promhttp.HandlerFor(
12 | prometheus.DefaultGatherer,
13 | promhttp.HandlerOpts{
14 | // Opt into OpenMetrics to support exemplars.
15 | EnableOpenMetrics: true,
16 | },
17 | ))
18 |
19 | return router
20 | }
21 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/migrate.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "github.com/spf13/cobra"
5 | )
6 |
7 | func migrate() *cobra.Command {
8 | cmd := &cobra.Command{
9 | Use: "migrate",
10 | }
11 |
12 | return cmd
13 | }
14 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/sdl-to-manifest.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 |
7 | "github.com/spf13/cobra"
8 | "gopkg.in/yaml.v3"
9 |
10 | "github.com/akash-network/node/sdl"
11 | )
12 |
13 | // SDL2ManifestCmd dump manifest into stdout
14 | func SDL2ManifestCmd() *cobra.Command {
15 | cmd := &cobra.Command{
16 | Use: "sdl-to-manifest ",
17 | Args: cobra.ExactArgs(1),
18 | Short: "Dump manifest derived from the SDL",
19 | SilenceUsage: true,
20 | PreRunE: func(cmd *cobra.Command, _ []string) error {
21 | format := cmd.Flag(flagOutput).Value.String()
22 | switch format {
23 | case outputJSON:
24 | case outputYAML:
25 | default:
26 | return fmt.Errorf("invalid output format \"%s\", expected json|yaml", format) // nolint: err113
27 | }
28 |
29 | return nil
30 | },
31 | RunE: func(cmd *cobra.Command, args []string) error {
32 | sdl, err := sdl.ReadFile(args[0])
33 | if err != nil {
34 | return err
35 | }
36 |
37 | mani, err := sdl.Manifest()
38 | if err != nil {
39 | return err
40 | }
41 |
42 | var data []byte
43 |
44 | switch cmd.Flag(flagOutput).Value.String() {
45 | case outputJSON:
46 | data, err = json.MarshalIndent(mani, "", " ")
47 | case outputYAML:
48 | data, err = yaml.Marshal(mani)
49 | }
50 |
51 | if err != nil {
52 | return err
53 | }
54 |
55 | fmt.Println(string(data))
56 |
57 | return nil
58 | },
59 | }
60 |
61 | cmd.Flags().StringP(flagOutput, "o", outputJSON, "output format json|yaml. default json")
62 |
63 | return cmd
64 | }
65 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/status.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | apclient "github.com/akash-network/akash-api/go/provider/client"
5 | sdkclient "github.com/cosmos/cosmos-sdk/client"
6 | sdk "github.com/cosmos/cosmos-sdk/types"
7 | "github.com/spf13/cobra"
8 |
9 | cmdcommon "github.com/akash-network/node/cmd/common"
10 |
11 | aclient "github.com/akash-network/provider/client"
12 | )
13 |
14 | func statusCmd() *cobra.Command {
15 | cmd := &cobra.Command{
16 | Use: "status [address]",
17 | Short: "get provider status",
18 | Args: cobra.ExactArgs(1),
19 | SilenceUsage: true,
20 | RunE: func(cmd *cobra.Command, args []string) error {
21 | addr, err := sdk.AccAddressFromBech32(args[0])
22 | if err != nil {
23 | return err
24 | }
25 |
26 | return doStatus(cmd, addr)
27 | },
28 | }
29 |
30 | return cmd
31 | }
32 |
33 | func doStatus(cmd *cobra.Command, addr sdk.Address) error {
34 | cctx, err := sdkclient.GetClientTxContext(cmd)
35 | if err != nil {
36 | return err
37 | }
38 |
39 | ctx := cmd.Context()
40 |
41 | cl, err := aclient.DiscoverQueryClient(ctx, cctx)
42 | if err != nil {
43 | return err
44 | }
45 |
46 | gclient, err := apclient.NewClient(ctx, cl, addr)
47 | if err != nil {
48 | return err
49 | }
50 |
51 | result, err := gclient.Status(cmd.Context())
52 | if err != nil {
53 | return showErrorToUser(err)
54 | }
55 |
56 | return cmdcommon.PrintJSON(cctx, result)
57 | }
58 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/test_helpers.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/cosmos/cosmos-sdk/client"
7 | sdktest "github.com/cosmos/cosmos-sdk/testutil"
8 |
9 | testutilcli "github.com/akash-network/node/testutil/cli"
10 | )
11 |
12 | func ProviderLeaseStatusExec(clientCtx client.Context, extraArgs ...string) (sdktest.BufferWriter, error) {
13 | return testutilcli.ExecTestCLICmd(context.Background(), clientCtx, leaseStatusCmd(), extraArgs...)
14 | }
15 |
16 | func ProviderServiceStatusExec(clientCtx client.Context, extraArgs ...string) (sdktest.BufferWriter, error) {
17 | return testutilcli.ExecTestCLICmd(context.Background(), clientCtx, serviceStatusCmd(), extraArgs...)
18 | }
19 |
20 | func ProviderStatusExec(clientCtx client.Context, extraArgs ...string) (sdktest.BufferWriter, error) {
21 | return testutilcli.ExecTestCLICmd(context.Background(), clientCtx, statusCmd(), extraArgs...)
22 | }
23 |
24 | func ProviderServiceLogs(clientCtx client.Context, extraArgs ...string) (sdktest.BufferWriter, error) {
25 | return testutilcli.ExecTestCLICmd(context.Background(), clientCtx, leaseLogsCmd(), extraArgs...)
26 | }
27 |
--------------------------------------------------------------------------------
/cmd/provider-services/cmd/util/util.go:
--------------------------------------------------------------------------------
1 | package util
2 |
3 | import (
4 | "os"
5 |
6 | "github.com/go-kit/kit/log/term" // nolint: staticcheck
7 | "github.com/tendermint/tendermint/libs/log"
8 | )
9 |
10 | func OpenLogger() log.Logger {
11 | // logger with no color output - current debug colors are invisible for me.
12 | return log.NewTMLoggerWithColorFn(log.NewSyncWriter(os.Stdout), func(_ ...interface{}) term.FgBgColor {
13 | return term.FgBgColor{}
14 | })
15 | }
16 |
--------------------------------------------------------------------------------
/cmd/provider-services/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "context"
5 | "errors"
6 | "os"
7 | "os/signal"
8 |
9 | "github.com/cosmos/cosmos-sdk/server"
10 |
11 | acmd "github.com/akash-network/node/cmd/akash/cmd"
12 |
13 | pcmd "github.com/akash-network/provider/cmd/provider-services/cmd"
14 | )
15 |
16 | func run() error {
17 | ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
18 | defer stop()
19 |
20 | rootCmd := pcmd.NewRootCmd()
21 |
22 | return acmd.ExecuteWithCtx(ctx, rootCmd, "AP")
23 | }
24 |
25 | func main() {
26 | err := run()
27 | if err != nil {
28 | if errors.As(err, &server.ErrorCode{}) {
29 | os.Exit(err.(server.ErrorCode).Code)
30 | }
31 |
32 | os.Exit(1)
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/config.go:
--------------------------------------------------------------------------------
1 | package provider
2 |
3 | import (
4 | "time"
5 |
6 | sdk "github.com/cosmos/cosmos-sdk/types"
7 |
8 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
9 | "github.com/akash-network/akash-api/go/node/types/constants"
10 | types "github.com/akash-network/akash-api/go/node/types/v1beta3"
11 |
12 | "github.com/akash-network/provider/bidengine"
13 | "github.com/akash-network/provider/cluster"
14 | )
15 |
16 | type Config struct {
17 | ClusterWaitReadyDuration time.Duration
18 | ClusterPublicHostname string
19 | ClusterExternalPortQuantity uint
20 | BidPricingStrategy bidengine.BidPricingStrategy
21 | BidDeposit sdk.Coin
22 | BidTimeout time.Duration
23 | ManifestTimeout time.Duration
24 | BalanceCheckerCfg BalanceCheckerConfig
25 | Attributes types.Attributes
26 | MaxGroupVolumes int
27 | RPCQueryTimeout time.Duration
28 | CachedResultMaxAge time.Duration
29 | cluster.Config
30 | }
31 |
32 | func NewDefaultConfig() Config {
33 | return Config{
34 | ClusterWaitReadyDuration: time.Second * 10,
35 | BidDeposit: mtypes.DefaultBidMinDeposit,
36 | BalanceCheckerCfg: BalanceCheckerConfig{
37 | LeaseFundsCheckInterval: 1 * time.Minute,
38 | WithdrawalPeriod: 24 * time.Hour,
39 | },
40 | MaxGroupVolumes: constants.DefaultMaxGroupVolumes,
41 | Config: cluster.NewDefaultConfig(),
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/gateway/rest/constants.go:
--------------------------------------------------------------------------------
1 | package rest
2 |
3 | const (
4 | LeaseShellCodeStdout = 100
5 | LeaseShellCodeStderr = 101
6 | LeaseShellCodeResult = 102
7 | LeaseShellCodeFailure = 103
8 | LeaseShellCodeStdin = 104
9 | LeaseShellCodeTerminalResize = 105
10 | )
11 |
--------------------------------------------------------------------------------
/gateway/rest/path.go:
--------------------------------------------------------------------------------
1 | package rest
2 |
3 | // import (
4 | // "fmt"
5 | //
6 | // mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
7 | // )
8 | //
9 | // const (
10 | // deploymentPathPrefix = "/deployment/{dseq}"
11 | // leasePathPrefix = "/lease/{dseq}/{gseq}/{oseq}"
12 | // hostnamePrefix = "/hostname"
13 | // endpointPrefix = "/endpoint"
14 | // migratePathPrefix = "/migrate"
15 | // )
16 | //
17 | // func versionPath() string {
18 | // return "version"
19 | // }
20 | //
21 | // func statusPath() string {
22 | // return "status"
23 | // }
24 | //
25 | // func validatePath() string {
26 | // return "validate"
27 | // }
28 | //
29 | // func leasePath(id mtypes.LeaseID) string {
30 | // return fmt.Sprintf("lease/%d/%d/%d", id.DSeq, id.GSeq, id.OSeq)
31 | // }
32 | //
33 | // func submitManifestPath(dseq uint64) string {
34 | // return fmt.Sprintf("deployment/%d/manifest", dseq)
35 | // }
36 | //
37 | // func getManifestPath(id mtypes.LeaseID) string {
38 | // return fmt.Sprintf("%s/manifest", leasePath(id))
39 | // }
40 | //
41 | // func leaseStatusPath(id mtypes.LeaseID) string {
42 | // return fmt.Sprintf("%s/status", leasePath(id))
43 | // }
44 | //
45 | // func leaseShellPath(lID mtypes.LeaseID) string {
46 | // return fmt.Sprintf("%s/shell", leasePath(lID))
47 | // }
48 | //
49 | // func leaseEventsPath(id mtypes.LeaseID) string {
50 | // return fmt.Sprintf("%s/kubeevents", leasePath(id))
51 | // }
52 | //
53 | // func serviceStatusPath(id mtypes.LeaseID, service string) string {
54 | // return fmt.Sprintf("%s/service/%s/status", leasePath(id), service)
55 | // }
56 | //
57 | // func serviceLogsPath(id mtypes.LeaseID) string {
58 | // return fmt.Sprintf("%s/logs", leasePath(id))
59 | // }
60 |
--------------------------------------------------------------------------------
/make/changelog.mk:
--------------------------------------------------------------------------------
1 | .PHONY: changelog
2 | changelog: $(GIT_CHGLOG)
3 | @echo "Generating changelog..."
4 | @./script/genchangelog.sh "$(RELEASE_TAG)" CHANGELOG.md
5 |
6 | .PHONY: changelog-next
7 | changelog-next: $(GIT_CHGLOG)
8 | @echo "Generating next version changelog..."
9 | @./script/genchangelog.sh "$(shell $(SEMVER) bump patch $(RELEASE_TAG))" CHANGELOG.md
10 |
11 | .PHONY: changelog-patch
12 | changelog-patch: $(GIT_CHGLOG)
13 | @echo "Generating patch version changelog..."
14 | @./script/genchangelog.sh "$(shell $(SEMVER) bump patch $(RELEASE_TAG))" CHANGELOG.md
15 |
16 | .PHONY: changelog-minor
17 | changelog-minor: $(GIT_CHGLOG)
18 | @echo "Generating minor version changelog..."
19 | @./script/genchangelog.sh "$(shell $(SEMVER) bump minor $(RELEASE_TAG))" CHANGELOG.md
20 |
21 | .PHONY: changelog-major
22 | changelog-major: $(GIT_CHGLOG)
23 | @echo "Generating major version changelog..."
24 | @./script/genchangelog.sh "$(shell $(SEMVER) bump major $(RELEASE_TAG))" CHANGELOG.md
--------------------------------------------------------------------------------
/make/codegen.mk:
--------------------------------------------------------------------------------
1 | .PHONY: generate
2 | generate: $(MOCKERY)
3 | $(GO) generate ./...
4 |
5 | .PHONY: kubetypes
6 | kubetypes: $(K8S_KUBE_CODEGEN)
7 | ./script/tools.sh k8s-gen
8 |
9 | .PHONY: codegen
10 | codegen: generate kubetypes
11 |
--------------------------------------------------------------------------------
/make/lint.mk:
--------------------------------------------------------------------------------
1 | .PHONY: lint
2 | lint: $(GOLANGCI_LINT)
3 | $(GOLANGCI_LINT_RUN) ./... --issues-exit-code=0 --timeout=20m
4 |
5 | .PHONY: lint-%
6 | lint-%: $(GOLANGCI_LINT)
7 | $(LINT) $*
8 |
--------------------------------------------------------------------------------
/make/mod.mk:
--------------------------------------------------------------------------------
1 | # Golang modules and vendoring
2 |
3 | .PHONY: deps-tidy
4 | deps-tidy:
5 | $(GO) mod tidy
6 |
7 |
--------------------------------------------------------------------------------
/manifest/config.go:
--------------------------------------------------------------------------------
1 | package manifest
2 |
3 | import "time"
4 |
5 | type ServiceConfig struct {
6 | HTTPServicesRequireAtLeastOneHost bool
7 | ManifestTimeout time.Duration
8 | RPCQueryTimeout time.Duration
9 | CachedResultMaxAge time.Duration
10 | }
11 |
--------------------------------------------------------------------------------
/manifest/parse.go:
--------------------------------------------------------------------------------
1 | package manifest
2 |
3 | import (
4 | "encoding/base32"
5 | "strings"
6 |
7 | maniv2beta1 "github.com/akash-network/akash-api/go/manifest/v2beta2"
8 | mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
9 | "github.com/google/uuid"
10 | )
11 |
12 | func AllHostnamesOfManifestGroup(mgroup maniv2beta1.Group) []string {
13 | allHostnames := make([]string, 0)
14 | for _, service := range mgroup.Services {
15 | for _, expose := range service.Expose {
16 | allHostnames = append(allHostnames, expose.Hosts...)
17 | }
18 | }
19 |
20 | return allHostnames
21 | }
22 |
23 | func IngressHost(lid mtypes.LeaseID, svcName string) string {
24 | uid := uuid.NewSHA1(uuid.NameSpaceDNS, []byte(lid.String()+svcName))
25 | // MarshalBinary always returns nil
26 | data, _ := uid.MarshalBinary()
27 | return strings.ToLower(base32.HexEncoding.WithPadding(base32.NoPadding).EncodeToString(data))
28 | }
29 |
--------------------------------------------------------------------------------
/manifest/types.go:
--------------------------------------------------------------------------------
1 | package manifest
2 |
3 | import (
4 | dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3"
5 |
6 | maniv2beta1 "github.com/akash-network/akash-api/go/manifest/v2beta2"
7 | )
8 |
9 | type submitRequest struct {
10 | Deployment dtypes.DeploymentID `json:"deployment"`
11 | Manifest maniv2beta1.Manifest `json:"manifest"`
12 | }
13 |
--------------------------------------------------------------------------------
/operator/common/error_logic.go:
--------------------------------------------------------------------------------
1 | package common
2 |
3 | import (
4 | "errors"
5 | )
6 |
7 | var (
8 | ErrObservationStopped = errors.New("observation stopped")
9 | )
10 |
--------------------------------------------------------------------------------
/operator/common/ignore_list_config.go:
--------------------------------------------------------------------------------
1 | package common
2 |
3 | import (
4 | "github.com/spf13/cobra"
5 | "github.com/spf13/viper"
6 | "time"
7 | )
8 |
9 | const (
10 | FlagIgnoreListEntryLimit = "ignore-list-entry-limit"
11 | FlagIgnoreListAgeLimit = "ignore-list-age-limit"
12 | FlagEventFailureLimit = "event-failure-limit"
13 | )
14 |
15 | type IgnoreListConfig struct {
16 | // This is a config object, so it isn't exported as an interface
17 | FailureLimit uint
18 | EntryLimit uint
19 | AgeLimit time.Duration
20 | }
21 |
22 | func IgnoreListConfigFromViper() IgnoreListConfig {
23 | return IgnoreListConfig{
24 | FailureLimit: viper.GetUint(FlagEventFailureLimit),
25 | EntryLimit: viper.GetUint(FlagIgnoreListEntryLimit),
26 | AgeLimit: viper.GetDuration(FlagIgnoreListAgeLimit),
27 | }
28 | }
29 |
30 | func AddIgnoreListFlags(cmd *cobra.Command) {
31 | cmd.Flags().Uint(FlagIgnoreListEntryLimit, 131072, "ignore list size limit")
32 | if err := viper.BindPFlag(FlagIgnoreListEntryLimit, cmd.Flags().Lookup(FlagIgnoreListEntryLimit)); err != nil {
33 | panic(err)
34 | }
35 |
36 | cmd.Flags().Duration(FlagIgnoreListAgeLimit, time.Hour*726, "ignore list entry age limit")
37 | if err := viper.BindPFlag(FlagIgnoreListAgeLimit, cmd.Flags().Lookup(FlagIgnoreListAgeLimit)); err != nil {
38 | panic(err)
39 | }
40 |
41 | cmd.Flags().Uint(FlagEventFailureLimit, 3, "event failure limit before it is ignored")
42 | if err := viper.BindPFlag(FlagEventFailureLimit, cmd.Flags().Lookup(FlagEventFailureLimit)); err != nil {
43 | panic(err)
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/operator/common/logger.go:
--------------------------------------------------------------------------------
1 | package common
2 |
3 | import (
4 | // nolint: golint, staticcheck
5 | "github.com/go-kit/kit/log/term"
6 | "github.com/tendermint/tendermint/libs/log"
7 | "os"
8 | )
9 |
10 | func OpenLogger() log.Logger {
11 | // logger with no color output - current debug colors are invisible for me.
12 | return log.NewTMLoggerWithColorFn(log.NewSyncWriter(os.Stdout), func(_ ...interface{}) term.FgBgColor {
13 | return term.FgBgColor{}
14 | })
15 | }
16 |
--------------------------------------------------------------------------------
/operator/common/operator_config.go:
--------------------------------------------------------------------------------
1 | package common
2 |
3 | import (
4 | "time"
5 |
6 | "github.com/spf13/viper"
7 |
8 | providerflags "github.com/akash-network/provider/cmd/provider-services/cmd/flags"
9 | )
10 |
11 | type OperatorConfig struct {
12 | PruneInterval time.Duration
13 | WebRefreshInterval time.Duration
14 | RetryDelay time.Duration
15 | ProviderAddress string
16 | }
17 |
18 | func GetOperatorConfigFromViper() OperatorConfig {
19 | return OperatorConfig{
20 | PruneInterval: viper.GetDuration(providerflags.FlagPruneInterval),
21 | WebRefreshInterval: viper.GetDuration(providerflags.FlagWebRefreshInterval),
22 | RetryDelay: viper.GetDuration(providerflags.FlagRetryDelay),
23 | ProviderAddress: viper.GetString(flagProviderAddress),
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/operator/common/operator_server_test.go:
--------------------------------------------------------------------------------
1 | package common
2 |
3 | import (
4 | "github.com/stretchr/testify/require"
5 | "io"
6 | "testing"
7 | )
8 |
9 | func TestOperatorServer(t *testing.T) {
10 | server, err := NewOperatorHTTP()
11 | require.NoError(t, err)
12 | require.NotNil(t, server)
13 |
14 | require.NotNil(t, server.GetRouter())
15 |
16 | called := false
17 | flag := server.AddPreparedEndpoint("/thepath", func(pd PreparedResult) error {
18 | require.NotNil(t, pd)
19 | pd.Set([]byte{0x0, 0x1, 0x2})
20 | called = true
21 | return nil
22 | })
23 |
24 | require.NoError(t, server.PrepareAll())
25 | require.False(t, called)
26 |
27 | flag()
28 |
29 | require.NoError(t, server.PrepareAll())
30 | require.True(t, called)
31 | }
32 |
33 | func TestOperatorServerReturnsPrepareError(t *testing.T) {
34 | server, err := NewOperatorHTTP()
35 | require.NoError(t, err)
36 | require.NotNil(t, server)
37 |
38 | flag := server.AddPreparedEndpoint("/thepath", func(_ PreparedResult) error {
39 | return io.EOF
40 | })
41 | flag()
42 | require.ErrorIs(t, server.PrepareAll(), io.EOF)
43 | }
44 |
45 | func TestOperatorServerPanicsOnDuplicatePath(t *testing.T) {
46 | server, err := NewOperatorHTTP()
47 | require.NoError(t, err)
48 | require.NotNil(t, server)
49 |
50 | _ = server.AddPreparedEndpoint("/thepath", func(_ PreparedResult) error { return nil })
51 | require.PanicsWithValue(t, "prepared result exists for path: /thepath", func() {
52 | _ = server.AddPreparedEndpoint("/thepath", func(_ PreparedResult) error { return nil })
53 | })
54 |
55 | require.PanicsWithValue(t, "passed nil value for prepare function", func() {
56 | _ = server.AddPreparedEndpoint("/lhjkbhjlkb", nil)
57 | })
58 | }
59 |
--------------------------------------------------------------------------------
/operator/common/prepared_data_test.go:
--------------------------------------------------------------------------------
1 | package common
2 |
3 | import (
4 | "github.com/stretchr/testify/require"
5 | "testing"
6 | "time"
7 | )
8 |
9 | func TestPreparedData(t *testing.T) {
10 | start := time.Now()
11 | pr := newPreparedResult()
12 | require.Len(t, pr.get().data, 0)
13 | require.Greater(t, pr.get().preparedAt.UnixNano(), int64(0))
14 |
15 | require.False(t, pr.needsPrepare)
16 | pr.Flag()
17 | require.True(t, pr.needsPrepare)
18 |
19 | testData := []byte{0x33, 0x44, 0xff}
20 |
21 | pr.Set(testData)
22 |
23 | require.Equal(t, pr.get().data, testData)
24 | require.Greater(t, pr.get().preparedAt.UnixNano(), start.UnixNano())
25 | }
26 |
27 | func TestPrepraedDataTruncates(t *testing.T) {
28 | pr := newPreparedResult()
29 |
30 | const l = 10000000
31 | data := make([]byte, l) // only length matters
32 | pr.Set(data)
33 |
34 | require.Less(t, len(pr.get().data), l)
35 | }
36 |
--------------------------------------------------------------------------------
/operator/inventory/registry.go:
--------------------------------------------------------------------------------
1 | package inventory
2 |
3 | type RegistryGPUDevice struct {
4 | Name string `json:"name"`
5 | Interface string `json:"interface"`
6 | MemorySize string `json:"memory_size"`
7 | }
8 |
9 | type RegistryGPUDevices map[string]RegistryGPUDevice
10 |
11 | type RegistryGPUVendor struct {
12 | Name string `json:"name"`
13 | Devices RegistryGPUDevices `json:"devices"`
14 | }
15 |
16 | type RegistryGPUVendors map[string]RegistryGPUVendor
17 |
--------------------------------------------------------------------------------
/operator/ip/types/error_response.go:
--------------------------------------------------------------------------------
1 | package types
2 |
3 | import (
4 | "errors"
5 | "fmt"
6 | )
7 |
8 | var (
9 | ErrIPOperator = errors.New("ip operator error")
10 |
11 | ErrNoSuchReservation = ipOperatorError{
12 | message: "no such reservation with that lease ID",
13 | code: 1000,
14 | }
15 |
16 | ErrReservationQuantityCannotBeZero = ipOperatorError{
17 | message: "reservation request cannot have a quantity of zero",
18 | code: 1001,
19 | }
20 |
21 | errNoRegisteredError = errors.New("no registered error")
22 | )
23 |
24 | type IPOperatorError interface {
25 | error
26 | GetCode() int
27 | }
28 |
29 | type ipOperatorError struct {
30 | message string
31 | code int
32 | }
33 |
34 | func (ipoe ipOperatorError) Error() string {
35 | return fmt.Sprintf("%s: %s", ErrIPOperator.Error(), ipoe.message)
36 | }
37 |
38 | func (ipoe ipOperatorError) Unwrap() error {
39 | return ErrIPOperator
40 | }
41 |
42 | func (ipoe ipOperatorError) GetCode() int {
43 | return ipoe.code
44 | }
45 |
46 | type IPOperatorErrorResponse struct {
47 | Error string
48 | Code int
49 | }
50 |
51 | var registry map[int]error
52 |
53 | func registerError(err IPOperatorError) {
54 | existing, exists := registry[err.GetCode()]
55 | if exists {
56 | panic(fmt.Sprintf("error already exists with code %d: %v", err.GetCode(), existing))
57 | }
58 |
59 | registry[err.GetCode()] = err
60 | }
61 |
62 | func Init() {
63 | registry = make(map[int]error)
64 | registerError(ErrNoSuchReservation)
65 | registerError(ErrReservationQuantityCannotBeZero)
66 | }
67 |
68 | func LookupError(code int) error {
69 | err, exists := registry[code]
70 | if exists {
71 | return err
72 | }
73 |
74 | return fmt.Errorf("%w: code %d", errNoRegisteredError, code)
75 | }
76 |
--------------------------------------------------------------------------------
/operator/waiter/waiter.go:
--------------------------------------------------------------------------------
1 | package waiter
2 |
3 | import (
4 | "context"
5 | "time"
6 |
7 | "github.com/tendermint/tendermint/libs/log"
8 | )
9 |
10 | type OperatorWaiter interface {
11 | WaitForAll(ctx context.Context) error
12 | }
13 |
14 | type Waitable interface {
15 | Check(ctx context.Context) error
16 | String() string
17 | }
18 |
19 | type nullWaiter struct{}
20 |
21 | func (nw nullWaiter) WaitForAll(_ context.Context) error {
22 | return nil
23 | }
24 |
25 | func NewNullWaiter() OperatorWaiter {
26 | return nullWaiter{}
27 | }
28 |
29 | type operatorWaiter struct {
30 | waitables []Waitable
31 | log log.Logger
32 | delayPeriod time.Duration
33 | allReady chan struct{}
34 | }
35 |
36 | func NewOperatorWaiter(ctx context.Context, logger log.Logger, waitOn ...Waitable) OperatorWaiter {
37 | waiter := &operatorWaiter{
38 | waitables: waitOn,
39 | log: logger.With("cmp", "waiter"),
40 | delayPeriod: 2 * time.Second,
41 | allReady: make(chan struct{}),
42 | }
43 |
44 | go waiter.run(ctx)
45 |
46 | return waiter
47 | }
48 |
49 | func (w *operatorWaiter) WaitForAll(ctx context.Context) error {
50 | select {
51 | case <-ctx.Done():
52 | return ctx.Err()
53 | case <-w.allReady:
54 | return nil
55 | }
56 | }
57 |
58 | func (w *operatorWaiter) run(ctx context.Context) {
59 | for _, waitable := range w.waitables {
60 | for {
61 | err := waitable.Check(ctx)
62 | if err != nil {
63 | w.log.Error("not yet ready", "waitable", waitable, "error", err)
64 |
65 | select {
66 | case <-ctx.Done():
67 | return
68 | case <-time.After(w.delayPeriod):
69 | }
70 |
71 | continue
72 | }
73 | break
74 | }
75 |
76 | w.log.Info("ready", "waitable", waitable)
77 | }
78 | w.log.Info("all waitables ready")
79 |
80 | close(w.allReady)
81 | }
82 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta1/doc.go:
--------------------------------------------------------------------------------
1 | // +k8s:deepcopy-gen=package
2 | // +k8s:defaulter-gen=TypeMeta
3 | // +k8s:openapi-gen=true
4 | // +groupName=akash.network
5 |
6 | // Package v2beta1 is the initial version of types which integrate with the Kubernetes API.
7 | //
8 | // Contains the Stack Definition Language(pkg: github.com/akash-network/node/sdl) Manifest
9 | // declarations which are written to Kubernetes CRDs for storage.
10 | //
11 | // Manifest {
12 | // ManifestSpec {
13 | // k8s.TypeMeta
14 | // LeaseID
15 | // ManifestGroup
16 | // k8s.TypeMeta
17 | // Name
18 | // []*ManifestService
19 | // // ManifestService analogous to a running container.
20 | // ManifestStatus
21 | // State
22 | // Message
23 | // }
24 | package v2beta1
25 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta1/register.go:
--------------------------------------------------------------------------------
1 | package v2beta1
2 |
3 | import (
4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5 | "k8s.io/apimachinery/pkg/runtime"
6 | "k8s.io/apimachinery/pkg/runtime/schema"
7 | )
8 |
9 | const (
10 | crdGroup = "akash.network"
11 | crdVersion = "v2beta1"
12 | )
13 |
14 | var (
15 | schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
16 |
17 | // AddToScheme applies all the stored functions to the scheme
18 | AddToScheme = schemeBuilder.AddToScheme
19 |
20 | // SchemeGroupVersion creates a Rest client with the new CRD Schema
21 | SchemeGroupVersion = schema.GroupVersion{Group: crdGroup, Version: crdVersion}
22 | )
23 |
24 | func addKnownTypes(scheme *runtime.Scheme) error {
25 | scheme.AddKnownTypes(SchemeGroupVersion,
26 | &Manifest{},
27 | &ManifestList{},
28 | )
29 | scheme.AddKnownTypes(SchemeGroupVersion,
30 | &InventoryRequest{},
31 | &InventoryRequestList{},
32 | &Inventory{},
33 | &InventoryList{},
34 | )
35 | scheme.AddKnownTypes(SchemeGroupVersion,
36 | &ProviderHost{},
37 | &ProviderHostList{})
38 |
39 | scheme.AddKnownTypes(SchemeGroupVersion,
40 | &ProviderLeasedIP{},
41 | &ProviderLeasedIPList{})
42 | metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
43 | return nil
44 | }
45 |
46 | // Resource takes an unqualified resource and returns a Group qualified GroupResource
47 | func Resource(resource string) schema.GroupResource {
48 | return SchemeGroupVersion.WithResource(resource).GroupResource()
49 | }
50 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta1/zz_generated.defaults.go:
--------------------------------------------------------------------------------
1 | //go:build !ignore_autogenerated
2 | // +build !ignore_autogenerated
3 |
4 | /*
5 | Copyright The Akash Network Authors.
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 | */
19 |
20 | // Code generated by defaulter-gen. DO NOT EDIT.
21 |
22 | package v2beta1
23 |
24 | import (
25 | runtime "k8s.io/apimachinery/pkg/runtime"
26 | )
27 |
28 | // RegisterDefaults adds defaulters functions to the given scheme.
29 | // Public to allow building arbitrary schemes.
30 | // All generated defaulters are covering - they call all nested defaulters.
31 | func RegisterDefaults(scheme *runtime.Scheme) error {
32 | return nil
33 | }
34 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/doc.go:
--------------------------------------------------------------------------------
1 | // +k8s:deepcopy-gen=package,register
2 | // +k8s:defaulter-gen=TypeMeta
3 | // +k8s:openapi-gen=true
4 | // +groupName=akash.network
5 |
6 | package v2beta2
7 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/migrate/provider_host.go:
--------------------------------------------------------------------------------
1 | package migrate
2 |
3 | import (
4 | "github.com/akash-network/provider/pkg/apis/akash.network/v2beta1"
5 | "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2"
6 | )
7 |
8 | func ProviderHostsSpecFromV2beta1(from v2beta1.ProviderHostSpec) v2beta2.ProviderHostSpec {
9 | to := v2beta2.ProviderHostSpec{
10 | Owner: from.Owner,
11 | Provider: from.Provider,
12 | Hostname: from.Hostname,
13 | Dseq: from.Dseq,
14 | Gseq: from.Gseq,
15 | Oseq: from.Oseq,
16 | ServiceName: from.ServiceName,
17 | ExternalPort: from.ExternalPort,
18 | }
19 |
20 | return to
21 | }
22 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/migrate/provider_leased_ips.go:
--------------------------------------------------------------------------------
1 | package migrate
2 |
3 | import (
4 | "github.com/akash-network/provider/pkg/apis/akash.network/v2beta1"
5 | "github.com/akash-network/provider/pkg/apis/akash.network/v2beta2"
6 | )
7 |
8 | func ProviderIPsSpecFromV2beta1(from v2beta1.ProviderLeasedIPSpec) v2beta2.ProviderLeasedIPSpec {
9 | to := v2beta2.ProviderLeasedIPSpec{
10 | LeaseID: LeaseIDFromV2beta1(from.LeaseID),
11 | ServiceName: from.ServiceName,
12 | Port: from.Port,
13 | ExternalPort: from.ExternalPort,
14 | SharingKey: from.SharingKey,
15 | Protocol: from.Protocol,
16 | }
17 |
18 | return to
19 | }
20 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/node_info.go:
--------------------------------------------------------------------------------
1 | package v2beta2
2 |
3 | type GPUCapabilities struct {
4 | Vendor string `json:"vendor" capabilities:"vendor"`
5 | Model string `json:"string" capabilities:"model"`
6 | }
7 |
8 | type StorageCapabilities struct {
9 | Classes []string `json:"classes"`
10 | }
11 |
12 | type NodeInfoCapabilities struct {
13 | GPU GPUCapabilities `json:"gpu" capabilities:"gpu"`
14 | Storage StorageCapabilities `json:"storage" capabilities:"storage"`
15 | }
16 |
17 | func (c *StorageCapabilities) HasClass(class string) bool {
18 | for _, val := range c.Classes {
19 | if val == class {
20 | return true
21 | }
22 | }
23 | return false
24 | }
25 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/provider_host.go:
--------------------------------------------------------------------------------
1 | package v2beta2
2 |
3 | import (
4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5 | )
6 |
7 | // ProviderHost
8 | // +genclient
9 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
10 | type ProviderHost struct {
11 | metav1.TypeMeta `json:",inline"`
12 | metav1.ObjectMeta `json:"metadata"`
13 |
14 | Spec ProviderHostSpec `json:"spec,omitempty"`
15 | }
16 |
17 | // ProviderHostList
18 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
19 | type ProviderHostList struct {
20 | metav1.TypeMeta `json:",inline"`
21 | metav1.ListMeta `json:"metadata"`
22 | Items []ProviderHost `json:"items"`
23 | }
24 |
25 | type ProviderHostStatus struct {
26 | State string `json:"state,omitempty"`
27 | Message string `json:"message,omitempty"`
28 | }
29 |
30 | type ProviderHostSpec struct {
31 | Owner string `json:"owner"`
32 | Provider string `json:"provider"`
33 | Hostname string `json:"hostname"`
34 | Dseq uint64 `json:"dseq"`
35 | Gseq uint32 `json:"gseq"`
36 | Oseq uint32 `json:"oseq"`
37 | ServiceName string `json:"service_name"`
38 | ExternalPort uint32 `json:"external_port"`
39 | }
40 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/provider_lease_ip.go:
--------------------------------------------------------------------------------
1 | package v2beta2
2 |
3 | import (
4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5 | )
6 |
7 | // ProviderLeasedIP
8 | // +genclient
9 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
10 | type ProviderLeasedIP struct {
11 | metav1.TypeMeta `json:",inline"`
12 | metav1.ObjectMeta `json:"metadata"`
13 |
14 | Spec ProviderLeasedIPSpec `json:"spec,omitempty"`
15 | }
16 |
17 | // ProviderLeasedIPList
18 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
19 | type ProviderLeasedIPList struct {
20 | metav1.TypeMeta `json:",inline"`
21 | metav1.ListMeta `json:"metadata"`
22 | Items []ProviderLeasedIP `json:"items"`
23 | }
24 |
25 | type ProviderLeasedIPStatus struct {
26 | State string `json:"state,omitempty"`
27 | Message string `json:"message,omitempty"`
28 | }
29 |
30 | type ProviderLeasedIPSpec struct {
31 | LeaseID LeaseID `json:"lease_id"`
32 | ServiceName string `json:"service_name"`
33 | Port uint32 `json:"port"`
34 | ExternalPort uint32 `json:"external_port"`
35 | SharingKey string `json:"sharing_key"`
36 | Protocol string `json:"protocol"`
37 | }
38 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/register.go:
--------------------------------------------------------------------------------
1 | package v2beta2
2 |
3 | import (
4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5 | "k8s.io/apimachinery/pkg/runtime"
6 | "k8s.io/apimachinery/pkg/runtime/schema"
7 | )
8 |
9 | const (
10 | crdGroup = "akash.network"
11 | crdVersion = "v2beta2"
12 | )
13 |
14 | var (
15 | schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
16 |
17 | // AddToScheme applies all the stored functions to the scheme
18 | AddToScheme = schemeBuilder.AddToScheme
19 |
20 | // SchemeGroupVersion creates a Rest client with the new CRD Schema
21 | SchemeGroupVersion = schema.GroupVersion{Group: crdGroup, Version: crdVersion}
22 | )
23 |
24 | func addKnownTypes(scheme *runtime.Scheme) error {
25 | scheme.AddKnownTypes(SchemeGroupVersion,
26 | &Manifest{},
27 | &ManifestList{},
28 | )
29 | scheme.AddKnownTypes(SchemeGroupVersion,
30 | &InventoryRequest{},
31 | &InventoryRequestList{},
32 | &Inventory{},
33 | &InventoryList{},
34 | )
35 | scheme.AddKnownTypes(SchemeGroupVersion,
36 | &ProviderHost{},
37 | &ProviderHostList{})
38 |
39 | scheme.AddKnownTypes(SchemeGroupVersion,
40 | &ProviderLeasedIP{},
41 | &ProviderLeasedIPList{})
42 |
43 | metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
44 | return nil
45 | }
46 |
47 | // Resource takes an unqualified resource and returns a Group qualified GroupResource
48 | func Resource(resource string) schema.GroupResource {
49 | return SchemeGroupVersion.WithResource(resource).GroupResource()
50 | }
51 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/types_test.go:
--------------------------------------------------------------------------------
1 | package v2beta2
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/stretchr/testify/assert"
7 | "github.com/stretchr/testify/require"
8 |
9 | atestutil "github.com/akash-network/node/testutil"
10 |
11 | mtestutil "github.com/akash-network/provider/testutil/manifest/v2beta2"
12 | )
13 |
14 | func Test_Manifest_encoding(t *testing.T) {
15 | for _, spec := range mtestutil.Generators {
16 | // ensure decode(encode(obj)) == obj
17 |
18 | lid := atestutil.LeaseID(t)
19 | mgroup := spec.Generator.Group(t)
20 | sparams := make([]*SchedulerParams, len(mgroup.Services))
21 |
22 | kmani, err := NewManifest("foo", lid, &mgroup, ClusterSettings{SchedulerParams: sparams})
23 | require.NoError(t, err, spec.Name)
24 |
25 | deployment, err := kmani.Deployment()
26 | require.NoError(t, err, spec.Name)
27 |
28 | assert.Equal(t, lid, deployment.LeaseID(), spec.Name)
29 | assert.Equal(t, &mgroup, deployment.ManifestGroup(), spec.Name)
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/pkg/apis/akash.network/v2beta2/zz_generated.defaults.go:
--------------------------------------------------------------------------------
1 | //go:build !ignore_autogenerated
2 | // +build !ignore_autogenerated
3 |
4 | /*
5 | Copyright The Akash Network Authors.
6 |
7 | Licensed under the Apache License, Version 2.0 (the "License");
8 | you may not use this file except in compliance with the License.
9 | You may obtain a copy of the License at
10 |
11 | http://www.apache.org/licenses/LICENSE-2.0
12 |
13 | Unless required by applicable law or agreed to in writing, software
14 | distributed under the License is distributed on an "AS IS" BASIS,
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | See the License for the specific language governing permissions and
17 | limitations under the License.
18 | */
19 |
20 | // Code generated by defaulter-gen. DO NOT EDIT.
21 |
22 | package v2beta2
23 |
24 | import (
25 | runtime "k8s.io/apimachinery/pkg/runtime"
26 | )
27 |
28 | // RegisterDefaults adds defaulters functions to the given scheme.
29 | // Public to allow building arbitrary schemes.
30 | // All generated defaulters are covering - they call all nested defaulters.
31 | func RegisterDefaults(scheme *runtime.Scheme) error {
32 | return nil
33 | }
34 |
--------------------------------------------------------------------------------
/pkg/apis/boilerplate.go.txt:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 |
--------------------------------------------------------------------------------
/pkg/client/applyconfiguration/akash.network/v2beta1/inventoryrequestspec.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by applyconfiguration-gen. DO NOT EDIT.
18 |
19 | package v2beta1
20 |
21 | // InventoryRequestSpecApplyConfiguration represents a declarative configuration of the InventoryRequestSpec type for use
22 | // with apply.
23 | type InventoryRequestSpecApplyConfiguration struct {
24 | Name *string `json:"name,omitempty"`
25 | }
26 |
27 | // InventoryRequestSpecApplyConfiguration constructs a declarative configuration of the InventoryRequestSpec type for use with
28 | // apply.
29 | func InventoryRequestSpec() *InventoryRequestSpecApplyConfiguration {
30 | return &InventoryRequestSpecApplyConfiguration{}
31 | }
32 |
33 | // WithName sets the Name field in the declarative configuration to the given value
34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations.
35 | // If called multiple times, the Name field is set to the value of the last call.
36 | func (b *InventoryRequestSpecApplyConfiguration) WithName(value string) *InventoryRequestSpecApplyConfiguration {
37 | b.Name = &value
38 | return b
39 | }
40 |
--------------------------------------------------------------------------------
/pkg/client/applyconfiguration/akash.network/v2beta2/inventoryrequestspec.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by applyconfiguration-gen. DO NOT EDIT.
18 |
19 | package v2beta2
20 |
21 | // InventoryRequestSpecApplyConfiguration represents a declarative configuration of the InventoryRequestSpec type for use
22 | // with apply.
23 | type InventoryRequestSpecApplyConfiguration struct {
24 | Name *string `json:"name,omitempty"`
25 | }
26 |
27 | // InventoryRequestSpecApplyConfiguration constructs a declarative configuration of the InventoryRequestSpec type for use with
28 | // apply.
29 | func InventoryRequestSpec() *InventoryRequestSpecApplyConfiguration {
30 | return &InventoryRequestSpecApplyConfiguration{}
31 | }
32 |
33 | // WithName sets the Name field in the declarative configuration to the given value
34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations.
35 | // If called multiple times, the Name field is set to the value of the last call.
36 | func (b *InventoryRequestSpecApplyConfiguration) WithName(value string) *InventoryRequestSpecApplyConfiguration {
37 | b.Name = &value
38 | return b
39 | }
40 |
--------------------------------------------------------------------------------
/pkg/client/applyconfiguration/akash.network/v2beta2/schedulerresources.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by applyconfiguration-gen. DO NOT EDIT.
18 |
19 | package v2beta2
20 |
21 | // SchedulerResourcesApplyConfiguration represents a declarative configuration of the SchedulerResources type for use
22 | // with apply.
23 | type SchedulerResourcesApplyConfiguration struct {
24 | GPU *SchedulerResourceGPUApplyConfiguration `json:"gpu,omitempty"`
25 | }
26 |
27 | // SchedulerResourcesApplyConfiguration constructs a declarative configuration of the SchedulerResources type for use with
28 | // apply.
29 | func SchedulerResources() *SchedulerResourcesApplyConfiguration {
30 | return &SchedulerResourcesApplyConfiguration{}
31 | }
32 |
33 | // WithGPU sets the GPU field in the declarative configuration to the given value
34 | // and returns the receiver, so that objects can be built by chaining "With" function invocations.
35 | // If called multiple times, the GPU field is set to the value of the last call.
36 | func (b *SchedulerResourcesApplyConfiguration) WithGPU(value *SchedulerResourceGPUApplyConfiguration) *SchedulerResourcesApplyConfiguration {
37 | b.GPU = value
38 | return b
39 | }
40 |
--------------------------------------------------------------------------------
/pkg/client/applyconfiguration/internal/internal.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by applyconfiguration-gen. DO NOT EDIT.
18 |
19 | package internal
20 |
21 | import (
22 | fmt "fmt"
23 | sync "sync"
24 |
25 | typed "sigs.k8s.io/structured-merge-diff/v4/typed"
26 | )
27 |
28 | func Parser() *typed.Parser {
29 | parserOnce.Do(func() {
30 | var err error
31 | parser, err = typed.NewParser(schemaYAML)
32 | if err != nil {
33 | panic(fmt.Sprintf("Failed to parse schema: %v", err))
34 | }
35 | })
36 | return parser
37 | }
38 |
39 | var parserOnce sync.Once
40 | var parser *typed.Parser
41 | var schemaYAML = typed.YAMLObject(`types:
42 | - name: __untyped_atomic_
43 | scalar: untyped
44 | list:
45 | elementType:
46 | namedType: __untyped_atomic_
47 | elementRelationship: atomic
48 | map:
49 | elementType:
50 | namedType: __untyped_atomic_
51 | elementRelationship: atomic
52 | - name: __untyped_deduced_
53 | scalar: untyped
54 | list:
55 | elementType:
56 | namedType: __untyped_atomic_
57 | elementRelationship: atomic
58 | map:
59 | elementType:
60 | namedType: __untyped_deduced_
61 | elementRelationship: separable
62 | `)
63 |
--------------------------------------------------------------------------------
/pkg/client/clientset/versioned/fake/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by client-gen. DO NOT EDIT.
18 |
19 | // This package has the automatically generated fake clientset.
20 | package fake
21 |
--------------------------------------------------------------------------------
/pkg/client/clientset/versioned/scheme/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by client-gen. DO NOT EDIT.
18 |
19 | // This package contains the scheme of the automatically generated clientset.
20 | package scheme
21 |
--------------------------------------------------------------------------------
/pkg/client/clientset/versioned/typed/akash.network/v2beta1/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by client-gen. DO NOT EDIT.
18 |
19 | // This package has the automatically generated typed clients.
20 | package v2beta1
21 |
--------------------------------------------------------------------------------
/pkg/client/clientset/versioned/typed/akash.network/v2beta1/fake/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by client-gen. DO NOT EDIT.
18 |
19 | // Package fake has the automatically generated clients.
20 | package fake
21 |
--------------------------------------------------------------------------------
/pkg/client/clientset/versioned/typed/akash.network/v2beta1/generated_expansion.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by client-gen. DO NOT EDIT.
18 |
19 | package v2beta1
20 |
21 | type InventoryExpansion interface{}
22 |
23 | type InventoryRequestExpansion interface{}
24 |
25 | type ManifestExpansion interface{}
26 |
27 | type ProviderHostExpansion interface{}
28 |
29 | type ProviderLeasedIPExpansion interface{}
30 |
--------------------------------------------------------------------------------
/pkg/client/clientset/versioned/typed/akash.network/v2beta2/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by client-gen. DO NOT EDIT.
18 |
19 | // This package has the automatically generated typed clients.
20 | package v2beta2
21 |
--------------------------------------------------------------------------------
/pkg/client/clientset/versioned/typed/akash.network/v2beta2/fake/doc.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by client-gen. DO NOT EDIT.
18 |
19 | // Package fake has the automatically generated clients.
20 | package fake
21 |
--------------------------------------------------------------------------------
/pkg/client/clientset/versioned/typed/akash.network/v2beta2/generated_expansion.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by client-gen. DO NOT EDIT.
18 |
19 | package v2beta2
20 |
21 | type InventoryExpansion interface{}
22 |
23 | type InventoryRequestExpansion interface{}
24 |
25 | type ManifestExpansion interface{}
26 |
27 | type ProviderHostExpansion interface{}
28 |
29 | type ProviderLeasedIPExpansion interface{}
30 |
--------------------------------------------------------------------------------
/pkg/client/informers/externalversions/internalinterfaces/factory_interfaces.go:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright The Akash Network Authors.
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 |
17 | // Code generated by informer-gen. DO NOT EDIT.
18 |
19 | package internalinterfaces
20 |
21 | import (
22 | time "time"
23 |
24 | versioned "github.com/akash-network/provider/pkg/client/clientset/versioned"
25 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26 | runtime "k8s.io/apimachinery/pkg/runtime"
27 | cache "k8s.io/client-go/tools/cache"
28 | )
29 |
30 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer.
31 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer
32 |
33 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle
34 | type SharedInformerFactory interface {
35 | Start(stopCh <-chan struct{})
36 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer
37 | }
38 |
39 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions.
40 | type TweakListOptionsFunc func(*v1.ListOptions)
41 |
--------------------------------------------------------------------------------
/script/codecov.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | OUTDIR=$1
5 | TAGS=$2
6 |
7 | coverage="$OUTDIR/coverage.txt"
8 | profile="$OUTDIR/profile.out"
9 |
10 | set -e
11 | echo "mode: atomic" > "$coverage"
12 | while IFS=$'\n' read -r pkg; do
13 | go test -timeout 30m -race -coverprofile="$profile" -covermode=atomic -tags="$TAGS" "$pkg"
14 | if [ -f "$profile" ]; then
15 | tail -n +2 "$profile" >> "$coverage";
16 | rm "$profile"
17 | fi
18 | done < <(go list ./... | grep -v 'mock\|pkg/client')
19 |
--------------------------------------------------------------------------------
/script/genchangelog.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | PATH=$PATH:$(pwd)/.cache/bin
4 | export PATH=$PATH
5 |
6 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
7 |
8 | if [[ $# -ne 2 ]]; then
9 | echo "illegal number of parameters"
10 | exit 1
11 | fi
12 |
13 | to_tag=$1
14 |
15 | version_rel="^[v|V]?(0|[1-9][0-9]*)\\.(\\d*[0-9])\\.(0|[1-9][0-9]*)$"
16 | version_prerel="^[v|V]?(0|[1-9][0-9]*)\\.(\\d*[0-9])\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
17 |
18 | if [[ -z $("${SCRIPT_DIR}"/semver.sh get prerel "$to_tag") ]]; then
19 | tag_regexp=$version_rel
20 | else
21 | tag_regexp=$version_prerel
22 | fi
23 |
24 | query_string="$to_tag"
25 | git-chglog --config .chglog/config.yaml --tag-filter-pattern="$tag_regexp" --output "$2" "$query_string"
26 |
--------------------------------------------------------------------------------
/script/is_local_gomod.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | MOD_PATH=$(go list -mod=readonly -m -f '{{ .Replace }}' "$1" 2>/dev/null | grep -v -x -F "")
4 |
5 | [[ "${MOD_PATH}" =~ ^(\/|\.\/|\.\.\/).*$ ]] && echo -n true || echo -n false
6 |
--------------------------------------------------------------------------------
/script/is_prerelease.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # in akash even minor part of the tag indicates release belongs to the MAINNET
4 | # using it as scripts simplifies debugging as well as portability
5 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
6 |
7 | if [[ $# -ne 1 ]]; then
8 | echo "illegal number of parameters"
9 | exit 1
10 | fi
11 |
12 | [[ $("${SCRIPT_DIR}"/semver.sh get prerel "$1" 2>/dev/null) != "" ]] && exit 0 || exit 1
13 |
--------------------------------------------------------------------------------
/script/kubectl_retry.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -E
2 |
3 | KUBECTL_RETRY=${KUBECTL_RETRY:-5}
4 | KUBECTL_RETRY_DELAY=${KUBECTL_RETRY_DELAY:-10}
5 |
6 | kubectl_retry() {
7 | local retries=0 action="${1}" ret=0 stdout stderr
8 | shift
9 |
10 | # temporary files for kubectl output
11 | stdout=$(mktemp)
12 | stderr=$(mktemp)
13 |
14 | trap 'rm -f "${stdout}" "${stderr}"' RETURN
15 |
16 | while ! kubectl "${action}" "${@}" 2>"${stderr}" 1>"${stdout}"; do
17 | # in case of a failure when running "create", ignore errors with "AlreadyExists"
18 | if [ "${action}" == 'create' ]
19 | then
20 | # count lines in stderr that do not have "AlreadyExists"
21 | ret=$(grep -cvw 'AlreadyExists' "${stderr}")
22 | if [ "${ret}" -eq 0 ]
23 | then
24 | # Success! stderr is empty after removing all "AlreadyExists" lines.
25 | break
26 | fi
27 | fi
28 |
29 | retries=$((retries+1))
30 | if [ ${retries} -eq "${KUBECTL_RETRY}" ]
31 | then
32 | ret=1
33 | break
34 | fi
35 |
36 | # log stderr and empty the tmpfile
37 | cat "${stderr}" > /dev/stderr
38 | true > "${stderr}"
39 | echo "kubectl_retry ${*} failed, will retry in ${KUBECTL_RETRY_DELAY} seconds"
40 |
41 | sleep "${KUBECTL_RETRY_DELAY}"
42 |
43 | # reset ret so that a next working kubectl does not cause a non-zero
44 | # return of the function
45 | ret=0
46 | done
47 |
48 | # write output so that calling functions can consume it
49 | cat "${stdout}" > /dev/stdout
50 | cat "${stderr}" > /dev/stderr
51 |
52 | return ${ret}
53 | }
54 |
--------------------------------------------------------------------------------
/script/shellcheck.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Ignore file
4 | IGNORE="godownloader.sh"
5 |
6 | unset FAILED
7 |
8 | FILES=$(find /shellcheck/ -type f -name "*.sh" ! -path "/shellcheck/vendor/*" ! -path "/shellcheck/.git/*")
9 |
10 | for file in $FILES; do
11 | name="$(basename "$file")";
12 | if [[ $name != "$IGNORE" ]] && ! shellcheck --format=gcc "${file}" --exclude=SC1091; then
13 | export FAILED=true
14 | fi
15 | done
16 | if [ "${FAILED}" != "" ]; then exit 1; fi
17 |
--------------------------------------------------------------------------------
/session/session.go:
--------------------------------------------------------------------------------
1 | package session
2 |
3 | import (
4 | "github.com/tendermint/tendermint/libs/log"
5 |
6 | aclient "github.com/akash-network/akash-api/go/node/client/v1beta2"
7 | ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3"
8 | )
9 |
10 | // Session interface wraps Log, Client, Provider and ForModule methods
11 | type Session interface {
12 | Log() log.Logger
13 | Client() aclient.Client
14 | Provider() *ptypes.Provider
15 | ForModule(string) Session
16 | CreatedAtBlockHeight() int64
17 | }
18 |
19 | // New returns new session instance with provided details
20 | func New(log log.Logger, client aclient.Client, provider *ptypes.Provider, createdAtBlockHeight int64) Session {
21 | return session{
22 | client: client,
23 | provider: provider,
24 | log: log,
25 | createdAtBlockHeight: createdAtBlockHeight,
26 | }
27 | }
28 |
29 | type session struct {
30 | client aclient.Client
31 | provider *ptypes.Provider
32 | log log.Logger
33 | createdAtBlockHeight int64
34 | }
35 |
36 | func (s session) Log() log.Logger {
37 | return s.log
38 | }
39 |
40 | func (s session) Client() aclient.Client {
41 | return s.client
42 | }
43 |
44 | func (s session) Provider() *ptypes.Provider {
45 | return s.provider
46 | }
47 |
48 | func (s session) ForModule(name string) Session {
49 | s.log = s.log.With("module", name)
50 | return s
51 | }
52 |
53 | func (s session) CreatedAtBlockHeight() int64 {
54 | return s.createdAtBlockHeight
55 | }
56 |
--------------------------------------------------------------------------------
/session/session_test.go:
--------------------------------------------------------------------------------
1 | package session
2 |
3 | import (
4 | "github.com/stretchr/testify/assert"
5 | "testing"
6 | )
7 |
8 | func TestSessionGetCreatedAt(t *testing.T) {
9 | const testCreatedAt = int64(13156)
10 | s := New(nil, nil, nil, testCreatedAt)
11 | assert.Equal(t, s.CreatedAtBlockHeight(), testCreatedAt)
12 | }
13 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-c2c.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: anapsix/webdis
7 | env:
8 | - REDIS_HOST=redis-server
9 | expose:
10 | - port: 7379
11 | as: 80
12 | to:
13 | - global: true
14 | accept:
15 | - webdistest.localhost
16 |
17 | redis-server:
18 | image: redis:rc-alpine3.12
19 | expose:
20 | - port: 6379
21 |
22 | profiles:
23 | compute:
24 | web:
25 | resources:
26 | cpu:
27 | units: 0.1
28 | memory:
29 | size: 16Mi
30 | storage:
31 | size: 128Mi
32 | redis-server:
33 | resources:
34 | cpu:
35 | units: 0.1
36 | memory:
37 | size: 64Mi
38 | storage:
39 | size: 128Mi
40 | placement:
41 | global:
42 | pricing:
43 | web:
44 | denom: uakt
45 | amount: 9000
46 | redis-server:
47 | denom: uakt
48 | amount: 9000
49 |
50 | deployment:
51 | web:
52 | global:
53 | profile: web
54 | count: 1
55 | redis-server:
56 | global:
57 | profile: redis-server
58 | count: 1
59 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-custom-currency.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: ovrclk/e2e-test
6 | expose:
7 | - port: 8080
8 | as: 80
9 | to:
10 | - global: true
11 | accept:
12 | - webdistest.localhost
13 | params:
14 | storage:
15 | data:
16 | mount: /var/lib/e2e-test
17 | bew:
18 | image: ovrclk/e2e-test
19 | expose:
20 | - port: 8080
21 | as: 81
22 | to:
23 | - global: true
24 | accept:
25 | - webdistest2.localhost
26 | profiles:
27 | compute:
28 | web:
29 | resources:
30 | cpu:
31 | units: "0.01"
32 | memory:
33 | size: "128Mi"
34 | storage:
35 | - size: "512Mi"
36 | - name: data
37 | size: "128Mi"
38 | attributes:
39 | persistent: "true"
40 | bew:
41 | resources:
42 | cpu:
43 | units: "0.01"
44 | memory:
45 | size: "128Mi"
46 | storage:
47 | - size: "512Mi"
48 | placement:
49 | global:
50 | pricing:
51 | web:
52 | denom: ibc/12C6A0C374171B595A0A9E18B83FA09D295FB1F2D8C6DAA3AC28683471752D84
53 | amount: 100
54 | bew:
55 | denom: ibc/12C6A0C374171B595A0A9E18B83FA09D295FB1F2D8C6DAA3AC28683471752D84
56 | amount: 100
57 | deployment:
58 | web:
59 | global:
60 | profile: web
61 | count: 1
62 | bew:
63 | global:
64 | profile: bew
65 | count: 1
66 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-escrow.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: anapsix/webdis
7 | env:
8 | - REDIS_HOST=redis-server
9 | expose:
10 | - port: 7379
11 | as: 80
12 | to:
13 | - global: true
14 | accept:
15 | - webdistest.localhost
16 |
17 | redis-server:
18 | image: redis:rc-alpine3.12
19 | expose:
20 | - port: 6379
21 |
22 | profiles:
23 | compute:
24 | web:
25 | resources:
26 | cpu:
27 | units: 0.1
28 | memory:
29 | size: 16Mi
30 | storage:
31 | size: 128Mi
32 | redis-server:
33 | resources:
34 | cpu:
35 | units: 0.1
36 | memory:
37 | size: 64Mi
38 | storage:
39 | size: 128Mi
40 | placement:
41 | global:
42 | pricing:
43 | web:
44 | denom: uakt
45 | amount: 10000000
46 | redis-server:
47 | denom: uakt
48 | amount: 10000000
49 |
50 | deployment:
51 | web:
52 | global:
53 | profile: web
54 | count: 1
55 | redis-server:
56 | global:
57 | profile: redis-server
58 | count: 1
59 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-ip-endpoint.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | ip: "meow"
12 | accept:
13 | - test.localhost
14 |
15 | profiles:
16 | compute:
17 | web:
18 | resources:
19 | cpu:
20 | units: "0.01"
21 | memory:
22 | size: "128Mi"
23 | storage:
24 | size: "512Mi"
25 |
26 | placement:
27 | global:
28 | pricing:
29 | web:
30 | denom: uakt
31 | amount: 10
32 |
33 | deployment:
34 | web:
35 | global:
36 | profile: web
37 | count: 1
38 |
39 | endpoints:
40 | meow:
41 | kind: "ip"
42 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-migrate.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | accept:
12 | - leaveme.com
13 | - migrateme.com
14 |
15 | profiles:
16 | compute:
17 | web:
18 | resources:
19 | cpu:
20 | units: "0.01"
21 | memory:
22 | size: "128Mi"
23 | storage:
24 | size: "512Mi"
25 |
26 | placement:
27 | global:
28 | pricing:
29 | web:
30 | denom: uakt
31 | amount: 10
32 |
33 | deployment:
34 | web:
35 | global:
36 | profile: web
37 | count: 1
38 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-multi-groups-ip-endpoint.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | ip: "meow"
12 | accept:
13 | - test.localhost
14 | anotherweb:
15 | image: quay.io/ovrclk/demo-app
16 | expose:
17 | - port: 80
18 | to:
19 | - global: true
20 | ip: "kittens"
21 | accept:
22 | - extratest.localhost
23 |
24 | profiles:
25 | compute:
26 | web:
27 | resources:
28 | cpu:
29 | units: "0.01"
30 | memory:
31 | size: "128Mi"
32 | storage:
33 | size: "512Mi"
34 | bob:
35 | resources:
36 | cpu:
37 | units: "0.13"
38 | memory:
39 | size: "256Mi"
40 | storage:
41 | size: "99Mi"
42 |
43 | placement:
44 | global:
45 | pricing:
46 | web:
47 | denom: uakt
48 | amount: 10
49 | bob:
50 | pricing:
51 | bob:
52 | denom: uakt
53 | amount: 99
54 |
55 | deployment:
56 | web:
57 | global:
58 | profile: web
59 | count: 1
60 | anotherweb:
61 | bob:
62 | profile: bob
63 | count: 3
64 |
65 | endpoints:
66 | meow:
67 | kind: "ip"
68 | kittens:
69 | kind: "ip"
70 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-multi-ip-endpoint.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | ip: "meow"
12 | accept:
13 | - test.localhost
14 | anotherweb:
15 | image: quay.io/ovrclk/demo-app
16 | expose:
17 | - port: 80
18 | to:
19 | - global: true
20 | ip: "kittens"
21 | accept:
22 | - extratest.localhost
23 |
24 | profiles:
25 | compute:
26 | web:
27 | resources:
28 | cpu:
29 | units: "0.01"
30 | memory:
31 | size: "128Mi"
32 | storage:
33 | size: "512Mi"
34 |
35 | placement:
36 | global:
37 | pricing:
38 | web:
39 | denom: uakt
40 | amount: 10
41 |
42 | deployment:
43 | web:
44 | global:
45 | profile: web
46 | count: 1
47 | anotherweb:
48 | global:
49 | profile: web
50 | count: 3
51 |
52 | endpoints:
53 | meow:
54 | kind: "ip"
55 | kittens:
56 | kind: "ip"
57 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-newcontainer.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app-2
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | accept:
12 | - test.localhost
13 |
14 | profiles:
15 | compute:
16 | web:
17 | resources:
18 | cpu:
19 | units: "0.01"
20 | memory:
21 | size: "128Mi"
22 | storage:
23 | size: "512Mi"
24 |
25 | placement:
26 | global:
27 | pricing:
28 | web:
29 | denom: uakt
30 | amount: 10
31 |
32 | deployment:
33 | web:
34 | global:
35 | profile: web
36 | count: 1
37 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-nodeport.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: hydrogen18/hello_world:20201209
7 | expose:
8 | - port: 10000
9 | as: 10000
10 | to:
11 | - global: true
12 | - port: 10000
13 | as: 10000
14 | proto: UDP
15 | to:
16 | - global: true
17 |
18 | profiles:
19 | compute:
20 | web:
21 | resources:
22 | cpu:
23 | units: 0.1
24 | memory:
25 | size: 16Mi
26 | storage:
27 | size: 128Mi
28 | placement:
29 | global:
30 | pricing:
31 | web:
32 | denom: uakt
33 | amount: 9000
34 |
35 | deployment:
36 | web:
37 | global:
38 | profile: web
39 | count: 1
40 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-nohost.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 |
12 | profiles:
13 | compute:
14 | web:
15 | resources:
16 | cpu:
17 | units: "0.01"
18 | memory:
19 | size: "128Mi"
20 | storage:
21 | size: "512Mi"
22 |
23 | placement:
24 | global:
25 | pricing:
26 | web:
27 | denom: uakt
28 | amount: 10
29 |
30 | deployment:
31 | web:
32 | global:
33 | profile: web
34 | count: 1
35 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-shared-ip-endpoint.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | ip: "meow"
12 | accept:
13 | - test.localhost
14 | anotherweb:
15 | image: quay.io/ovrclk/demo-app
16 | expose:
17 | - port: 80
18 | as: 81
19 | to:
20 | - global: true
21 | ip: "meow"
22 | accept:
23 | - extratest.localhost
24 |
25 | profiles:
26 | compute:
27 | web:
28 | resources:
29 | cpu:
30 | units: "0.01"
31 | memory:
32 | size: "128Mi"
33 | storage:
34 | size: "512Mi"
35 |
36 | placement:
37 | global:
38 | pricing:
39 | web:
40 | denom: uakt
41 | amount: 10
42 |
43 | deployment:
44 | web:
45 | global:
46 | profile: web
47 | count: 1
48 | anotherweb:
49 | global:
50 | profile: web
51 | count: 3
52 |
53 | endpoints:
54 | meow:
55 | kind: "ip"
56 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-storage-beta2.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: ovrclk/e2e-test
6 | expose:
7 | - port: 8080
8 | as: 80
9 | to:
10 | - global: true
11 | accept:
12 | - webdistest.localhost
13 | params:
14 | storage:
15 | data:
16 | mount: /var/lib/e2e-test
17 | profiles:
18 | compute:
19 | web:
20 | resources:
21 | cpu:
22 | units: "0.01"
23 | memory:
24 | size: "128Mi"
25 | storage:
26 | - size: "512Mi"
27 | - name: data
28 | size: "128Mi"
29 | attributes:
30 | persistent: "true"
31 | class: beta2
32 | placement:
33 | global:
34 | pricing:
35 | web:
36 | denom: uakt
37 | amount: 10
38 | deployment:
39 | web:
40 | global:
41 | profile: web
42 | count: 1
43 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-storage-default.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: ovrclk/e2e-test
6 | expose:
7 | - port: 8080
8 | as: 80
9 | to:
10 | - global: true
11 | accept:
12 | - webdistest.localhost
13 | params:
14 | storage:
15 | data:
16 | mount: /var/lib/e2e-test
17 | bew:
18 | image: ovrclk/e2e-test
19 | expose:
20 | - port: 8080
21 | as: 81
22 | to:
23 | - global: true
24 | accept:
25 | - webdistest2.localhost
26 | profiles:
27 | compute:
28 | web:
29 | resources:
30 | cpu:
31 | units: "0.01"
32 | memory:
33 | size: "128Mi"
34 | storage:
35 | - size: "512Mi"
36 | - name: data
37 | size: "128Mi"
38 | attributes:
39 | persistent: "true"
40 | bew:
41 | resources:
42 | cpu:
43 | units: "0.01"
44 | memory:
45 | size: "128Mi"
46 | storage:
47 | - size: "512Mi"
48 | placement:
49 | global:
50 | pricing:
51 | web:
52 | denom: uakt
53 | amount: 100
54 | bew:
55 | denom: uakt
56 | amount: 100
57 | deployment:
58 | web:
59 | global:
60 | profile: web
61 | count: 1
62 | bew:
63 | global:
64 | profile: bew
65 | count: 1
66 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-storage-ram.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: ghcr.io/ovrclk/e2e-test
6 | expose:
7 | - port: 8080
8 | as: 80
9 | to:
10 | - global: true
11 | accept:
12 | - webdistest.localhost
13 | # params:
14 | # storage:
15 | # shm:
16 | # mount: /dev/shm
17 | profiles:
18 | compute:
19 | web:
20 | resources:
21 | cpu:
22 | units: "0.01"
23 | memory:
24 | size: "128Mi"
25 | storage:
26 | - size: "512Mi"
27 | # - name: shm
28 | # size: "256Mi"
29 | # attributes:
30 | # class: ram
31 | placement:
32 | global:
33 | pricing:
34 | web:
35 | denom: uakt
36 | amount: 10
37 | deployment:
38 | web:
39 | global:
40 | profile: web
41 | count: 1
42 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-storage-updateA.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | accept:
12 | - testupdatea.localhost
13 | params:
14 | storage:
15 | data:
16 | mount: /var/lib/e2e-test
17 | profiles:
18 | compute:
19 | web:
20 | resources:
21 | cpu:
22 | units: "0.01"
23 | memory:
24 | size: "128Mi"
25 | storage:
26 | - size: "512Mi"
27 | - name: data
28 | size: "128Mi"
29 | attributes:
30 | persistent: "true"
31 | placement:
32 | global:
33 | pricing:
34 | web:
35 | denom: uakt
36 | amount: 10
37 |
38 | deployment:
39 | web:
40 | global:
41 | profile: web
42 | count: 1
43 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-storage-updateB.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | accept:
12 | - testupdatea.localhost
13 | - testupdateb.localhost
14 | params:
15 | storage:
16 | data:
17 | mount: /var/lib/e2e-test
18 | profiles:
19 | compute:
20 | web:
21 | resources:
22 | cpu:
23 | units: "0.01"
24 | memory:
25 | size: "128Mi"
26 | storage:
27 | - size: "512Mi"
28 | - name: data
29 | size: "128Mi"
30 | attributes:
31 | persistent: "true"
32 | placement:
33 | global:
34 | pricing:
35 | web:
36 | denom: uakt
37 | amount: 10
38 |
39 | deployment:
40 | web:
41 | global:
42 | profile: web
43 | count: 1
44 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-updateA.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | accept:
12 | - testupdatea.localhost
13 |
14 | profiles:
15 | compute:
16 | web:
17 | resources:
18 | cpu:
19 | units: "0.01"
20 | memory:
21 | size: "128Mi"
22 | storage:
23 | size: "512Mi"
24 |
25 | placement:
26 | global:
27 | pricing:
28 | web:
29 | denom: uakt
30 | amount: 10
31 |
32 | deployment:
33 | web:
34 | global:
35 | profile: web
36 | count: 1
37 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2-updateB.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | accept:
12 | - testupdatea.localhost
13 | - testupdateb.localhost
14 |
15 | profiles:
16 | compute:
17 | web:
18 | resources:
19 | cpu:
20 | units: "0.01"
21 | memory:
22 | size: "128Mi"
23 | storage:
24 | size: "512Mi"
25 |
26 | placement:
27 | global:
28 | pricing:
29 | web:
30 | denom: uakt
31 | amount: 10
32 |
33 | deployment:
34 | web:
35 | global:
36 | profile: web
37 | count: 1
38 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment-v2.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | accept:
12 | - test.localhost
13 |
14 | profiles:
15 | compute:
16 | web:
17 | resources:
18 | cpu:
19 | units: "0.01"
20 | memory:
21 | size: "128Mi"
22 | storage:
23 | size: "512Mi"
24 |
25 | placement:
26 | global:
27 | pricing:
28 | web:
29 | denom: uakt
30 | amount: 10
31 |
32 | deployment:
33 | web:
34 | global:
35 | profile: web
36 | count: 1
37 |
--------------------------------------------------------------------------------
/testdata/deployment/deployment.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | web:
6 | image: bubuntux/riot-web
7 | expose:
8 | - port: 80
9 | to:
10 | - global: true
11 | accept:
12 | - test.localhost
13 |
14 | profiles:
15 | compute:
16 | web:
17 | resources:
18 | cpu:
19 | units: "0.01"
20 | memory:
21 | size: "128Mi"
22 | storage:
23 | size: "512Mi"
24 |
25 | placement:
26 | global:
27 | pricing:
28 | web:
29 | denom: uakt
30 | amount: 30
31 |
32 | deployment:
33 | web:
34 | global:
35 | profile: web
36 | count: 1
37 |
--------------------------------------------------------------------------------
/testdata/sdl/deployment-svc-mismatch.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | profiles:
17 | compute:
18 | web:
19 | resources:
20 | cpu:
21 | units: "100m"
22 | memory:
23 | size: "128Mi"
24 | storage:
25 | size: "1Gi"
26 | placement:
27 | westcoast:
28 | attributes:
29 | region: us-west
30 | signedBy:
31 | anyOf:
32 | - 1
33 | - 2
34 | allOf:
35 | - 3
36 | - 4
37 | pricing:
38 | web:
39 | denom: uakt
40 | amount: 50
41 | deployment:
42 | webapp:
43 | westcoast:
44 | profile: web
45 | count: 2
46 |
--------------------------------------------------------------------------------
/testdata/sdl/private_service.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | bind:
5 | image: bind9
6 | expose:
7 | - port: 53
8 | proto: udp
9 | to:
10 | - global: true
11 |
12 | pg:
13 | image: postgresql
14 | expose:
15 | - port: 5463
16 | to:
17 | - service: bind
18 |
19 | profiles:
20 | compute:
21 | bind:
22 | resources:
23 | cpu:
24 | units: "50m"
25 | memory:
26 | size: "64Mi"
27 | storage:
28 | size: "16Mi"
29 | pg:
30 | resources:
31 | cpu:
32 | units: "500m"
33 | memory:
34 | size: "512Mi"
35 | storage:
36 | size: "1000Mi"
37 |
38 | placement:
39 | westcoast:
40 | attributes:
41 | region: us-west
42 | signedBy:
43 | anyOf:
44 | - 1
45 | - 2
46 | allOf:
47 | - 3
48 | - 4
49 | pricing:
50 | pg:
51 | denom: uakt
52 | amount: 1000
53 | bind:
54 | denom: uakt
55 | amount: 333
56 | deployment:
57 | pg:
58 | westcoast:
59 | profile: pg
60 | count: 1
61 | bind:
62 | westcoast:
63 | profile: bind
64 | count: 8
65 |
--------------------------------------------------------------------------------
/testdata/sdl/profile-svc-name-mismatch.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 |
4 | services:
5 | webapp:
6 | image: quay.io/ovrclk/demo-app
7 | expose:
8 | - port: 80
9 | as: 80
10 | accept:
11 | - thehostname.com
12 | to:
13 | - global: true
14 |
15 | profiles:
16 | compute:
17 | web:
18 | resources:
19 | cpu:
20 | units: "100m"
21 | memory:
22 | size: "512Mi"
23 | storage:
24 | size: "512Mi"
25 | placement:
26 | san-jose:
27 | attributes:
28 | region: sjc
29 | pricing:
30 | web:
31 | denom: uakt
32 | amount: 25
33 |
34 | deployment:
35 | webapp:
36 | san-jose:
37 | profile: web
38 | count: 1
39 |
--------------------------------------------------------------------------------
/testdata/sdl/simple-double-ram.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | profiles:
17 | compute:
18 | web:
19 | resources:
20 | cpu:
21 | units: "100m"
22 | memory:
23 | size: "256Mi"
24 | storage:
25 | size: "1Gi"
26 | placement:
27 | westcoast:
28 | attributes:
29 | region: us-west
30 | signedBy:
31 | anyOf:
32 | - 1
33 | - 2
34 | allOf:
35 | - 3
36 | - 4
37 | pricing:
38 | web:
39 | denom: uakt
40 | amount: 50
41 | deployment:
42 | web:
43 | westcoast:
44 | profile: web
45 | count: 2
46 |
--------------------------------------------------------------------------------
/testdata/sdl/simple.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | profiles:
17 | compute:
18 | web:
19 | resources:
20 | cpu:
21 | units: "100m"
22 | memory:
23 | size: "128Mi"
24 | storage:
25 | size: "1Gi"
26 | placement:
27 | westcoast:
28 | attributes:
29 | region: us-west
30 | signedBy:
31 | anyOf:
32 | - 1
33 | - 2
34 | allOf:
35 | - 3
36 | - 4
37 | pricing:
38 | web:
39 | denom: uakt
40 | amount: 50
41 | deployment:
42 | web:
43 | westcoast:
44 | profile: web
45 | count: 2
46 |
--------------------------------------------------------------------------------
/testdata/sdl/simple2.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | bew:
17 | image: nginx
18 | expose:
19 | - port: 8080
20 | accept:
21 | - bhostname.com
22 | to:
23 | - global: true
24 | - port: 12346
25 | to:
26 | - global: true
27 | proto: udp
28 | - port: 12347
29 | to:
30 | - global: true
31 | proto: udp
32 | profiles:
33 | compute:
34 | bew:
35 | resources:
36 | cpu:
37 | units: "100m"
38 | memory:
39 | size: "128Mi"
40 | storage:
41 | size: "1Gi"
42 | placement:
43 | westcoast:
44 | attributes:
45 | region: us-west
46 | signedBy:
47 | anyOf:
48 | - 1
49 | - 2
50 | allOf:
51 | - 3
52 | - 4
53 | pricing:
54 | web:
55 | denom: uakt
56 | amount: 50
57 | bew:
58 | denom: uakt
59 | amount: 50
60 | deployment:
61 | web:
62 | westcoast:
63 | profile: bew
64 | count: 2
65 |
--------------------------------------------------------------------------------
/testdata/sdl/storageClass1.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | params:
17 | storage:
18 | configs:
19 | profiles:
20 | compute:
21 | web:
22 | resources:
23 | cpu:
24 | units: "100m"
25 | memory:
26 | size: "128Mi"
27 | storage:
28 | - size: "1Gi"
29 | - size: 1Gi
30 | name: configs
31 | attributes:
32 | persistent: true
33 | placement:
34 | westcoast:
35 | attributes:
36 | region: us-west
37 | signedBy:
38 | anyOf:
39 | - 1
40 | - 2
41 | allOf:
42 | - 3
43 | - 4
44 | pricing:
45 | web:
46 | denom: uakt
47 | amount: 50
48 | deployment:
49 | web:
50 | westcoast:
51 | profile: web
52 | count: 1
53 |
--------------------------------------------------------------------------------
/testdata/sdl/storageClass2.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | params:
17 | storage:
18 | configs:
19 | mount: etc/nginx
20 | profiles:
21 | compute:
22 | web:
23 | resources:
24 | cpu:
25 | units: "100m"
26 | memory:
27 | size: "128Mi"
28 | storage:
29 | - size: 1Gi
30 | - size: 1Gi
31 | name: configs
32 | attributes:
33 | persistent: true
34 | placement:
35 | westcoast:
36 | attributes:
37 | region: us-west
38 | signedBy:
39 | anyOf:
40 | - 1
41 | - 2
42 | allOf:
43 | - 3
44 | - 4
45 | pricing:
46 | web:
47 | denom: uakt
48 | amount: 50
49 | deployment:
50 | web:
51 | westcoast:
52 | profile: web
53 | count: 1
54 |
--------------------------------------------------------------------------------
/testdata/sdl/storageClass3.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | params:
17 | storage:
18 | data:
19 | profiles:
20 | compute:
21 | web:
22 | resources:
23 | cpu:
24 | units: "100m"
25 | memory:
26 | size: "128Mi"
27 | storage:
28 | - size: 1Gi
29 | - size: 1Gi
30 | name: configs
31 | attributes:
32 | persistent: true
33 | placement:
34 | westcoast:
35 | attributes:
36 | region: us-west
37 | signedBy:
38 | anyOf:
39 | - 1
40 | - 2
41 | allOf:
42 | - 3
43 | - 4
44 | pricing:
45 | web:
46 | denom: uakt
47 | amount: 50
48 | deployment:
49 | web:
50 | westcoast:
51 | profile: web
52 | count: 1
53 |
--------------------------------------------------------------------------------
/testdata/sdl/storageClass4.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | params:
17 | storage:
18 | config:
19 | mount: /etc/nginx
20 | data:
21 | mount: /etc/nginx
22 | profiles:
23 | compute:
24 | web:
25 | resources:
26 | cpu:
27 | units: "100m"
28 | memory:
29 | size: "128Mi"
30 | storage:
31 | - size: 1Gi
32 | - size: 1Gi
33 | name: config
34 | attributes:
35 | persistent: true
36 | - size: 1Gi
37 | name: data
38 | attributes:
39 | persistent: true
40 | placement:
41 | westcoast:
42 | attributes:
43 | region: us-west
44 | signedBy:
45 | anyOf:
46 | - 1
47 | - 2
48 | allOf:
49 | - 3
50 | - 4
51 | pricing:
52 | web:
53 | denom: uakt
54 | amount: 50
55 | deployment:
56 | web:
57 | westcoast:
58 | profile: web
59 | count: 1
60 |
--------------------------------------------------------------------------------
/testdata/sdl/storageClass5.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | version: "2.0"
3 | services:
4 | web:
5 | image: nginx
6 | expose:
7 | - port: 80
8 | accept:
9 | - ahostname.com
10 | to:
11 | - global: true
12 | - port: 12345
13 | to:
14 | - global: true
15 | proto: udp
16 | params:
17 | storage:
18 | profiles:
19 | compute:
20 | web:
21 | resources:
22 | cpu:
23 | units: "100m"
24 | memory:
25 | size: "128Mi"
26 | storage:
27 | - size: "1Gi"
28 | - size: 1Gi
29 | name: configs
30 | attributes:
31 | persistent: true
32 | placement:
33 | westcoast:
34 | attributes:
35 | region: us-west
36 | signedBy:
37 | anyOf:
38 | - 1
39 | - 2
40 | allOf:
41 | - 3
42 | - 4
43 | pricing:
44 | web:
45 | denom: uakt
46 | amount: 50
47 | deployment:
48 | web:
49 | westcoast:
50 | profile: web
51 | count: 1
52 |
--------------------------------------------------------------------------------
/testutil/manifest/v2beta1/manifest.go:
--------------------------------------------------------------------------------
1 | package v2beta1
2 |
3 | import (
4 | "testing"
5 |
6 | manifest "github.com/akash-network/akash-api/go/manifest/v2beta1"
7 | )
8 |
9 | var (
10 | // DefaultManifestGenerator is the default test manifest generator
11 | DefaultManifestGenerator = RandManifestGenerator
12 |
13 | // Generators is a list of all available manifest generators
14 | Generators = []struct {
15 | Name string
16 | Generator Generator
17 | }{
18 | {"overflow", OverflowManifestGenerator},
19 | {"random", RandManifestGenerator},
20 | {"app", AppManifestGenerator},
21 | }
22 | )
23 |
24 | // Generator is an interface for generating test manifests
25 | type Generator interface {
26 | Manifest(t testing.TB) manifest.Manifest
27 | Group(t testing.TB) manifest.Group
28 | Service(t testing.TB) manifest.Service
29 | ServiceExpose(t testing.TB) manifest.ServiceExpose
30 | }
31 |
--------------------------------------------------------------------------------
/testutil/manifest/v2beta2/manifest.go:
--------------------------------------------------------------------------------
1 | package v2beta2
2 |
3 | import (
4 | "testing"
5 |
6 | manifest "github.com/akash-network/akash-api/go/manifest/v2beta2"
7 | )
8 |
9 | var (
10 | // DefaultManifestGenerator is the default test manifest generator
11 | DefaultManifestGenerator = RandManifestGenerator
12 |
13 | // Generators is a list of all available manifest generators
14 | Generators = []struct {
15 | Name string
16 | Generator Generator
17 | }{
18 | {"overflow", OverflowManifestGenerator},
19 | {"random", RandManifestGenerator},
20 | {"app", AppManifestGenerator},
21 | }
22 | )
23 |
24 | // Generator is an interface for generating test manifests
25 | type Generator interface {
26 | Manifest(t testing.TB) manifest.Manifest
27 | Group(t testing.TB) manifest.Group
28 | Service(t testing.TB) manifest.Service
29 | ServiceExpose(t testing.TB) manifest.ServiceExpose
30 | }
31 |
--------------------------------------------------------------------------------
/testutil/manifest/v2beta2/manifest_rand.go:
--------------------------------------------------------------------------------
1 | package v2beta2
2 |
3 | import (
4 | "math"
5 | "math/rand"
6 | "testing"
7 |
8 | manifest "github.com/akash-network/akash-api/go/manifest/v2beta2"
9 | atestutil "github.com/akash-network/node/testutil"
10 | )
11 |
12 | // RandManifestGenerator generates a manifest with random values
13 | var RandManifestGenerator Generator = manifestGeneratorRand{}
14 |
15 | type manifestGeneratorRand struct{}
16 |
17 | func (mg manifestGeneratorRand) Manifest(t testing.TB) manifest.Manifest {
18 | t.Helper()
19 | return []manifest.Group{
20 | mg.Group(t),
21 | }
22 | }
23 |
24 | func (mg manifestGeneratorRand) Group(t testing.TB) manifest.Group {
25 | t.Helper()
26 | return manifest.Group{
27 | Name: atestutil.Name(t, "manifest-group"),
28 | Services: []manifest.Service{
29 | mg.Service(t),
30 | },
31 | }
32 | }
33 |
34 | func (mg manifestGeneratorRand) Service(t testing.TB) manifest.Service {
35 | t.Helper()
36 | return manifest.Service{
37 | Name: "demo",
38 | Image: "quay.io/ovrclk/demo-app",
39 | Args: []string{"run"},
40 | Env: []string{"AKASH_TEST_SERVICE=true"},
41 | Resources: atestutil.ResourceUnits(t),
42 | Count: rand.Uint32(), // nolint: gosec
43 | Expose: []manifest.ServiceExpose{
44 | mg.ServiceExpose(t),
45 | },
46 | }
47 | }
48 |
49 | func (mg manifestGeneratorRand) ServiceExpose(t testing.TB) manifest.ServiceExpose {
50 | return manifest.ServiceExpose{
51 | Port: uint32(rand.Intn(math.MaxUint16)), // nolint: gosec
52 | ExternalPort: uint32(rand.Intn(math.MaxUint16)), // nolint: gosec
53 | Proto: "TCP",
54 | Service: "svc",
55 | Global: true,
56 | Hosts: []string{
57 | atestutil.Hostname(t),
58 | },
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/testutil/network.go:
--------------------------------------------------------------------------------
1 | package testutil
2 |
3 | import (
4 | "net"
5 | )
6 |
7 | // GetFreePorts asks the kernel for free open ports that are ready to use.
8 | func GetFreePorts(count int) ([]int, error) {
9 | var ports []int
10 |
11 | listeners := make([]*net.TCPListener, 0, count)
12 |
13 | defer func() {
14 | for _, l := range listeners {
15 | _ = l.Close()
16 | }
17 | }()
18 |
19 | for i := 0; i < count; i++ {
20 | addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
21 | if err != nil {
22 | return nil, err
23 | }
24 |
25 | l, err := net.ListenTCP("tcp", addr)
26 | if err != nil {
27 | return nil, err
28 | }
29 |
30 | listeners = append(listeners, l)
31 | ports = append(ports, l.Addr().(*net.TCPAddr).Port)
32 | }
33 |
34 | return ports, nil
35 | }
36 |
--------------------------------------------------------------------------------
/testutil/rest/restserver.go:
--------------------------------------------------------------------------------
1 | package rest
2 |
3 | import (
4 | "context"
5 | "net"
6 | "net/http"
7 | "net/http/httptest"
8 | "testing"
9 |
10 | gwutils "github.com/akash-network/provider/gateway/utils"
11 | )
12 |
13 | func NewServer(ctx context.Context, t testing.TB, handler http.Handler, cquery gwutils.CertGetter, sni string) *httptest.Server {
14 | t.Helper()
15 |
16 | ts := httptest.NewUnstartedServer(handler)
17 |
18 | ts.Config.BaseContext = func(_ net.Listener) context.Context {
19 | return ctx
20 | }
21 |
22 | var err error
23 | ts.TLS, err = gwutils.NewServerTLSConfig(ctx, cquery, sni)
24 | if err != nil {
25 | t.Fatal(err.Error())
26 | }
27 |
28 | ts.StartTLS()
29 |
30 | return ts
31 | }
32 |
--------------------------------------------------------------------------------
/tools.go:
--------------------------------------------------------------------------------
1 | //go:build tools
2 |
3 | package tools
4 |
5 | // nolint
6 | import (
7 | _ "github.com/vektra/mockery/v2"
8 | _ "k8s.io/code-generator"
9 | _ "sigs.k8s.io/kind"
10 | )
11 |
--------------------------------------------------------------------------------
/tools/pconfig/pconfig.go:
--------------------------------------------------------------------------------
1 | package pconfig
2 |
3 | import (
4 | "context"
5 | "crypto"
6 | "crypto/x509"
7 | "errors"
8 | "fmt"
9 | "math/big"
10 |
11 | cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
12 | sdk "github.com/cosmos/cosmos-sdk/types"
13 | )
14 |
15 | var (
16 | ErrInvalidArgs = errors.New("pstorage: invalid arguments")
17 | ErrNotExists = errors.New("pstorage: not exists")
18 | ErrExists = errors.New("pstorage: exists")
19 | ErrAccountNotExists = fmt.Errorf("%w: account", ErrNotExists)
20 | ErrAccountExists = fmt.Errorf("%w: account", ErrExists)
21 | ErrCertificateNotExists = fmt.Errorf("%w: certificate", ErrNotExists)
22 | ErrCertificateExists = fmt.Errorf("%w: certificate", ErrExists)
23 | )
24 |
25 | type StorageR interface {
26 | GetAccountPublicKey(context.Context, sdk.Address) (cryptotypes.PubKey, error)
27 | GetAccountCertificate(context.Context, sdk.Address, *big.Int) (*x509.Certificate, crypto.PublicKey, error)
28 | GetAllCertificates(ctx context.Context) ([]*x509.Certificate, error)
29 | }
30 |
31 | type StorageW interface {
32 | AddAccount(context.Context, sdk.Address, cryptotypes.PubKey) error
33 | DelAccount(context.Context, sdk.Address) error
34 | AddAccountCertificate(context.Context, sdk.Address, *x509.Certificate, crypto.PublicKey) error
35 | DelAccountCertificate(context.Context, sdk.Address, *big.Int) error
36 | }
37 |
38 | type Storage interface {
39 | StorageR
40 | StorageW
41 | Close() error
42 | }
43 |
--------------------------------------------------------------------------------
/types/types.go:
--------------------------------------------------------------------------------
1 | package types
2 |
3 | const (
4 | PubSubTopicLeasesStatus = "leases-status"
5 | PubSubTopicProviderStatus = "provider-status"
6 | PubSubTopicClusterStatus = "cluster-status"
7 | PubSubTopicBidengineStatus = "bidengine-status"
8 | PubSubTopicManifestStatus = "manifest-status"
9 | PubSubTopicInventoryStatus = "inventory-status"
10 | )
11 |
--------------------------------------------------------------------------------