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/downloadsdocker
anddocker 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 a single image of the driver based on the local platform (the same overrides as make
apply, as well as OSVERSION
to override container OS version). In most cases, make all-push
is more suitable. Environment variables are accepted to override the REGISTRY
, IMAGE
name, and image TAG
.
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, eitherkops
oreksctl
- defaults tokops
CLUSTER_NAME
: The name of the cluster to create - defaults toebs-csi-e2e.k8s.local
INSTANCE_TYPE
: The instance type to use for cluster nodes - defaults toc5.large
AMI_PARAMETER
: The SSM parameter of where to get the AMI for the cluster nodes (kops
clusters only) - defaults to/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64
WINDOWS
: Whether or not to create a Windows node group for the cluster (eksctl
clusters only) - defaults tofalse
AWS_REGION
: Which region to create the cluster in - defaults tous-west-2
AWS_AVAILABILITY_ZONES
: Which AZs to create nodes for the cluster in - defaults tous-west-2a,us-west-2b,us-west-2c
make cluster/create
export AWS_AVAILABILITY_ZONES="us-west-2a"
make cluster/create
export CLUSTER_TYPE="eksctl"
make cluster/create
export INSTANCE_TYPE="m7g.medium"
export AMI_PARAMETER="/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-arm64"
make cluster/create
export WINDOWS="true"
export CLUSTER_TYPE="eksctl"
make cluster/create
Builds 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/image
export IMAGE_ARCH="arm64"
make cluster/image
export WINDOWS="true"
make cluster/image
Prints 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 eval
ed 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/install
Uninstall an installation of the EBS CSI Driver previously installed by make cluster/install
.
make cluster/uninstall
Run 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 sidecar updates and regenerate the manifests. This is the primary target to use unless more granular control is needed.
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
.