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

chore(chart): update tailing sidecar operator to 0.8.0 #3145

Merged
merged 2 commits into from
Jul 12, 2023
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
1 change: 1 addition & 0 deletions .changelog/3145.changed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chore(chart): update tailing sidecar operator to 0.8.0
2 changes: 1 addition & 1 deletion deploy/helm/sumologic/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies:
repository: https://helm.influxdata.com/
condition: telegraf-operator.enabled
- name: tailing-sidecar-operator
version: 0.7.0
version: 0.8.0
repository: https://sumologic.github.io/tailing-sidecar
condition: tailing-sidecar-operator.enabled
- name: opentelemetry-operator
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ The following table displays the currently used software versions for our Helm c
| kube-prometheus-stack/Prometheus Operator | 40.5.0 |
| Falco | 2.4.2 |
| Telegraf Operator | 1.3.10 |
| Tailing Sidecar Operator | 0.5.5 |
| Tailing Sidecar Operator | 0.8.0 |
| Fluentd | 1.15.3 |
| Fluent Bit | 2.1.6 |

Expand Down
57 changes: 45 additions & 12 deletions tests/integration/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ import (
type MetricsCollector string

const (
tickDuration = 3 * time.Second
waitDuration = 1 * time.Minute
expectedEventCount uint = 50 // number determined experimentally
logsGeneratorCount uint = 1000
logRecords = 4 // number of log records in single loop, see: tests/integration/yamls/pod_multiline_long_lines.yaml
logLoops = 500 // number of loops in which logs are generated, see: tests/integration/yamls/pod_multiline_long_lines.yaml
multilineLogCount uint = logRecords * logLoops
tracesPerExporter uint = 5 // number of traces generated per exporter
spansPerTrace uint = 2
Prometheus MetricsCollector = "prometheus"
Otelcol MetricsCollector = "otelcol"
Fluentd MetricsCollector = "fluentd"
tickDuration = 3 * time.Second
waitDuration = 1 * time.Minute
expectedEventCount uint = 50 // number determined experimentally
logsGeneratorCount uint = 1000
logRecords = 4 // number of log records in single loop, see: tests/integration/yamls/pod_multiline_long_lines.yaml
logLoops = 500 // number of loops in which logs are generated, see: tests/integration/yamls/pod_multiline_long_lines.yaml
multilineLogCount uint = logRecords * logLoops
tracesPerExporter uint = 5 // number of traces generated per exporter
spansPerTrace uint = 2
Prometheus MetricsCollector = "prometheus"
Otelcol MetricsCollector = "otelcol"
Fluentd MetricsCollector = "fluentd"
TailingSidecarCount uint = 150 // number of logs generated by tailing sidecar test (50 * 3), see: tests/inegration/yamls/tailing-sidecar-test.yaml
)

func GetMetricsFeature(expectedMetrics []string, metricsCollector MetricsCollector) features.Feature {
Expand Down Expand Up @@ -482,6 +483,25 @@ func GetTracesFeature() features.Feature {
Feature()
}

func GetTailingSidecarFeature() features.Feature {
return features.New("tailing sidecar test").
Setup(stepfuncs.KubectlApplyFOpt(internal.TailingSidecarTest, internal.TailingSidecarTestNamespace)).
Assess("tailing sidecar test logs present", stepfuncs.WaitUntilExpectedLogsPresent(
TailingSidecarCount,
map[string]string{
"namespace": internal.TailingSidecarTestNamespace,
"deployment": internal.TailingSidecarTestDeploymentName,
},
internal.ReceiverMockNamespace,
internal.ReceiverMockServiceName,
internal.ReceiverMockServicePort,
waitDuration,
tickDuration,
)).
Teardown(stepfuncs.KubectlDeleteFOpt(internal.TailingSidecarTest, internal.TailingSidecarTestNamespace)).
Feature()
}

type featureCheck func(*features.FeatureBuilder) *features.FeatureBuilder

func GetInstallFeature(installChecks []featureCheck) features.Feature {
Expand Down Expand Up @@ -877,3 +897,16 @@ func CheckFluentdEventsInstall(builder *features.FeatureBuilder) *features.Featu
return ctx
})
}

