๐ ๏ธ Developer Setup
๐ฆ Prerequisites
- 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.
- Mise: For managing development environments. Install instructions here.
๐ Setting Up the Local Development Environment
-
Clone the Repository
git clone https://github.com/linode/linode-blockstorage-csi-driver.git cd linode-blockstorage-csi-driver -
Install the pinned toolchain from the repository root
mise install
- Run commands through mise so the pinned toolchain is used:
mise run test
-
Setup Environment Variables
Create a
.envfile 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
๐ ๏ธ Building the Project
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):
mise run image-build
๐งช Running Unit Tests
Unit tests, vetting, and linting automatically build and use the Dockerfile.dev image. Formatting and dependency verification run directly through the mise-managed Go toolchain:
mise run test
๐งช Create a Development Cluster
To set up a development cluster for running any e2e testing/workflows, follow these steps:
-
Setup a CAPL Management Cluster
mise run build mise 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 IMAGE_TAG=ghcr.io/yourusername/linode-blockstorage-csi-driver:test mise run image-build # Push the image to the container registry IMAGE_TAG=ghcr.io/yourusername/linode-blockstorage-csi-driver:test mise run image-pushNote: Replace
yourusernamewith your actual GitHub username or organization name.If you need to make changes to the Dockerfile or build process:
- Modify the
Dockerfilein the project root if needed. - Update the
Justfileif 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 mise 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.
๐ง Linting and Formatting
Ensure your code adheres to the projectโs coding standards by running:
mise run lint
๐ Documentation
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.