diff --git a/cmd/aws-vpc-cni-init/main.go b/cmd/aws-vpc-cni-init/main.go index c3c77a9189..cf29fd4eab 100644 --- a/cmd/aws-vpc-cni-init/main.go +++ b/cmd/aws-vpc-cni-init/main.go @@ -29,7 +29,6 @@ import ( const ( defaultHostCNIBinPath = "/host/opt/cni/bin" - vpcCniInitDonePath = "/vpc-cni-init/done" metadataLocalIP = "local-ipv4" metadataMAC = "mac" defaultDisableIPv4TcpEarlyDemux = false @@ -181,17 +180,7 @@ func _main() int { return 1 } - // TODO: In order to speed up pod launch time, VPC CNI init container is not a Kubernetes init container. - // The VPC CNI container blocks on the existence of vpcCniInitDonePath - //err = cp.TouchFile(vpcCniInitDonePath) - //if err != nil { - // log.WithError(err).Errorf("Failed to set VPC CNI init done") - // return 1 - //} - log.Infof("CNI init container done") - // TODO: Since VPC CNI init container is a real container, it never exits - // time.Sleep(time.Duration(1<<63 - 1)) return 0 } diff --git a/cmd/aws-vpc-cni/main.go b/cmd/aws-vpc-cni/main.go index 063d766fdd..d1e5feb042 100644 --- a/cmd/aws-vpc-cni/main.go +++ b/cmd/aws-vpc-cni/main.go @@ -42,9 +42,7 @@ import ( "os/exec" "strconv" "strings" - "time" - "github.com/pkg/errors" log "github.com/sirupsen/logrus" "github.com/containernetworking/cni/pkg/types" @@ -188,27 +186,6 @@ func waitForIPAM() bool { } } -// Wait for vpcCniInitDonePath to exist (maximum wait time is 60 seconds) -func waitForInit() error { - start := time.Now() - maxEnd := start.Add(time.Minute) - for { - // Check for existence of vpcCniInitDonePath - if _, err := os.Stat(vpcCniInitDonePath); err == nil { - // Delete the done file in case of a reboot of the node or restart of the container (force init container to run again) - if err := os.Remove(vpcCniInitDonePath); err == nil { - return nil - } - // If file deletion fails, log and allow retry - log.Errorf("Failed to delete file: %s", vpcCniInitDonePath) - } - if time.Now().After(maxEnd) { - return errors.Errorf("time exceeded") - } - time.Sleep(1 * time.Second) - } -} - func getPrimaryIP(ipv4 bool) (string, error) { var hostIP string var err error @@ -471,12 +448,6 @@ func _main() int { return 1 } - // Wait for init container to complete - //if err := waitForInit(); err != nil { - // log.WithError(err).Errorf("Init container failed to complete") - // return 1 - //} - log.Infof("Copying config file... ") err = generateJSON(defaultAWSconflistFile, tmpAWSconflistFile, getPrimaryIP) if err != nil {