Updated plugins to use OS-specific paths
This commit is contained in:
Родитель
27d06d62d2
Коммит
02b0c0417d
|
@ -6,6 +6,7 @@ package cni
|
||||||
import (
|
import (
|
||||||
"github.com/Azure/azure-container-networking/common"
|
"github.com/Azure/azure-container-networking/common"
|
||||||
"github.com/Azure/azure-container-networking/log"
|
"github.com/Azure/azure-container-networking/log"
|
||||||
|
"github.com/Azure/azure-container-networking/platform"
|
||||||
"github.com/Azure/azure-container-networking/store"
|
"github.com/Azure/azure-container-networking/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ func (plugin *Plugin) Initialize(config *common.PluginConfig) error {
|
||||||
if plugin.Store == nil {
|
if plugin.Store == nil {
|
||||||
// Create the key value store.
|
// Create the key value store.
|
||||||
var err error
|
var err error
|
||||||
plugin.Store, err = store.NewJsonFileStore("/etc/cni/" + plugin.Name + ".conf")
|
plugin.Store, err = store.NewJsonFileStore(platform.RuntimePath + plugin.Name + ".json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[cni] Failed to create store, err:%v.", err)
|
log.Printf("[cni] Failed to create store, err:%v.", err)
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -6,6 +6,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/Azure/azure-container-networking/cni"
|
||||||
"github.com/Azure/azure-container-networking/cni/ipam"
|
"github.com/Azure/azure-container-networking/cni/ipam"
|
||||||
"github.com/Azure/azure-container-networking/cni/network"
|
"github.com/Azure/azure-container-networking/cni/network"
|
||||||
"github.com/Azure/azure-container-networking/common"
|
"github.com/Azure/azure-container-networking/common"
|
||||||
|
@ -19,16 +20,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Plugin name.
|
// Plugin name.
|
||||||
name = "azure-cni-plugin"
|
name = "azure-vnet"
|
||||||
|
|
||||||
// CNI version supported by this plugin.
|
|
||||||
cniVersion = "0.2.0"
|
|
||||||
|
|
||||||
// Plugin execution environment.
|
|
||||||
environment = "azure"
|
|
||||||
|
|
||||||
// JSON file for storing state.
|
|
||||||
storeFileName = "/etc/cni/azure-container-networking.json"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version is populated by make during build.
|
// Version is populated by make during build.
|
||||||
|
@ -59,7 +51,7 @@ func main() {
|
||||||
config.ErrChan = make(chan error, 1)
|
config.ErrChan = make(chan error, 1)
|
||||||
|
|
||||||
// Create the key value store.
|
// Create the key value store.
|
||||||
config.Store, err = store.NewJsonFileStore(storeFileName)
|
config.Store, err = store.NewJsonFileStore(platform.RuntimePath + name + ".json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[cni] Failed to create store, err:%v.", err)
|
log.Printf("[cni] Failed to create store, err:%v.", err)
|
||||||
return
|
return
|
||||||
|
@ -86,7 +78,7 @@ func main() {
|
||||||
common.LogNetworkInterfaces()
|
common.LogNetworkInterfaces()
|
||||||
|
|
||||||
// Set plugin options.
|
// Set plugin options.
|
||||||
ipamPlugin.SetOption(common.OptEnvironment, environment)
|
ipamPlugin.SetOption(common.OptEnvironment, common.OptEnvironmentAzure)
|
||||||
|
|
||||||
// Start plugins.
|
// Start plugins.
|
||||||
if netPlugin != nil {
|
if netPlugin != nil {
|
||||||
|
@ -106,7 +98,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set supported CNI versions.
|
// Set supported CNI versions.
|
||||||
pluginInfo := cniVers.PluginSupports(cniVersion)
|
pluginInfo := cniVers.PluginSupports(cni.cniVersion)
|
||||||
|
|
||||||
// Parse args and call the appropriate cmd handler.
|
// Parse args and call the appropriate cmd handler.
|
||||||
cniSkel.PluginMain(netPlugin.Add, netPlugin.Delete, pluginInfo)
|
cniSkel.PluginMain(netPlugin.Add, netPlugin.Delete, pluginInfo)
|
||||||
|
|
|
@ -122,7 +122,7 @@ func main() {
|
||||||
config.ErrChan = make(chan error, 1)
|
config.ErrChan = make(chan error, 1)
|
||||||
|
|
||||||
// Create the key value store.
|
// Create the key value store.
|
||||||
config.Store, err = store.NewJsonFileStore("")
|
config.Store, err = store.NewJsonFileStore(platform.RuntimePath + "azure-vnet.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Failed to create store: %v\n", err)
|
fmt.Printf("Failed to create store: %v\n", err)
|
||||||
return
|
return
|
||||||
|
|
Загрузка…
Ссылка в новой задаче