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