Skip to content

Commit

Permalink
Add test for k8s discovery with envoy
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Jan 24, 2025
1 parent 6c45b35 commit f077c48
Show file tree
Hide file tree
Showing 12 changed files with 776 additions and 7 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,56 @@ jobs:
run: make integration-test-${{ matrix.SERVICE }}-discovery
env:
SPLUNK_OTEL_COLLECTOR_IMAGE: 'otelcol:latest'

integration-test-discovery-k8s-matrix:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.get-matrix-k8s.outputs.matrix }}
steps:
- name: Get matrix for Kubernetes
id: get-matrix-k8s
run: |
includes=""
for service in "envoy"; do
for arch in "amd64"; do
includes="${includes},{\"SERVICE\": \"${service}\", \"ARCH\": \"${arch}\"}"
done
done
matrix="{\"include\": [${includes#,}]}"
echo "$matrix" | jq
echo "matrix=${matrix}" >> $GITHUB_OUTPUT
integration-test-discovery-k8s:
name: integration-test-discovery-k8s
runs-on: ubuntu-24.04
needs: [ "docker-otelcol", "otelcol", "integration-test-discovery-k8s-matrix" ]
strategy:
matrix: ${{ fromJSON(needs.integration-test-discovery-k8s-matrix.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create kind cluster
uses: helm/[email protected]
with:
node_image: kindest/node:v1.30.0
kubectl_version: v1.30.0
cluster_name: kind
- name: Deploy service under test
run: |
kubectl apply -f k8s/${{ matrix.SERVICE }}/*.yaml
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: '**/go.sum'
- uses: actions/download-artifact@v4
with:
name: docker-otelcol-${{ matrix.ARCH }}
path: ./docker-otelcol/${{ matrix.ARCH }}
- run: docker load -i ./docker-otelcol/${{ matrix.ARCH }}/image.tar
- name: Load Docker image in kind
run: |
kind load docker-image otelcol:latest --name kind
- name: Run ${{ matrix.SERVICE }} Discovery Kubernetes Integration Test
run: make integration-test-${{ matrix.SERVICE }}-discovery-k8s
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ integration-test-oracledb-discovery:
smartagent-integration-test:
@set -e; cd tests && $(GOTEST_SERIAL) $(BUILD_INFO_TESTS) --tags=smartagent_integration -v -timeout 5m -count 1 ./...

.PHONY: integration-test-envoy-discovery-k8s
integration-test-envoy-discovery-k8s:
@set -e; cd tests && $(GOTEST_SERIAL) $(BUILD_INFO_TESTS) --tags=discovery_integration_envoy_k8s -v -timeout 5m -count 1 ./...

.PHONY: test-with-cover
test-with-cover:
@echo Verifying that all packages have test files to count in coverage
Expand Down
26 changes: 26 additions & 0 deletions k8s/envoy/envoy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: envoy-test
spec:
replicas: 1
selector:
matchLabels:
app: envoy-test
template:
metadata:
name: envoy-test
labels:
app: envoy-test
spec:
automountServiceAccountToken: false
containers:
- image: quay.io/splunko11ytest/envoy:latest
name: envoy-test
imagePullPolicy: IfNotPresent
ports:
- containerPort: 10000
name: envoy
- containerPort: 9901
name: admin

33 changes: 30 additions & 3 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ require (
golang.org/x/exp v0.0.0-20230711023510-fffb14384f22
golang.org/x/sys v0.29.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.31.3
k8s.io/apimachinery v0.31.3
k8s.io/client-go v0.31.3
)

require (
Expand All @@ -43,23 +46,35 @@ require (
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/cpuguy83/dockercfg v0.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/knadh/koanf v1.5.0 // indirect
github.com/knadh/koanf/v2 v2.1.2 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
Expand All @@ -72,18 +87,21 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/mostynb/go-grpc-compression v1.2.3 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.117.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/collector v0.117.0 // indirect
go.opentelemetry.io/collector/client v1.23.0 // indirect
Expand Down Expand Up @@ -113,11 +131,20 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/grpc v1.69.2 // indirect
google.golang.org/protobuf v1.36.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit f077c48

Please sign in to comment.