From 121a7b158b944079bb8bf851e690df083e78aa8a Mon Sep 17 00:00:00 2001 From: Jeffrey Nelson Date: Thu, 24 Aug 2023 14:25:07 -0500 Subject: [PATCH] document cni binary and conflist paths (#2501) --- README.md | 18 ++++++++++++++++++ cmd/aws-vpc-cni/main.go | 9 +++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e8b3bfd336..f5cd1f67f1 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,24 @@ To select an `ENIConfig` based upon availability zone set this to `topology.kube --- +#### `HOST_CNI_BIN_PATH` + +Type: String + +Default: `/host/opt/cni/bin` + +Specifies the location to install CNI binaries. Note that the `aws-node` daemonset mounts `/opt/cni/bin` to `/host/opt/cni/bin`. The value you choose must be a location that the `aws-node` pod can write to. + +--- + +#### `HOST_CNI_CONFDIR_PATH` + +Type: String + +Default: `/host/etc/cni/net.d` + +Specifies the location to install the VPC CNI conflist. Note that the `aws-node` daemonset mounts `/etc/cni/net.d` to `/host/etc/cni/net.d`. The value you choose must be a location that the `aws-node` pod can write to. + #### `AWS_VPC_ENI_MTU` (v1.6.0+) Type: Integer as a String diff --git a/cmd/aws-vpc-cni/main.go b/cmd/aws-vpc-cni/main.go index 6ec46150a3..01308f0c3b 100644 --- a/cmd/aws-vpc-cni/main.go +++ b/cmd/aws-vpc-cni/main.go @@ -61,8 +61,8 @@ const ( egressPluginIpamDstV6 = "::/0" egressPluginIpamDataDirV4 = "/run/cni/v6pd/egress-v4-ipam" egressPluginIpamDataDirV6 = "/run/cni/v4pd/egress-v6-ipam" - defaultHostCNIBinPath = "/host/opt/cni/bin" - defaultHostCNIConfDirPath = "/host/etc/cni/net.d" + defaultHostCniBinPath = "/host/opt/cni/bin" + defaultHostCniConfDirPath = "/host/etc/cni/net.d" defaultAWSconflistFile = "/app/10-aws.conflist" tmpAWSconflistFile = "/tmp/10-aws.conflist" defaultVethPrefix = "eni" @@ -404,7 +404,7 @@ func _main() int { } pluginBins := []string{"aws-cni", "egress-cni"} - hostCNIBinPath := utils.GetEnv(envHostCniBinPath, defaultHostCNIBinPath) + hostCNIBinPath := utils.GetEnv(envHostCniBinPath, defaultHostCniBinPath) err := cp.InstallBinaries(pluginBins, hostCNIBinPath) if err != nil { log.WithError(err).Error("Failed to install CNI binaries") @@ -445,7 +445,8 @@ func _main() int { return 1 } - err = cp.CopyFile(tmpAWSconflistFile, defaultHostCNIConfDirPath+awsConflistFile) + hostCniConfDirPath := utils.GetEnv(envHostCniConfDirPath, defaultHostCniConfDirPath) + err = cp.CopyFile(tmpAWSconflistFile, hostCniConfDirPath+awsConflistFile) if err != nil { log.WithError(err).Errorf("Failed to copy %s", awsConflistFile) return 1