Visit openwrt api with namespace suffix 87/2287/1
authorchengli3 <cheng1.li@intel.com>
Fri, 6 Mar 2020 03:38:09 +0000 (11:38 +0800)
committerchengli3 <cheng1.li@intel.com>
Fri, 6 Mar 2020 03:38:09 +0000 (11:38 +0800)
openwrt api requests are sent from the sdewan controller pod. As
the controller namespace may be different with the openwrt pod.
We add the namespace suffix so that the controller can always resolv
the openwrt svc.

Signed-off-by: chengli3 <cheng1.li@intel.com>
Change-Id: I49c62ecda5d2a22e1feaaf717cfa411d4ba01b05

wrtprovider/wrtprovider.go

index 634932e..4545c61 100644 (file)
@@ -116,7 +116,7 @@ func Mwan3ReplaceRules(rules []openwrt.SdewanRule, existOnes []openwrt.SdewanRul
 // apply policy and rules
 func Mwan3Apply(mwan3Conf *sdewanv1alpha1.Mwan3Conf, sdewan *sdewanv1alpha1.Sdewan) error {
        reqLogger := log.WithValues("Mwan3Provider", mwan3Conf.Name, "Sdewan", sdewan.Name)
-       openwrtClient := openwrt.NewOpenwrtClient(sdewan.Name, "root", "")
+       openwrtClient := openwrt.NewOpenwrtClient(sdewan.Name + "." + sdewan.Namespace, "root", "")
        mwan3 := openwrt.Mwan3Client{OpenwrtClient: openwrtClient}
        service := openwrt.ServiceClient{OpenwrtClient: openwrtClient}
        netMap := NetworkInterfaceMap(sdewan)