Skip to content

Commit

Permalink
Populate the Pod Parameter before returning on Del Command
Browse files Browse the repository at this point in the history
  • Loading branch information
abhipth authored and ofiliz committed Aug 6, 2020
1 parent 2caf4a8 commit d9957d8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions plugins/vpc-shared-eni/config/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ var (

// parseKubernetesArgs parses Kubernetes-specific CNI arguments.
func parseKubernetesArgs(netConfig *NetConfig, args *cniSkel.CmdArgs, isAddCmd bool) error {
// The only additional information we need to query from API server is the pod IP address,
// which is required only for ADD commands. Also the API server may have deleted the pod
// object already in the DEL path.
if !isAddCmd || args == nil || args.Args == "" {
if args == nil || args.Args == "" {
return nil
}

Expand All @@ -72,6 +69,13 @@ func parseKubernetesArgs(netConfig *NetConfig, args *cniSkel.CmdArgs, isAddCmd b
kc.PodName = string(ka.K8S_POD_NAME)
kc.PodInfraContainerID = string(ka.K8S_POD_INFRA_CONTAINER_ID)

// The only additional information we need to query from API server is the pod IP address,
// which is required only for ADD commands. Also the API server may have deleted the pod
// object already in the DEL path.
if !isAddCmd {
return nil
}

if kc.Namespace == "" || kc.PodName == "" {
return fmt.Errorf("missing required args %v", kc)
}
Expand Down

0 comments on commit d9957d8

Please sign in to comment.