Skip to content

Commit

Permalink
Merge pull request #819 from feiskyer/fix-route
Browse files Browse the repository at this point in the history
fix: report an error when route table name is not configured
  • Loading branch information
k8s-ci-robot committed Sep 26, 2021
2 parents f871993 + 55b97f3 commit 92269f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/provider/azure_routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ func TestCreateRoute(t *testing.T) {
createOrUpdateErr *retry.Error
expectedErrMsg error
}{
{
name: "CreateRoute should report an error if route table name is not configured",
routeTableName: "",
expectedErrMsg: fmt.Errorf("Route table name is not configured"),
},
{
name: "CreateRoute should create route if route doesn't exist",
routeTableName: "rt1",
Expand Down
4 changes: 4 additions & 0 deletions pkg/provider/azure_wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func (az *Cloud) getVirtualMachine(nodeName types.NodeName, crt azcache.AzureCac
}

func (az *Cloud) getRouteTable(crt azcache.AzureCacheReadType) (routeTable network.RouteTable, exists bool, err error) {
if len(az.RouteTableName) == 0 {
return routeTable, false, fmt.Errorf("Route table name is not configured")
}

cachedRt, err := az.rtCache.Get(az.RouteTableName, crt)
if err != nil {
return routeTable, false, err
Expand Down

0 comments on commit 92269f4

Please sign in to comment.