-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always require the cluster UUID in the FlowAggregator (#6714)
Before this change, the cluster UUID was strictly required by the S3Exporter and by the ClickHouseExporter, but somewhat optional for the IPFIXExporter (if not available after a certain timeout, a random UUID was generated and used to compute the IPFIX observation domain ID). Furthermore, every exporter by responsible for calling getClusterUUID independently, and that was the only reason for their implementations to require access to the K8s client. I think it makes more sense to make things more uniform, and require the cluster UUID to be available regardless of which exporters are enabled. We can retrieve the cluster UUID once during FlowAggrgator initialization, then pass it along to all exporters which need it. Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
- Loading branch information
1 parent
55384dc
commit ccf2dd0
Showing
9 changed files
with
199 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2024 Antrea Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package flowaggregator | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/require" | ||
"k8s.io/client-go/kubernetes/fake" | ||
|
||
"antrea.io/antrea/pkg/clusteridentity" | ||
) | ||
|
||
func TestGetClusterUUID(t *testing.T) { | ||
ctx := context.Background() | ||
client := fake.NewSimpleClientset() | ||
clusterIdentityAllocator := clusteridentity.NewClusterIdentityAllocator( | ||
"kube-system", | ||
clusteridentity.DefaultClusterIdentityConfigMapName, | ||
client, | ||
) | ||
stopCh := make(chan struct{}) | ||
defer close(stopCh) | ||
go clusterIdentityAllocator.Run(stopCh) | ||
|
||
ctx, cancel := context.WithTimeout(ctx, 2*time.Second) | ||
defer cancel() | ||
_, err := GetClusterUUID(ctx, client) | ||
require.NoError(t, err, "cluster UUID not available") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.