-
Notifications
You must be signed in to change notification settings - Fork 370
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
Reduce permission of antrea-agent service account #3691
Reduce permission of antrea-agent service account #3691
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.
LGTM
@tnqn The e2e test failed because with this change the testing code cannot determine which Node owns the external IP. Most of the test cases will need to check the assigned Node by the hostname field in the status of a Service. I cannot find an easy way to figure out which Node owns the IP as they are not physically assigned. Do you think it is OK to remove all related test cases until we have a new API for assigned Node checking? |
@xliuxu we don't assign the IP to the transport interface? |
@antoninbas No. For LB IP of Services, we do not assign IP to any interfaces on the Node. Otherwise, it will conflict with the implementation of proxyAll feature. We use userspace ARP/NDP responders to handle ARP/NDP queries instead. |
@xliuxu we need a way to check which Node owns the IP for troubleshooting anyway. Could we add a
|
ddb269f
to
ccbc603
Compare
@tnqn Thanks for the suggestion. I have added a new command |
Codecov Report
@@ Coverage Diff @@
## main #3691 +/- ##
==========================================
- Coverage 64.60% 57.91% -6.69%
==========================================
Files 278 393 +115
Lines 39640 56425 +16785
==========================================
+ Hits 25608 32678 +7070
- Misses 12043 21257 +9214
- Partials 1989 2490 +501
Flags with carried forward coverage won't be shown. Click here to find out more.
|
ccbc603
to
0be085e
Compare
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.
LGTM overall
7448c54
to
28d0dac
Compare
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.
LGTM
/test-all |
@antoninbas will you take another look? |
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.
some small comments and questions, but overall LGTM
@@ -82,6 +83,7 @@ func installHandlers(aq agentquerier.AgentQuerier, npq querier.AgentNetworkPolic | |||
s.Handler.NonGoRestfulMux.HandleFunc("/addressgroups", addressgroup.HandleFunc(npq)) | |||
s.Handler.NonGoRestfulMux.HandleFunc("/ovsflows", ovsflows.HandleFunc(aq)) | |||
s.Handler.NonGoRestfulMux.HandleFunc("/ovstracing", ovstracing.HandleFunc(aq)) | |||
s.Handler.NonGoRestfulMux.HandleFunc("/serviceexternalip", serviceexternalip.HandleFunc(seipq)) |
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.
you may want to add the /serviceexternalip
URL to the antctl
RBAC ClusterRole, just for consistency (and in case someone is using the antctl
ServiceAccount token to access antrea APIs directly)
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.
added.
info := make([]querier.ServiceExternalIPInfo, len(c.externalIPStates)) | ||
idx := 0 | ||
for k, v := range c.externalIPStates { | ||
info[idx].ServiceName = k.Name | ||
info[idx].Namespace = k.Namespace | ||
info[idx].ExternalIP = v.ip | ||
info[idx].ExternalIPPool = v.ipPool | ||
info[idx].AssignedNode = v.assignedNode | ||
idx++ | ||
} |
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: I think something like this is more elegant:
info := make([]querier.ServiceExternalIPInfo, 0, len(c.externalIPStates))
for k, v := range c.externalIPStates {
info = append(info, querier.ServiceExternalIPInfo{
ServiceName: k.Name,
// ...
})
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.
thanks. updated.
@@ -71,7 +71,7 @@ type ServiceExternalIPController struct { | |||
|
|||
queue workqueue.RateLimitingInterface | |||
|
|||
externalIPStates map[apimachinerytypes.NamespacedName]externalIPState | |||
externalIPStates map[apimachinerytypes.NamespacedName]*externalIPState |
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.
is there a reason for making this is a pointer? Based on usage in GetServiceExternalIPStatus
, it doesn't seem necessary.
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.
It is just for the defer statement to save the externalIPState
. I have reverted this change since it is not necessary and can also be achieved by changing the signature of func saveServiceState
.
157d878
to
03b44ae
Compare
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.
LGTM
Remove the update permission for services/status of antrea-agent service account. Remove the optimization for ExternalTrafficPolicy setting to Local cases in ServiceExternalIP feature accordingly. Introduce "antctl get serviceexternalip" command for the agent to make checking the assigned Node of external IPs easier. Signed-off-by: Xu Liu <[email protected]>
03b44ae
to
fea1ef5
Compare
@@ -113,7 +113,7 @@ func testAntctlAgentLocalAccess(t *testing.T, data *TestData) { | |||
cmd := strings.Join(args, " ") | |||
t.Run(cmd, func(t *testing.T) { | |||
stdout, stderr, err := runAntctl(podName, args, data) | |||
if err != nil { | |||
if err != nil && !strings.HasSuffix(stderr, "not enabled\n") { |
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.
@tnqn I just pushed a new commit with a single line change here to fix the e2e error for antctl
.
/test-all |
/test-networkpolicy |
@xliuxu please cherry-pick this to release-1.6 |
Remove the update permission for services/status of antrea-agent
service account. Remove the optimization for ExternalTrafficPolicy
setting to Local cases in ServiceExternalIP feature accordingly.
Signed-off-by: Xu Liu [email protected]