Skip to content
Open
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
158 changes: 142 additions & 16 deletions .github/workflows/operator-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ permissions:
jobs:
InstrumentationTest:
name: InstrumentationTest
needs: [BuildAndCacheImage]
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -31,7 +32,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-go@v5
- name: Start minikube
uses: medyagh/setup-minikube@master

Expand All @@ -44,11 +45,17 @@ jobs:
sleep 10
kubectl get pods -A

- name: Build image
- name: Restore cached Docker image
uses: actions/cache@v3
with:
path: image.tar
key: docker-image-${{ github.sha }}

- name: Load Docker image
run: |
eval $(minikube docker-env)
make container
docker images
docker load < image.tar


- name: Deploy operator to minikube
run: |
Expand Down Expand Up @@ -78,6 +85,7 @@ jobs:
kubectl wait --for=condition=Ready pod --all -n default
kubectl get pods -A
kubectl describe pods -n default
kubectl logs deployment/cloudwatch-controller-manager --all-containers=true -n amazon-cloudwatch
go run integration-tests/manifests/cmd/validate_instrumentation_vars.go default integration-tests/java/default_instrumentation_java_env_variables.json app_signals

- name: Test for defined instrumentation resources for Java
Expand Down Expand Up @@ -230,6 +238,7 @@ jobs:

DeploymentAnnotationsTest:
name: DeploymentAnnotationsTest
needs: [BuildAndCacheImage]
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -239,6 +248,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v5

- name: Start minikube
uses: medyagh/setup-minikube@master
Expand All @@ -252,11 +262,16 @@ jobs:
sleep 10
kubectl get pods -A

- name: Build image
- name: Restore cached Docker image
uses: actions/cache@v3
with:
path: image.tar
key: docker-image-${{ github.sha }}

- name: Load Docker image
run: |
eval $(minikube docker-env)
make container
docker images
docker load < image.tar

- name: Deploy operator to minikube
run: |
Expand All @@ -280,9 +295,97 @@ jobs:
go test -v -run TestNodeJSOnlyDeployment ./integration-tests/manifests/annotations -timeout 30m
sleep 5
go test -v -run TestAnnotationsOnMultipleResources ./integration-tests/manifests/annotations -timeout 30m
DefineAutoMonitorTestMatrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v5
- name: Generate test list
id: tests
run: |
cd integration-tests/manifests/automonitor/ && \
echo "tests<<EOF" >> $GITHUB_OUTPUT
go test -list . | sed -e '$d' >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create test matrix
id: set-matrix
run: |
TESTS=$(echo "${{ steps.tests.outputs.tests }}" | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "matrix={\"test\":${TESTS}}" >> $GITHUB_OUTPUT
BuildAndCacheImage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v5
- name: Build image
run: |
make container
docker save $(docker images --format '{{.Repository}}:{{.Tag}}' | grep operator | head -n 1) > image.tar

- name: Cache Docker image
uses: actions/cache@v3
with:
path: image.tar
key: docker-image-${{ github.sha }}

AutoMonitorTest:
name: AutoMonitorTest
runs-on: ubuntu-latest
needs: [DefineAutoMonitorTestMatrix, BuildAndCacheImage]
permissions:
id-token: write
contents: read
strategy:
matrix: ${{fromJson(needs.DefineAutoMonitorTestMatrix.outputs.matrix)}}
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v5

- name: Start minikube
uses: medyagh/setup-minikube@master

- name: Deploy cert-manager to minikube
run:
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.0/cert-manager.yaml

- name: Verify minikube and cert-manager
run: |
sleep 10
kubectl get pods -A

- name: Restore cached Docker image
uses: actions/cache@v3
with:
path: image.tar
key: docker-image-${{ github.sha }}

- name: Load Docker image
run: |
eval $(minikube docker-env)
docker load < image.tar

- name: Deploy operator to minikube
run: |
make deploy

- name: Test AutoMonitor-created annotations
run: |
kubectl get pods -A
kubectl describe pods -n default
go test -v ./integration-tests/manifests/automonitor -run ^${{ matrix.test }}$ -timeout 60m -controllerManagerName 'cloudwatch-controller-manager'

DaemonsetAnnotationsTest:
name: DaemonsetAnnotationsTest
needs: [BuildAndCacheImage]
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -292,6 +395,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v5

- name: Start minikube
uses: medyagh/setup-minikube@master
Expand All @@ -305,11 +409,17 @@ jobs:
sleep 10
kubectl get pods -A

- name: Build image
- name: Restore cached Docker image
uses: actions/cache@v3
with:
path: image.tar
key: docker-image-${{ github.sha }}

- name: Load Docker image
run: |
eval $(minikube docker-env)
make container
docker images
docker load < image.tar


- name: Deploy operator to minikube
run: |
Expand All @@ -336,6 +446,7 @@ jobs:

StatefulsetAnnotationsTest:
name: StatefulsetAnnotationsTest
needs: [BuildAndCacheImage]
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -345,6 +456,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v5

- name: Start minikube
uses: medyagh/setup-minikube@master
Expand All @@ -358,11 +470,17 @@ jobs:
sleep 10
kubectl get pods -A

- name: Build image
- name: Restore cached Docker image
uses: actions/cache@v3
with:
path: image.tar
key: docker-image-${{ github.sha }}

- name: Load Docker image
run: |
eval $(minikube docker-env)
make container
docker images
docker load < image.tar


- name: Deploy operator to minikube
run: |
Expand Down Expand Up @@ -390,6 +508,7 @@ jobs:

NamespaceAnnotationsTest:
name: NamespaceAnnotationsTest
needs: [BuildAndCacheImage]
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -399,6 +518,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v5

- name: Start minikube
uses: medyagh/setup-minikube@master
Expand All @@ -411,11 +531,17 @@ jobs:
run: |
kubectl get pods -A

- name: Build image
- name: Restore cached Docker image
uses: actions/cache@v3
with:
path: image.tar
key: docker-image-${{ github.sha }}

- name: Load Docker image
run: |
eval $(minikube docker-env)
make container
docker images
docker load < image.tar


- name: Deploy operator to minikube
run: |
Expand Down
32 changes: 32 additions & 0 deletions integration-tests/manifests/admin-dashboard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: admin-dashboard
labels:
app: admin-dashboard
spec:
replicas: 1
selector:
matchLabels:
app: admin-dashboard
template:
metadata:
labels:
app: admin-dashboard
spec:
containers:
- name: admin-dashboard-container
image: nginx:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: admin-dashboard-service
spec:
selector:
app: admin-dashboard
ports:
- port: 80
targetPort: 80
Loading
Loading