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

Fix for fluent integration tests for Windows #438

Merged
merged 6 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions terraform/eks/daemon/fluent/windows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ resource "kubernetes_cluster_role_binding" "rolebinding" {
}

resource "kubernetes_config_map" "cwagentconfig" {
depends_on = [kubernetes_namespace.namespace]
metadata {
name = "cwagentconfig"
namespace = "amazon-cloudwatch"
Expand Down Expand Up @@ -525,6 +526,7 @@ resource "kubernetes_config_map" "cluster_info" {
}

resource "kubernetes_service_account" "fluentbit_service" {
depends_on = [kubernetes_namespace.namespace]
metadata {
name = "fluent-bit"
namespace = "amazon-cloudwatch"
Expand Down
8 changes: 4 additions & 4 deletions terraform/eks/daemon/fluent/windows/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ provider "kubernetes" {
exec {
api_version = "client.authentication.k8s.io/v1beta1"
command = "aws"
args = ["eks", "get-token", "--cluster-name", module.fluent_common.cluster_name]
args = ["eks", "get-token", "--cluster-name", aws_eks_cluster.cluster.name]
}
host = module.fluent_common.cluster_endpoint
cluster_ca_certificate = base64decode(module.fluent_common.cluster_cert)
token = module.fluent_common.cluster_auth_token
host = aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(aws_eks_cluster.cluster.certificate_authority.0.data)
token = data.aws_eks_cluster_auth.cluster_auth.token
}
13 changes: 11 additions & 2 deletions test/fluent/fluent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/aws/amazon-cloudwatch-agent-test/util/awsservice"
)

const logStreamRetry = 20
const logStreamRetry = 10

// fluent log group with expected log message fields
var logGroupToKey = map[string][][]string{
Expand Down Expand Up @@ -61,10 +61,19 @@ func TestFluentLogs(t *testing.T) {
logGroupToKey = logGroupToKeyWindows
}

currRetries := 0
now := time.Now()
for group, fieldsArr := range logGroupToKey {
group = fmt.Sprintf("/aws/containerinsights/%s/%s", env.EKSClusterName, group)
if !awsservice.IsLogGroupExists(group) {
for currRetries < logStreamRetry {
if awsservice.IsLogGroupExists(group) {
break
} else {
currRetries++
time.Sleep(time.Duration(currRetries) * time.Second)
}
}
if currRetries >= logStreamRetry {
t.Fatalf("fluent log group doesn't exsit: %s", group)
}

Expand Down
Loading