Skip to content

Commit b562f02

Browse files
andrewlee1089Andrew Lee
authored and
Andrew Lee
committed
Fix #5028: Orphaned subnets which reference a non-existent VPC cause new namespaces to never get correct annotations.
Signed by: Andrew Lee <alee@evroc.com>
1 parent aa4cdbe commit b562f02

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/controller/namespace.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,12 @@ func (c *Controller) handleAddNamespace(key string) error {
140140
if s.Spec.Vpc != "" && s.Spec.Vpc != c.config.ClusterRouter {
141141
vpc, err := c.vpcsLister.Get(s.Spec.Vpc)
142142
if err != nil {
143-
klog.Errorf("failed to get custom vpc %v", err)
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+
}
148+
klog.Errorf("failed to get vpc %q: %v", s.Spec.Vpc, err)
144149
return err
145150
}
146151
if s.Name == vpc.Spec.DefaultSubnet {

0 commit comments

Comments
 (0)