remove unused custom dir; commented out code
authorVZ Cambria <vzcambria@gmail.com>
Tue, 27 Dec 2016 20:02:49 +0000 (15:02 -0500)
committerVZ Cambria <vzcambria@gmail.com>
Tue, 27 Dec 2016 20:02:49 +0000 (15:02 -0500)
plugins/ipam/vz-local/config.go
plugins/ipam/vz-local/custom/hack-types-dot-go [deleted file]

index 619f6d8..5ebb7de 100644 (file)
@@ -22,7 +22,6 @@ import (
        "os"
 
        "github.com/containernetworking/cni/pkg/types"
-       // "github.com/containernetworking/cni/ipam/vz-local/custom"
 )
 
 // IPAMConfig represents the IP related network configuration.
@@ -74,7 +73,6 @@ type NetConf struct {
        IPAM *IPAMConfig `json:"ipam"`
        DNS types.DNS `json:"dns"`
        ARGS *Args `json:"args,omitempty"`
-       // ARGS Args `json:"args"`
 }
 
 // NewIPAMConfig creates a NetworkConfig from the given network name.
@@ -101,76 +99,39 @@ func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, error) {
        n.IPAM.Name = n.Name
 
 /*
- * Begin
+ * Example of getting an environment variable supplied to the IPAM plugin
  */
-       println("Debug Getenv - Start")
-
        mccval := os.Getenv("MCCVAL")
        println("mccval is: ", mccval)
-       println("Debug Getenv- End")
-/*
- * End 
- */
 
 /*
- * Begin
+ * Get values for supplied labels
+ * Ensure that IPAM args (e.g. CNI_ARGS) isn't confused with args passed to CNI itself 
  */
-       println("Debug - Start")
        labels := map[string]string{}
 
-       // println("initial:")
-       // fmt.Println("Initial Map:", labels)
-       // println(":initial")
-
        if args != "" {
          if n.ARGS != nil {
-               println("Bingo")
-               //n.IPAM.Args = &IPAMArgs{}
-               //n.ARGS.Mesos = &Mesos{}
-
-               // fmt.Printf("NetConf Struct type is: ")
-               // fmt.Printf("%T ", n)
-               // fmt.Printf("NetConf Struct type is: ")
-               // fmt.Printf("%+v", n)
-               //myargs := &n.Args
-               // m := &myargs.Mesos{}
-               //fmt.Printf("myargs Struct is: %T = %+v", myargs, myargs)
-               //fmt.Printf("Mesos Struct is: %T = %+v", m, m)
-
-               //n.ARGS = &Args{}
-               //fmt.Printf("Args Struct type is: ")
-               //fmt.Printf("T", n.ARGS)
-               //fmt.Printf("Args Struct value is: ")
-               //fmt.Printf("%+v", n.ARGS)
 
                for k, label := range n.ARGS.Mesos.NetworkInfo.Labels.Labels {
                    labels[label.Key] = label.Value
                    println("Map k (for)", k)
                    println("Map k (for)", k, label.Key, label.Value)
-                   // println("Map (for)", labels)
-                   // fmt.Println("Map: ", label)
                }
-               // println("Map (final)", labels)
-               //fmt.Println("Final Map (Println)", labels)
-               //fmt.Printf("Final Map (Printf) %v", labels)
          }
        }
-       println("Debug - End")
 
        for key, value := range labels {
-           // fmt.Println("Key:", key, "Value:", value)
            println("Key:", key, "Value:", value)
        }
 
-       //fmt.Println("done:", n.ARGS.Mesos.NetworkInfo.Labels.Labels)
        if n.ARGS != nil {
-          println("done: Net Name: ", n.ARGS.Mesos.NetworkInfo.Name)
-          println("done: IPAM Name: ", n.IPAM.Name)
-          println("done: Labels2: ", n.ARGS.Mesos.NetworkInfo.Labels.Labels)
+          println("CNI Args: Net Name: ", n.ARGS.Mesos.NetworkInfo.Name)
+          println("CNI Args: IPAM Name: ", n.IPAM.Name)
           args_ip := n.IPAM.Args.IP
           uplink := n.IPAM.Args.UPLINK
-          println("MikeC: n.IPAM.IP is:", args_ip)
-          println("MikeC: n.IPAM.UPLINK is:", uplink)
+          println("IPAM args: n.IPAM.IP is:", args_ip)
+          println("IPAM args: n.IPAM.UPLINK is:", uplink)
        }
 
        staticIP, found := labels["StaticIP"]
@@ -185,9 +146,5 @@ func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, error) {
           println("Found: ", bull)
        }
 
-/*
- * End
- */
-
        return n.IPAM, nil
 }
diff --git a/plugins/ipam/vz-local/custom/hack-types-dot-go b/plugins/ipam/vz-local/custom/hack-types-dot-go
deleted file mode 100644 (file)
index 90c19d6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-
-type Args struct {
-       Mesos Mesos `json:"org.apache.mesos,omitempty"`
-}
-
-type Mesos struct {
-       NetworkInfo NetworkInfo `json:"network_info"`
-}
-
-type NetworkInfo struct {
-       Name   string `json:"name"`
-       Labels struct {
-               Labels []struct {
-                       Key   string `json:"key"`
-                       Value string `json:"value"`
-               } `json:"labels,omitempty"`
-       } `json:"labels,omitempty"`
-}
-
-// NetConf describes vz custom ipam network
-type NetConf struct {
-       CNIVersion string `json:"cniVersion,omitempty"`
-
-       Name string `json:"name"`
-       Type string `json:"type"`
-       IPAM struct {
-               Type string `json:"type,omitempty"`
-       } `json:"ipam,omitempty"`
-       DNS DNS `json:"dns"`
-       Args           Args       `json:"args"`
-}
-