The EBS CSI Driver comes with a Makefile that can be used to develop, build, test, and release the driver. This file documents Makefile targets, the parameters they support, and common usage scenarios.
The Makefile has the following dependencies:
go: https://go.dev/doc/installpython(may be namedpython3) andpip: https://www.python.org/downloads/jq: https://github.com/jqlang/jq/releaseskubectl: https://kubernetes.io/docs/tasks/tools/#kubectlgit: https://git-scm.com/downloadsdockeranddocker buildx: https://docs.docker.com/get-docker/ and https://github.com/docker/buildx#installingmake- Standard POSIX tools (
awk,grep,cat, etc)
All other tools are downloaded for you at runtime.
Build and push an image of the driver for local development. Environment variables are accepted to override the REGISTRY, IMAGE name, and image TAG. Setting FIPS to true will build an image using a FIPS-validated cryptographic library.
Build and push all image variants of the driver needed for an official release. This target is not intended or designed to be run outside of CI.
Build a binary copy of the EBS CSI Driver for the local platform. This is the default behavior when calling make with no target.
The target OS and/or architecture can be overridden via the OS and ARCH environment variables (for example, OS=linux ARCH=arm64 make)
Run all unit tests with race condition checking enabled.
Performs local verification that other than unit tests (linters, manifest updates, etc)
Updates Kustomize manifests, formatting, and tidies go.mod. make verify will ensure that make update was run by checking if it creates a diff.
Creates a cluster for running E2E tests against. There are many parameters that can be provided via environment variables, a full list is available in config.sh, but the primary parameters are:
CLUSTER_TYPE: The tool used to create the cluster, eitherkopsoreksctl- defaults tokopsCLUSTER_NAME: The name of the cluster to create - defaults toebs-csi-e2e.k8s.localINSTANCE_TYPE: The instance type to use for cluster nodes - defaults toc5.largeAMI_PARAMETER: The SSM parameter of where to get the AMI for the cluster nodes (kopsclusters only) - defaults to/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64WINDOWS: Whether or not to create a Windows node group for the cluster (eksctlclusters only) - defaults tofalseAWS_REGION: Which region to create the cluster in - defaults tous-west-2AWS_AVAILABILITY_ZONES: Which AZs to create nodes for the cluster in - defaults tous-west-2a,us-west-2b,us-west-2cOUTPOST_ARN: If set, create an additional nodegroup on an outpost (`eksctl clusters only)OUTPOST_INSTANCE_TYPE: The instance type to use for the outpost nodegroup (only used whenOUTPOST_ARNis non-empty) - defaults toINSTANCE_TYPE
make cluster/createexport AWS_AVAILABILITY_ZONES="us-west-2a"
make cluster/createexport CLUSTER_TYPE="eksctl"
make cluster/createexport INSTANCE_TYPE="m7g.medium"
export AMI_PARAMETER="/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-arm64"
make cluster/createexport WINDOWS="true"
export CLUSTER_TYPE="eksctl"
make cluster/createexport CLUSTER_TYPE="eksctl"
export OUTPOST_ARN="arn:aws:outposts:us-east-1:123456789012:outpost/op-0f39f7c0af9b166a3"
export OUTPOST_INSTANCE_TYPE=c5.xlarge
make cluster/createBuilds an image for use in the E2E tests. This will automatically build the most appropriate image (for example, skipping Windows builds unless WINDOWS is set to true).
make cluster/imageexport IMAGE_ARCH="arm64"
make cluster/imageexport WINDOWS="true"
make cluster/imagePrints the KUBECONFIG environment variable for a cluster. You must pass the same CLUSTER_TYPE and CLUSTER_NAME as used when creating the cluster. This command must be evaled to import the environment variables into your shell.
eval "$(make cluster/kubeconfig)"export CLUSTER_TYPE="eksctl"
eval "$(make cluster/kubeconfig)"Deletes a cluster created by make cluster/create. You must pass the same CLUSTER_TYPE and CLUSTER_NAME as used when creating the cluster.
Install the EBS CSI Driver to the cluster via Helm. You must have already run make cluster/image to build the image for the cluster, or provide an image of your own.
make cluster/installUninstall an installation of the EBS CSI Driver previously installed by make cluster/install.
make cluster/uninstallRun E2E tests against a cluster created by make cluster/create. You must pass the same CLUSTER_TYPE and CLUSTER_NAME as used when creating the cluster. You must have already run make cluster/image to build the image for the cluster, or provide an image of your own.
Alternatively, you may run on an externally created cluster by passing CLUSTER_TYPE (required to determine which values.yaml to deploy) and KUBECONFIG. For kops clusters, the node IAM role should include the appropriate IAM policies to use the driver (see the installation docs). For eksctl clusters, the ebs-csi-controller-sa service account should be pre-created and setup to supply an IRSA role with the appropriate policies.
Run the Kubernetes upstream external storage E2E tests. This is the most comprehensive E2E test, recommended for local development.
Run the single-AZ EBS CSI E2E tests. Requires a cluster with only one Availability Zone.
Run the multi-AZ EBS CSI E2E tests. Requires a cluster with at least two Availability Zones.
Run the Kubernetes upstream external storage E2E tests with Windows tests enabled. Requires a cluster with Windows nodes.
Run the Kubernetes upstream external storage E2E tests, but using kustomize to deploy the driver instead of helm.
Test the EBS CSI Driver Helm chart via the Helm chart-testing tool.
Convenience target to perform all image updates (including sidecars, kubekins-e2e-v2, and gcb-docker-gcloud). This is the primary target to use unless more granular control is needed.
Convenience target to perform all sidecar updates and regenerate the manifests.
Retrieves the latest sidecar container images and creates or updates hack/release-scripts/image-digests.yaml.
Updates the Kustomize and Helm sidecar tags with the values from hack/release-scripts/image-digests.yaml.