Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0b1d5488
Commit
0b1d5488
authored
Aug 17, 2017
by
Shyam Jeedigunta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make route-controller list only relevant routes instead of all of them
parent
402e48b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
+6
-14
gce_routes.go
pkg/cloudprovider/providers/gce/gce_routes.go
+6
-14
No files found.
pkg/cloudprovider/providers/gce/gce_routes.go
View file @
0b1d5488
...
@@ -20,7 +20,6 @@ import (
...
@@ -20,7 +20,6 @@ import (
"fmt"
"fmt"
"net/http"
"net/http"
"path"
"path"
"strings"
"time"
"time"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/types"
...
@@ -46,7 +45,12 @@ func (gce *GCECloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, err
...
@@ -46,7 +45,12 @@ func (gce *GCECloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, err
listCall
:=
gce
.
service
.
Routes
.
List
(
gce
.
projectID
)
listCall
:=
gce
.
service
.
Routes
.
List
(
gce
.
projectID
)
prefix
:=
truncateClusterName
(
clusterName
)
prefix
:=
truncateClusterName
(
clusterName
)
listCall
=
listCall
.
Filter
(
"name eq "
+
prefix
+
"-.*"
)
// Filter for routes starting with clustername AND belonging to the
// relevant gcp network AND having description = "k8s-node-route".
filter
:=
"(name eq "
+
prefix
+
"-.*) "
filter
=
filter
+
"(network eq "
+
gce
.
networkURL
+
") "
filter
=
filter
+
"(description eq "
+
k8sNodeRouteTag
+
")"
listCall
=
listCall
.
Filter
(
filter
)
if
pageToken
!=
""
{
if
pageToken
!=
""
{
listCall
=
listCall
.
PageToken
(
pageToken
)
listCall
=
listCall
.
PageToken
(
pageToken
)
}
}
...
@@ -58,18 +62,6 @@ func (gce *GCECloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, err
...
@@ -58,18 +62,6 @@ func (gce *GCECloud) ListRoutes(clusterName string) ([]*cloudprovider.Route, err
}
}
pageToken
=
res
.
NextPageToken
pageToken
=
res
.
NextPageToken
for
_
,
r
:=
range
res
.
Items
{
for
_
,
r
:=
range
res
.
Items
{
if
r
.
Network
!=
gce
.
networkURL
{
continue
}
// Not managed if route description != "k8s-node-route"
if
r
.
Description
!=
k8sNodeRouteTag
{
continue
}
// Not managed if route name doesn't start with <clusterName>
if
!
strings
.
HasPrefix
(
r
.
Name
,
prefix
)
{
continue
}
target
:=
path
.
Base
(
r
.
NextHopInstance
)
target
:=
path
.
Base
(
r
.
NextHopInstance
)
// TODO: Should we lastComponent(target) this?
// TODO: Should we lastComponent(target) this?
targetNodeName
:=
types
.
NodeName
(
target
)
// NodeName == Instance Name on GCE
targetNodeName
:=
types
.
NodeName
(
target
)
// NodeName == Instance Name on GCE
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment