๐Ÿ› ๏ธ 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

  1. Clone the Repository

     git clone https://github.com/linode/linode-blockstorage-csi-driver.git
     cd linode-blockstorage-csi-driver
    
  2. Install the pinned toolchain from the repository root

mise install
  1. Run commands through mise so the pinned toolchain is used:
mise run test
  1. 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
    

๐Ÿ› ๏ธ 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:

  1. Setup a CAPL Management Cluster

     mise run build
     mise run mgmt-cluster
    
  2. 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-push
    

    Note: Replace yourusername with your actual GitHub username or organization name.

    If you need to make changes to the Dockerfile or build process:

    1. Modify the Dockerfile in the project root if needed.
    2. Update the Justfile if you need to change build arguments or processes.
    3. 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.

  3. 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.


This site uses Just the Docs, a documentation theme for Jekyll.