top

Package exec scans and loads networking plugins that are installed under /usr/libexec/kubernetes/kubelet-plugins/net/exec/ The layout convention for a plugin is:

plugin-name/            (plugins have to be directories first)
plugin-name/plugin-name (executable that will be called out, see Vendoring Note for more nuances)
plugin-name/<other-files>
where, 'executable' has the following requirements:
  - should have exec permissions
  - should give non-zero exit code on failure, and zero on success
  - the arguments will be <action> <pod_namespace> <pod_name> <docker_id_of_infra_container>
    whereupon, <action> will be one of:
      - init, called when the kubelet loads the plugin
      - setup, called after the infra container of a pod is
             created, but before other containers of the pod are created
      - teardown, called before the pod infra container is killed
      - status, called at regular intervals and is supposed to return a json
             formatted output indicating the pod's IPAddress(v4/v6). An empty string value or an erroneous output
             will mean the container runtime (docker) will be asked for the PodIP
             e.g. {
                      "apiVersion" : "v1beta1",
                      "kind" : "PodNetworkStatus",
                      "ip" : "10.20.30.40"
                  }
             The fields "apiVersion" and "kind" are optional in version v1beta1

As the executables are called, the file-descriptors stdin, stdout, stderr remain open. The combined output of stdout/stderr is captured and logged.

Note: If the pod infra container self-terminates (e.g. crashes or is killed), the entire pod lifecycle will be restarted, but teardown will not be called.

Vendoring Note:

Plugin Names can be vendored also. Use '~' as the escaped name for plugin directories.
And expect command line argument to call vendored plugins as 'vendor/pluginName'
e.g. pluginName = mysdn
     vendorname = mycompany
then, plugin layout should be
     mycompany~mysdn/
     mycompany~mysdn/mysdn (this becomes the executable)
     mycompany~mysdn/<other-files>
and, call the kubelet with '--network-plugin=mycompany/mysdn'

Imports 6 package(s)

  1. k8s.io/kubernetes/pkg/kubelet/container
  2. k8s.io/kubernetes/pkg/util/exec
  3. github.com/golang/glog
  4. k8s.io/kubernetes/pkg/api/unversioned
  5. k8s.io/kubernetes/pkg/kubelet/network
  6. k8s.io/kubernetes/pkg/apis/componentconfig

Test imports 3 package(s)

  1. k8s.io/kubernetes/pkg/util/testing
  2. k8s.io/kubernetes/pkg/kubelet/network/testing
  3. k8s.io/kubernetes/pkg/util/sets