Skip to content

Commit

Permalink
add detail error when failed to create resource
Browse files Browse the repository at this point in the history
  • Loading branch information
luckymrwang authored and zhangzujian committed Mar 10, 2022
1 parent 9a65127 commit 9f3426e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions pkg/controller/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ func (c *Controller) initNodeSwitch() error {
}

_, err = c.config.KubeOvnClient.KubeovnV1().Subnets().Create(context.Background(), &nodeSubnet, metav1.CreateOptions{})
return err
if err != nil {
klog.Errorf("failed to create subnet %s: %v", c.config.NodeSwitch, err)
return err
}
return nil
}

// InitClusterRouter init cluster router to connect different logical switches
Expand Down Expand Up @@ -456,7 +460,11 @@ func (c *Controller) initDefaultProviderNetwork() error {
}()

_, err = c.config.KubeOvnClient.KubeovnV1().ProviderNetworks().Create(context.Background(), &pn, metav1.CreateOptions{})
return err
if err != nil {
klog.Errorf("failed to create provider network %s: %v", c.config.DefaultProviderName, err)
return err
}
return nil
}

func (c *Controller) initDefaultVlan() error {
Expand Down Expand Up @@ -491,7 +499,11 @@ func (c *Controller) initDefaultVlan() error {
}

_, err = c.config.KubeOvnClient.KubeovnV1().Vlans().Create(context.Background(), &defaultVlan, metav1.CreateOptions{})
return err
if err != nil {
klog.Errorf("failed to create vlan %s: %v", defaultVlan, err)
return err
}
return nil
}

func (c *Controller) initSyncCrdIPs() error {
Expand Down

0 comments on commit 9f3426e

Please sign in to comment.