From d9ad1745519a49e14802561b0bff83a064ac435d Mon Sep 17 00:00:00 2001 From: Dani Louca Date: Thu, 29 May 2025 19:05:49 -0400 Subject: [PATCH] [chore] Add EKS Auto Mode cluster testing Signed-off-by: Dani Louca --- .github/workflows/functional_test_v2.yaml | 77 ++++++++++++++++ .../functional/functional_test.go | 4 + .../eks_auto_mode_test_values.yaml.tmpl | 91 +++++++++++++++++++ 3 files changed, 172 insertions(+) create mode 100644 functional_tests/functional/testdata/values/eks_auto_mode_test_values.yaml.tmpl diff --git a/.github/workflows/functional_test_v2.yaml b/.github/workflows/functional_test_v2.yaml index 8a3a57d538..94935106a1 100644 --- a/.github/workflows/functional_test_v2.yaml +++ b/.github/workflows/functional_test_v2.yaml @@ -397,3 +397,80 @@ jobs: UPGRADE_FROM_CHART_DIR: base/splunk-otel-collector run: | TEARDOWN_BEFORE_SETUP=true SUITE=functional make functionaltest + + eks-auto-mode-test: + name: Test helm install in EKS Auto Mode - credentials needed + if: | + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || + (github.ref == 'refs/heads/main') + env: + KUBECONFIG: /tmp/kube-config-splunk-otel-collector-chart-functional-testing-eks-auto-mode + KUBE_TEST_ENV: eks/auto-mode + SKIP_TESTS: "true" # we need to skip functional tests as we have not set probes to listen to the traffic. + runs-on: ubuntu-latest + continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'Ignore Tests') }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: '**/go.sum' + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_SECRET }} + aws-region: us-west-2 + - name: Install kubeconfig + run: | + aws eks update-kubeconfig --name rotel-eks-autotest --region us-west-2 + - name: Update dependencies + run: | + make dep-update + - name: run functional tests + env: + HOST_ENDPOINT: 0.0.0.0 + run: | + TEARDOWN_BEFORE_SETUP=true SUITE=functional make functionaltest + + eks-auto-mode-upgrade-test: + name: Test helm upgrade in EKS Auto Mode - credentials needed + if: | + (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || + (github.ref == 'refs/heads/main') + env: + KUBECONFIG: /tmp/kube-config-splunk-otel-collector-chart-functional-testing-eks-auto-mode + KUBE_TEST_ENV: eks/auto-mode + SKIP_TESTS: "true" # we need to skip functional tests as we have not set probes to listen to the traffic. + runs-on: ubuntu-latest + continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'Ignore Tests') }} + steps: + - uses: actions/checkout@v4 + - name: Download the latest published release to use as a base for the upgrade + run: | + helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart + helm repo update + helm pull splunk-otel-collector-chart/splunk-otel-collector --untar --untardir base + - uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: '**/go.sum' + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_KEY }} + aws-secret-access-key: ${{ secrets.AWS_SECRET }} + aws-region: us-west-2 + - name: Install kubeconfig + run: | + aws eks update-kubeconfig --name rotel-eks-autotest --region us-west-2 + - name: Update dependencies + run: | + make dep-update + - name: run functional tests + env: + HOST_ENDPOINT: 0.0.0.0 + UPGRADE_FROM_VALUES: aws_upgrade_from_previous_release_values.yaml + UPGRADE_FROM_CHART_DIR: base/splunk-otel-collector + run: | + TEARDOWN_BEFORE_SETUP=true SUITE=functional make functionaltest diff --git a/functional_tests/functional/functional_test.go b/functional_tests/functional/functional_test.go index 1e7437d596..3e84f07728 100644 --- a/functional_tests/functional/functional_test.go +++ b/functional_tests/functional/functional_test.go @@ -49,6 +49,7 @@ const ( kindTestKubeEnv = "kind" eksTestKubeEnv = "eks" eksFargateTestKubeEnv = "eks/fargate" + eksAutoModeTestKubeEnv = "eks/auto-mode" autopilotTestKubeEnv = "gke/autopilot" aksTestKubeEnv = "aks" gceTestKubeEnv = "gce" @@ -177,6 +178,8 @@ func deployChartsAndApps(t *testing.T, testKubeConfig string) { valuesFile, err = filepath.Abs(filepath.Join(testDir, valuesDir, "aks_test_values.yaml.tmpl")) case eksFargateTestKubeEnv: valuesFile, err = filepath.Abs(filepath.Join(testDir, valuesDir, "eks_fargate_test_values.yaml.tmpl")) + case eksAutoModeTestKubeEnv: + valuesFile, err = filepath.Abs(filepath.Join(testDir, valuesDir, "eks_auto_mode_test_values.yaml.tmpl")) default: valuesFile, err = filepath.Abs(filepath.Join(testDir, valuesDir, "test_values.yaml.tmpl")) } @@ -496,6 +499,7 @@ func Test_Functions(t *testing.T) { gceTestKubeEnv, eksTestKubeEnv, eksFargateTestKubeEnv, + eksAutoModeTestKubeEnv, } switch { diff --git a/functional_tests/functional/testdata/values/eks_auto_mode_test_values.yaml.tmpl b/functional_tests/functional/testdata/values/eks_auto_mode_test_values.yaml.tmpl new file mode 100644 index 0000000000..f2a812a358 --- /dev/null +++ b/functional_tests/functional/testdata/values/eks_auto_mode_test_values.yaml.tmpl @@ -0,0 +1,91 @@ +--- +splunkObservability: + realm: CHANGEME + accessToken: CHANGEME + ingestUrl: {{ .AgentEndpoint }} + apiUrl: {{ .ApiURLEndpoint }} + +splunkPlatform: + token: foobar + endpoint: {{ .LogHecEndpoint }} + metricsEnabled: true + metricsIndex: myMetricsIndex + +serviceAccount: + name: splunk-otel-collector + +autodetect: + prometheus: true + +logsCollection: + journald: + enabled: true + directory: /run/log/journal +agent: + config: + exporters: + otlp: + endpoint: {{ .OtlpEndpoint }} + tls: + insecure: true + splunk_hec/platform_metrics: + endpoint: {{ .MetricHecEndpoint }} + service: + pipelines: + traces: + exporters: + - otlp +clusterReceiver: + eventsEnabled: true + config: + exporters: + signalfx: + ingest_url: {{ .K8sClusterEndpoint }} + tls: + insecure: true + splunk_hec/platform_logs: + endpoint: {{ .LogObjectsHecEndpoint }} + + k8sObjects: + - name: pods + - name: namespaces + - name: nodes + - name: events + mode: watch + +extraAttributes: + fromAnnotations: + - key: splunk.com/customField + tag_name: customField + fromLabels: + - key: app + from: pod + - key: app + from: namespace + + custom: + - name: "cluster_name" + value: "ci-k8s-cluster" + - name: "customfield1" + value: "customvalue1" + - name: "customfield2" + value: "customvalue2" + +environment: dev +operatorcrds: + install: true +operator: + enabled: true +targetAllocator: + enabled: true + + +{{ if (eq .KubeTestEnv "eks/auto-mode") }} +cloudProvider: aws +distribution: eks +{{ else }} +clusterName: dev-operator +{{ end }} + +featureGates: + enableEKSApiServerMetrics: true