-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add route_controller to linode CCM (#199)
* add back changes reverted in PR #195 * get instanceConfig only when running within VPC * add and fix unittests * use lock when reading/writing vpc id * updated route-controller using /v4/vpcs/ips api * fix tests * switch to new api returning ips for specific vpc * when running with vpc set, only cache instances which are part of VPC * address review comments * update linodego to v1.33.0 * address review comment, make variable required if routecontroller is enabled --------- Co-authored-by: Rahul Sharma <[email protected]>
- Loading branch information
Showing
18 changed files
with
1,054 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package linode | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/golang/mock/gomock" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNewCloudRouteControllerDisabled(t *testing.T) { | ||
ctrl := gomock.NewController(t) | ||
defer ctrl.Finish() | ||
|
||
t.Setenv("LINODE_API_TOKEN", "dummyapitoken") | ||
t.Setenv("LINODE_REGION", "us-east") | ||
|
||
t.Run("should not fail if vpc is empty and routecontroller is disabled", func(t *testing.T) { | ||
Options.VPCName = "" | ||
Options.EnableRouteController = false | ||
_, err := newCloud() | ||
assert.NoError(t, err) | ||
}) | ||
|
||
t.Run("fail if vpcname is empty and routecontroller is enabled", func(t *testing.T) { | ||
Options.VPCName = "" | ||
Options.EnableRouteController = true | ||
_, err := newCloud() | ||
assert.Error(t, err) | ||
}) | ||
} |
Oops, something went wrong.