Created
February 9, 2021 00:27
-
-
Save Billy99/de304c553644bf1e2106fa722f4a550c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ git diff pkg/types/conf.go | |
| diff --git a/pkg/types/conf.go b/pkg/types/conf.go | |
| index b0ca491..2420c67 100644 | |
| --- a/pkg/types/conf.go | |
| +++ b/pkg/types/conf.go | |
| @@ -143,10 +143,13 @@ func LoadDelegateNetConf(bytes []byte, net *NetworkSelectionElement, deviceID st | |
| } | |
| // mergeCNIRuntimeConfig creates CNI runtimeconfig from delegate | |
| -func mergeCNIRuntimeConfig(runtimeConfig *RuntimeConfig, delegate *DelegateNetConf) *RuntimeConfig { | |
| - logging.Debugf("mergeCNIRuntimeConfig: %v %v", runtimeConfig, delegate) | |
| - if runtimeConfig == nil { | |
| - runtimeConfig = &RuntimeConfig{} | |
| +func mergeCNIRuntimeConfig(origRuntimeConfig *RuntimeConfig, delegate *DelegateNetConf) *RuntimeConfig { | |
| + logging.Debugf("mergeCNIRuntimeConfig: %v %v", origRuntimeConfig, delegate) | |
| + var runtimeConfig RuntimeConfig | |
| + if origRuntimeConfig == nil { | |
| + runtimeConfig = RuntimeConfig{} | |
| + } else { | |
| + runtimeConfig = *origRuntimeConfig | |
| } | |
| // multus inject RuntimeConfig only in case of non MasterPlugin. | |
| @@ -172,8 +175,7 @@ func mergeCNIRuntimeConfig(runtimeConfig *RuntimeConfig, delegate *DelegateNetCo | |
| } | |
| logging.Debugf("mergeCNIRuntimeConfig: add runtimeConfig for net-attach-def: %v", runtimeConfig) | |
| } | |
| - | |
| - return runtimeConfig | |
| + return &runtimeConfig | |
| } | |
| // CreateCNIRuntimeConf create CNI RuntimeConf for a delegate. If delegate configuration | |
| @@ -181,8 +183,8 @@ func mergeCNIRuntimeConfig(runtimeConfig *RuntimeConfig, delegate *DelegateNetCo | |
| func CreateCNIRuntimeConf(args *skel.CmdArgs, k8sArgs *K8sArgs, ifName string, rc *RuntimeConfig, delegate *DelegateNetConf) (*libcn | |
| logging.Debugf("LoadCNIRuntimeConf: %v, %v, %s, %v %v", args, k8sArgs, ifName, rc, delegate) | |
| var cniDeviceInfoFile string | |
| + var delegateRc *RuntimeConfig | |
| - delegateRc := rc | |
| if delegate != nil { | |
| delegateRc = mergeCNIRuntimeConfig(delegateRc, delegate) | |
| if delegateRc.CNIDeviceInfoFile == "" && delegate.Name != "" { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment