Skip to content

Commit ac18e18

Browse files
Update namespace.go
1 parent 0d5c866 commit ac18e18

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pkg/controller/namespace.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,14 @@ func (c *Controller) handleAddNamespace(key string) error {
139139
// check if subnet is in custom vpc with configured defaultSubnet, then annotate the namespace with this subnet
140140
if s.Spec.Vpc != "" && s.Spec.Vpc != c.config.ClusterRouter {
141141
vpc, err := c.vpcsLister.Get(s.Spec.Vpc)
142-
if err == errors.IsNotFound(err) {
143-
klog.Errorf("custom vpc is not found - %v", err)
144-
// this subnet is broken (it references a non-existent VPC) - we just ignore it.
145-
break
146-
} else if err != nil {
147-
klog.Errorf("failed to get custom vpc %v", err)
142+
if err != nil {
143+
if errors.IsNotFound(err) {
144+
// this subnet is broken (it references a non-existent VPC) - we just ignore it.
145+
klog.Errorf("vpc %q is not found. Ignoring subnet %q: %v", s.Spec.Vpc, s.Name, err)
146+
break
147+
return nil
148+
}
149+
klog.Errorf("failed to get vpc %q: %v", s.Spec.Vpc, err)
148150
return err
149151
}
150152
if s.Name == vpc.Spec.DefaultSubnet {

0 commit comments

Comments
 (0)