func CheckTailingSidecarOperatorInstall(builder *features.FeatureBuilder) *features.FeatureBuilder {
return builder.
Assess("tailing sidecar deployment is ready",
stepfuncs.WaitUntilDeploymentIsReady(
waitDuration,
tickDuration,
stepfuncs.WithNameF(
stepfuncs.ReleaseFormatter("%s-tailing-sidecar-operator"),
),
),
)
}
21 changes: 21 additions & 0 deletions tests/integration/helm_tailing_sidecar_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//go:build onlylatest
// +build onlylatest

package integration

import (
"testing"
)

func Test_Helm_Tailing_Sidecar(t *testing.T) {
installChecks := []featureCheck{
CheckOtelcolMetadataLogsInstall,
CheckTailingSidecarOperatorInstall,
}

featInstall := GetInstallFeature(installChecks)

featTailingSidecarTest := GetTailingSidecarFeature()

testenv.Test(t, featInstall, featTailingSidecarTest)
}
4 changes: 4 additions & 0 deletions tests/integration/internal/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const (
MultilineLogsPodName = "multiline-logs-generator"
MultilineLogsGenerator = "yamls/multiline-logs-generator.yaml"

TailingSidecarTestNamespace = "tailing-sidecar"
TailingSidecarTest = "yamls/tailing-sidecar-test.yaml"
TailingSidecarTestDeploymentName = "test-tailing-sidecar-operator"

// useful regular expressions for matching metadata
PodDeploymentSuffixRegex = "-[a-z0-9]{9,10}-[a-z0-9]{4,5}" // the Pod suffix for Deployments
PodDaemonSetSuffixRegex = "-[a-z0-9]{4,5}"
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/values/values_helm_tailing_sidecar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sumologic:
events:
enabled: false
metrics:
enabled: false
traces:
enabled: false

tailing-sidecar-operator:
enabled: true
76 changes: 76 additions & 0 deletions tests/integration/yamls/tailing-sidecar-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: tailing-sidecar
---
apiVersion: tailing-sidecar.sumologic.com/v1
kind: TailingSidecarConfig
metadata:
name: test-tailing-sidecar-operator
namespace: tailing-sidecar
spec:
podSelector:
matchLabels:
test-tailing-sidecar: "true"
configs:
test-sidecar:
volumeMount:
name: varlogconfig
mountPath: /varconfig/log
path: /varconfig/log/example2.log
annotations:
sourceCategory: test-sidecar
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-tailing-sidecar-operator
namespace: tailing-sidecar
labels:
app: test-tailing-sidecar-operator
spec:
replicas: 1
selector:
matchLabels:
tailing-sidecar: "true"
test-tailing-sidecar: "true"
app: test-tailing-sidecar-operator
template:
metadata:
name: test-tailing-sidecar-operator
namespace: tailing-sidecar
annotations:
tailing-sidecar: varlog:/var/log/example0.log;named-container:varlog:/var/log/example1.log
labels:
tailing-sidecar: "true"
test-tailing-sidecar: "true"
app: test-tailing-sidecar-operator
spec:
containers:
- name: count
image: bash
args:
- /usr/local/bin/bash
- -c
- >
i=0; for i in {1..50}; do
echo "example0: $i $(date)" >> /var/log/example0.log;
echo "example1: $i $(date)" >> /var/log/example1.log;
echo "example2: $i $(date)" >> /varconfig/log/example2.log;
sleep 1;
done; while true; do
sleep 1;
done;
volumeMounts:
- name: varlog
mountPath: /var/log
- name: varlogconfig
mountPath: /varconfig/log
volumes:
- name: varlog
emptyDir: {}
- name: varlogconfig
emptyDir: {}
securityContext:
runAsUser: 1000