Skip to content

Commit 06df160

Browse files
authored
fix(vpc): handle IPAM errors gracefully in private-network get (#5224)
1 parent abff741 commit 06df160

File tree

1 file changed

+45
-14
lines changed

1 file changed

+45
-14
lines changed

internal/namespaces/vpc/v2/custom_private_network.go

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,63 +70,94 @@ func privateNetworkGetBuilder(c *core.Command) *core.Command {
7070

7171
g.Go(func() (err error) {
7272
instanceServers, err = listCustomInstanceServers(groupCtx, client, pn)
73+
if err != nil {
74+
instanceServers = []customInstanceServer{}
75+
}
7376

74-
return err
77+
return nil
7578
})
7679
g.Go(func() (err error) {
7780
baremetalServers, err = listCustomBaremetalServers(groupCtx, client, pn)
81+
if err != nil {
82+
baremetalServers = []customBaremetalServer{}
83+
}
7884

79-
return err
85+
return nil
8086
})
8187
g.Go(func() (err error) {
8288
k8sClusters, err = listCustomK8sClusters(groupCtx, client, pn)
89+
if err != nil {
90+
k8sClusters = []customK8sCluster{}
91+
}
8392

84-
return err
93+
return nil
8594
})
8695
g.Go(func() (err error) {
8796
lbs, err = listCustomLBs(groupCtx, client, pn)
97+
if err != nil {
98+
lbs = []customLB{}
99+
}
88100

89-
return err
101+
return nil
90102
})
91103
g.Go(func() (err error) {
92104
rdbs, err = listCustomRdbs(groupCtx, client, pn)
105+
if err != nil {
106+
rdbs = []customRdb{}
107+
}
93108

94-
return err
109+
return nil
95110
})
96111
g.Go(func() (err error) {
97112
redisClusters, err = listCustomRedisClusters(groupCtx, client, pn)
113+
if err != nil {
114+
redisClusters = []customRedis{}
115+
}
98116

99-
return err
117+
return nil
100118
})
101119
g.Go(func() (err error) {
102120
gateways, err = listCustomGateways(groupCtx, client, pn)
121+
if err != nil {
122+
gateways = []customGateway{}
123+
}
103124

104-
return err
125+
return nil
105126
})
106127
g.Go(func() (err error) {
107128
appleSiliconServers, err = listCustomAppleSiliconServers(groupCtx, client, pn)
129+
if err != nil {
130+
appleSiliconServers = []customAppleSiliconServer{}
131+
}
108132

109-
return err
133+
return nil
110134
})
111135
g.Go(func() (err error) {
112136
mongoDBs, err = listCustomMongoDBs(groupCtx, client, pn)
137+
if err != nil {
138+
mongoDBs = []customMongoDB{}
139+
}
113140

114-
return err
141+
return nil
115142
})
116143
g.Go(func() (err error) {
117144
ipamIPs, err = listCustomIPAMIPs(groupCtx, client, pn)
145+
if err != nil {
146+
ipamIPs = []customIPAMIP{}
147+
}
118148

119-
return err
149+
return nil
120150
})
121151
g.Go(func() (err error) {
122152
inferenceDeployments, err = listCustomInferenceDeployments(groupCtx, client, pn)
153+
if err != nil {
154+
inferenceDeployments = []customInferenceDeployment{}
155+
}
123156

124-
return err
157+
return nil
125158
})
126159

127-
if err = g.Wait(); err != nil {
128-
return nil, err
129-
}
160+
_ = g.Wait()
130161

131162
return &struct {
132163
*vpc.PrivateNetwork

0 commit comments

Comments
 (0)