feat(k8s): discovery uses EndpointSlices instead of Endpoints #740
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Welcome to Cryostat! 👋
Before contributing, make sure you have:
main
branch[chore, ci, docs, feat, fix, test]
To recreate commits with GPG signature
git fetch upstream && git rebase --force --gpg-sign upstream/main
Fixes: #717
Description of the change:
Replaces the Kubernetes API discovery mechanism's usage of the older Endpoints with the newer EndpointSlices. This should be functionally identical to the end Cryostat user and should record the same results in the database, it's only a slight internal logic change.
For early review and testing purposes, this PR currently retains the old
Endpoints
-based implementation and adds the newEndpointSlices
-based implementation as a separate discovery plugin/realm, which is enabled by a different config property. This is so that it's possible to enable both at the same time on the same Cryostat instance and verify that they behave identically. Once that is validated then I will clean up this PR so that the new implementation simply replaces the old one as an internal implementation detail.Motivation for the change:
This is a newer Kubernetes API feature and may have some performance benefits (fewer discovery update events?).~~ It opens the door for future improvements like using the EndpointSlices' readiness property to either gate target discoveryability, or to include that readiness data in the target record.~~ The EndpointSlices' "conditions" are embedded into the target definition as Cryostat annotations, ie. the target's readiness state can be determined.
How to manually test:
cryostat
,apps1
, andapps2
. In each, use the Operator'sMakefile
tomake sample_app
to install a sample application to each namespacekubectl scale -n apps2 deployment quarkus-test --replicas=2
$ helm install --set core.image.repository=quay.io/andrewazores/cryostat --set core.image.tag=endpoint-slices-4 --set core.route.enabled=true --set core.discovery.kubernetes.namespaces='{cryostat,apps1,apps2}' --set core.discovery.kubernetes.enabled=false --set core.discovery.kubernetes2.enabled=true cryostat ./charts/cryostat
(if not using OpenShift, turn off thecore.route.enabled
switch)EndpointSlices
discovery. When using the new discovery mechanism there should also be Cryostat annotations visible in the Topology view indicating the slices' conditions, ie readiness/serving/terminating:helm upgrade --reuse-values --set core.discovery.kubernetes.enabled=true --set core.discovery.kubernetes2.enabled=false cryostat ./charts/cryostat
kubectl scale
command on different sample applications in each namespace to test the behaviour of both the old and new implementations. Both should behave the same way with target lost/found events.