- Go: Ensure you have Go installed. You can download it from here.
- Docker: Required for building and testing Docker images. Download from here.
- kubectl: Kubernetes command-line tool. Install instructions here.
- Helm: Package manager for Kubernetes. Install instructions here.
- Devbox: For managing development environments. Install instructions here.
-
Clone the Repository
git clone https://github.com/linode/linode-blockstorage-csi-driver.git cd linode-blockstorage-csi-driver
-
Install Devbox
Follow the Devbox installation guide to set up Devbox on your machine.
-
Setup Environment Variables
Create a
.env
file in the root directory or export them directly in your shell:export LINODE_API_TOKEN="your-linode-api-token" export LINODE_REGION="your-preferred-region" export KUBERNETES_VERSION=v1.21.0 export LINODE_CONTROL_PLANE_MACHINE_TYPE=g6-standard-2 export LINODE_MACHINE_TYPE=g6-standard-2
-
Start Devbox Environment
devbox shell
This command initializes the development environment with all necessary dependencies.
To build the project binaries in a container(builds are run in a docker container to allow consistent builds regardless of underlying unix/linux systems):
make docker-build
To run the unit tests, use the Dockerfile.dev that copies the directory into the container allowing us to run make targets:
export DOCKERFILE=Dockerfile.dev
make docker-build && make test
To set up a development cluster for running any e2e testing/workflows, follow these steps:
-
Setup a CAPL Management Cluster
devbox run mgmt-cluster
-
Build and Push Test Image
Before building and pushing the test image, ensure you've made the necessary changes to the codebase for your testing purposes.
# Build the Docker image with your changes make docker-build IMAGE_TAG=ghcr.io/yourusername/linode-blockstorage-csi-driver:test # Push the image to the container registry make docker-push IMAGE_TAG=ghcr.io/yourusername/linode-blockstorage-csi-driver:test
Note: Replace
yourusername
with your actual GitHub username or organization name.If you need to make changes to the Dockerfile or build process:
- Modify the
Dockerfile
in the project root if needed. - Update the
Makefile
if you need to change build arguments or processes. - If you've added new dependencies, ensure they're properly included in the build.
After pushing, verify that your image is available in the GitHub Container Registry before proceeding to create the test cluster.
- Modify the
-
Create a CAPL Child Test Cluster
IMAGE_NAME=ghcr.io/yourusername/linode-blockstorage-csi-driver IMAGE_VERSION=test devbox run capl-cluster
This will create a testing cluster with the necessary components to run end-to-end testing or workflows for the Linode BlockStorage CSI Driver.
For more detailed instructions on running the actual end-to-end tests, refer to the e2e Tests README.
Ensure your code adheres to the project's coding standards by running:
make lint
Update and maintain documentation as you develop new features or make changes. Ensure that all new functionalities are well-documented in the README.md
or relevant documentation files.