-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove pkg/context dependency from NEG controller #1331
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good.
A couple areas where commented code can be deleted.
A couple small suggestions to clean up code and to stop importing the built in context
package as context2
. But these can be ignored and addressed later.
pkg/neg/controller_test.go
Outdated
dynamicClient := dynamicfake.NewSimpleDynamicClient(dynamicSchema) | ||
|
||
destrinationGVR := schema.GroupVersionResource{Group: "networking.istio.io", Version: "v1alpha3", Resource: "destinationrules"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: destination
pkg/neg/manager_test.go
Outdated
negtypes.MockNetworkEndpointAPIs(fakeGCE) | ||
fakeCloud := negtypes.NewAdapter(fakeGCE) | ||
|
||
//backendConfigClient := backendconfigclient.NewSimpleClientset() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented lines can be deleted.
pkg/neg/manager_test.go
Outdated
@@ -723,9 +745,10 @@ func TestFilterCommonPorts(t *testing.T) { | |||
func TestNegCRCreations(t *testing.T) { | |||
t.Parallel() | |||
|
|||
svcNegClient := negfake.NewSimpleClientset() | |||
//svcNegClient := negfake.NewSimpleClientset() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented line
pkg/neg/manager_test.go
Outdated
@@ -919,9 +942,12 @@ func TestNegCRDuplicateCreations(t *testing.T) { | |||
for _, tc := range testCases { | |||
t.Run(tc.desc, func(t *testing.T) { | |||
|
|||
svcNegClient := negfake.NewSimpleClientset() | |||
//svcNegClient := negfake.NewSimpleClientset() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented lines.
pkg/neg/manager_test.go
Outdated
@@ -83,39 +76,56 @@ func NewTestSyncerManager(kubeClient kubernetes.Interface) *syncerManager { | |||
} | |||
|
|||
func NewTestSyncerManagerWithNegClient(kubeClient kubernetes.Interface, svcNegClient svcnegclient.Interface) *syncerManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function can be merged with the above since we always create the svcNegClient.
pkg/neg/controller_test.go
Outdated
namer := namer_util.NewNamer(ClusterID, "") | ||
dynamicSchema := runtime.NewScheme() | ||
//dynamicSchema.AddKnownTypeWithName(schema.GroupVersionKind{Group: "networking.istio.io", Version: "v1alpha3", Kind: "List"}, &unstructured.UnstructuredList{}) | ||
//backendConfigClient := backendconfigclient.NewSimpleClientset() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented code can be deleted.
pkg/neg/controller.go
Outdated
@@ -19,6 +19,7 @@ package neg | |||
import ( | |||
context2 "context" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer needs to be imported as context2
pkg/neg/controller_test.go
Outdated
@@ -20,6 +20,7 @@ import ( | |||
context2 "context" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this no longer needs to be imported as context2
pkg/neg/controller.go
Outdated
@@ -19,6 +19,7 @@ package neg | |||
import ( | |||
context2 "context" | |||
"fmt" | |||
svcnegclient "k8s.io/ingress-gce/pkg/svcneg/client/clientset/versioned" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to the second import block
svcNegClient svcnegclient.Interface, | ||
destinationRuleClient dynamic.NamespaceableResourceInterface, | ||
kubeSystemUID types.UID, | ||
ingressInformer cache.SharedIndexInformer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not encapsulate informers and clients into separate structs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can follow up with a PR to refactor this into a separate NegControllerContext
.
Done. Ready for another round. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: freehan, swetharepakula The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
cc @swetharepakula