Skip to content
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

Auth use signalmap #25284

Merged
merged 4 commits into from May 23, 2023
Merged

Auth use signalmap #25284

merged 4 commits into from May 23, 2023

Conversation

jrajahalme
Copy link
Member

@jrajahalme jrajahalme commented May 5, 2023

Agent implementation of pkg/signalmap is generalized from a single target (conntrack GC) to allow for multiple targets. This is then used for passing policy notifications for required authentication from datapath to the agent instead of using the monitor perf ring buffer. This should reduce CPU overhead when monitoring is otherwise not used.

@jrajahalme jrajahalme requested review from a team as code owners May 5, 2023 09:28
@jrajahalme jrajahalme requested a review from brb May 5, 2023 09:28
@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label May 5, 2023
@jrajahalme jrajahalme marked this pull request as draft May 5, 2023 09:29
@jrajahalme jrajahalme added area/servicemesh GH issues or PRs regarding servicemesh sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. labels May 5, 2023
@jrajahalme jrajahalme changed the title Auth use signalmap, add flag Auth use signalmap, add authenticated flag May 5, 2023
@jrajahalme jrajahalme added the release-note/misc This PR makes changes that have no direct user impact. label May 5, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label May 5, 2023
@maintainer-s-little-helper
Copy link

Commit a4e65b5e26948f65e5c887e4e5ec58face823bbb does not contain "Signed-off-by".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label May 5, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-sign-off The author needs to add signoff to their commits before merge. label May 6, 2023
@jrajahalme
Copy link
Member Author

/test-1.26-net-next


var (
log = logging.DefaultLogger.WithField(logfields.LogSubsys, "signalmap")
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will drop this log in favour of logrus.FieldLogger provided by Hive in a forthcoming update.

@jrajahalme
Copy link
Member Author

/test-1.26-net-next

@jrajahalme
Copy link
Member Author

net-next did not trigger, tried again.

@jrajahalme
Copy link
Member Author

/test-1.26-net-next

1 similar comment
@jrajahalme
Copy link
Member Author

/test-1.26-net-next

Copy link
Member

@pippolo84 pippolo84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, just some non-blocking nits. 💯

Comment on lines +20 to +31
const (
// SignalProtoV4 denotes IPv4 protocol
SignalProtoV4 SignalData = iota
// SignalProtoV6 denotes IPv6 protocol
SignalProtoV6
SignalProtoMax
)

var signalProto = [SignalProtoMax]string{
SignalProtoV4: "ipv4",
SignalProtoV6: "ipv6",
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we can get rid of the SignalProtoMax constant by letting the compiler calculate the size of the signalProto array with

var signalProto = [...]string{
	SignalProtoV4: "ipv4",
	SignalProtoV6: "ipv6",
}

Comment on lines +200 to +205
if ch == nil {
return "", ErrNilChannel
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to move this out of the returned func, since ch is not gonna change after the call to ChannelHandler. Doing that we can also avoid generating a func that always returns "", ErrNilChannel.


func newManager(params authManagerParams) (Manager, error) {
mgr, err := newAuthManager(params.AuthHandlers, params.DatapathAuthenticator, params.IPCache)
func newManager(params authManagerParams) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we usually call functions to be invoked as registerX, leaving newX for the ones that provide API to the hive.

@aanm aanm removed the request for review from brb May 22, 2023 12:37
Copy link
Member

@jibi jibi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipsec changes lgtm 👍

Add GetNodeIP(nodeID uint16) that returns the node IP for which the given
nodeID was allocated for. This will be used for authentication handshake
in later commits.

Check for 0 (== local node) explicitly and return local node address from
pkg/node in that case, as local node IPs are not in the maps.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
Maximum nunber of entries in both eventsmap and signalmap is the number
of possible CPUs, which never changes, is a low number, and is not adding
any real information to the status report. Remove them to reduce direct
dependencies to these maps.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
Move definition of the signal data to the signal handlers to limit go
dependencies. Signal delivery channel is now buffered so that signal
manager will not get blocked by any one of the signal handlers.

Pause/Unpause is generalized so that the perf events are paused only
when all the signals have been paused. Current implementation uses bit
mask (64 bits) which limits the max number of signals to 64.

Signal registration is to be done only from init or cell OnStart
functions, so that no locking is needed for managing signal
handlers. Mute/Unmute calls can happen concurrently.

Manage dependencies via Hive/Cell.

Add a fake signalmap so that controlplane tests may depend on it.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
Use signalmap instead of monitor events to notify userspace of missing
authentication.

Execute authentications concurrently and check for pending or completed
authentications before starting a new one with the same key.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
@jrajahalme
Copy link
Member Author

Rebased to resolve conflict

@jrajahalme
Copy link
Member Author

/ci-e2e

@jrajahalme
Copy link
Member Author

/ci-l4lb

@jrajahalme
Copy link
Member Author

/ci-multicluster

@jrajahalme
Copy link
Member Author

/ci-awscni

@jrajahalme
Copy link
Member Author

/ci-eks

@jrajahalme
Copy link
Member Author

/ci-verifier

@jrajahalme
Copy link
Member Author

/ci-external-workloads

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 23, 2023
@jrajahalme jrajahalme merged commit 72e47b5 into cilium:main May 23, 2023
57 checks passed
bimmlerd added a commit that referenced this pull request Jun 6, 2023
[ upstream commit 8294624 ]

[ backporter notes: conflicts due to moved files, #25284 not yet
                    backported, hence no GetNodeIP() to move.]

The NodeHandler interface is too large, as can be seen in various
implementations which are only implementing a subset of methods. This
patch splits off the NodeID handling part, and removes the stub methods
from noop implementations.

Signed-off-by: David Bimmler <david.bimmler@isovalent.com>
dylandreimerink pushed a commit that referenced this pull request Jun 9, 2023
[ upstream commit 8294624 ]

[ backporter notes: conflicts due to moved files, #25284 not yet
                    backported, hence no GetNodeIP() to move.]

The NodeHandler interface is too large, as can be seen in various
implementations which are only implementing a subset of methods. This
patch splits off the NodeID handling part, and removes the stub methods
from noop implementations.

Signed-off-by: David Bimmler <david.bimmler@isovalent.com>
jrajahalme added a commit to jrajahalme/image-tools that referenced this pull request Jun 13, 2023
cilium/cilium has ignored MACRO_ARG_REUSE since
cilium/cilium#25284, update the default ignores
so that this does not need to be explicitly added in cilium/cilium any
more.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
pchaigno pushed a commit that referenced this pull request Jan 8, 2024
[ upstream commit 8294624 ]

[ backporter notes: conflicts due to moved files, #25284 not yet
                    backported, hence no GetNodeIP() to move.]

The NodeHandler interface is too large, as can be seen in various
implementations which are only implementing a subset of methods. This
patch splits off the NodeID handling part, and removes the stub methods
from noop implementations.

Signed-off-by: David Bimmler <david.bimmler@isovalent.com>
Signed-off-by: Michi Mutsuzaki <michi@isovalent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/servicemesh GH issues or PRs regarding servicemesh ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-blocker/1.14 This issue will prevent the release of the next version of Cilium. release-note/misc This PR makes changes that have no direct user impact. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants