This is an official kubernetes CSI Driver for Nexgen Hyperstack platform. It uses the Hyperstack Go SDK to interact with the Hyperstack API and manage resources. The driver is written in Go and is inspired by other popular cloud adapters.
This repository contains Taskfile with various helper commands to manage current project
Before you start, make sure you have the following tools installed:
There are also CLI dependencies that are installed with Go:
Hyperstack CSI driver is deployed as a Helm chart. To provision it to the cluster:
KUBECONFIG env variable is set to kubeconfig file pathNS="csi-driver"
kubectl create namespace "${NS}"
values.yaml (see deploy/helm/values.yaml for details):
components:
csiHyperstack:
# Set tag to latest if you are testing locally pushed build
image: reg.digitalocean.ngbackend.cloud/nexgenk8s/csi-hyperstack:main-latest
hyperstackClusterId: "Your cluster ID"
hyperstack:
apiKey: "Your key"
apiAddress: "Here you can change address if needed"
helm upgrade --install -f values.yaml -n "${NS}" csi-hyperstack ./deploy/helm
kubectl -n "${NS}" get po -w
To build the driver, run the following command:
task build
If you want to push images for testing:
# User Profile -> Username
USER=""
# User Profile -> CLI Secret
PASSWORD=""
docker login -u "${USER}" -p "${PASSWORD}" https://reg.digitalocean.ngbackend.cloud
task docker-build
task docker-push
This will compile the CSI driver and output the binary in the dist
directory.
This project is intended to be used in a k8s cluster running on Hyperstack. To run it locally (for testing) you can run it directly:
export HYPERSTACK_API_KEY=""
export HYPERSTACK_API_ADDRESS=""
# Start the csi-hyperstack binary
./dist/csi-hyperstack start \
--endpoint "unix://tmp/csi-hyperstack.sock" \
--hyperstack-cluster-id "" \
--hyperstack-node-id "" \
--service-controller-enabled \
--service-node-enabled
To get more information on available commands and options run help:
./dist/csi-hyperstack --help
Better approach is using docker-compose.
task docker-build
docker-compose.local.yml with required env variables:
services:
csi-hyperstack:
environment:
HYPERSTACK_API_KEY: "Your key"
HYPERSTACK_API_ADDRESS: "Here you can change address if needed"
task start
./data/csi/csi.sock UNIX socket file is createdYou can use gRPCurl to send requests and read responses:
alias gsi='grpcurl -plaintext -unix /tmp/csi-hyperstack.sock'
gsi list
alias gsi='grpcurl -plaintext localhost:8081'
gsi list
Example output for list:
csi.v1.Controller
csi.v1.Identity
csi.v1.Node
grpc.reflection.v1.ServerReflection
grpc.reflection.v1alpha.ServerReflection
Some helpful endpoints ( see specification for more info):
gsi csi.v1.Identity/GetPluginInfo
gsi csi.v1.Identity/GetPluginCapabilities
gsi csi.v1.Controller/ControllerGetCapabilities
gsi csi.v1.Node/NodeGetCapabilities
For more information about the features of the Hyperstack API, visit the Hyperstack Documentation.
Relevant docs:
Examples (reference for development):
Contributions to this project are welcome. Please make sure to test your changes before submitting a pull request.