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

tests: add basic test for workload lifecycle #1526

Merged
merged 21 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d57bc21
tests: add basic test for workload lifecycle
blumamir Sep 20, 2024
20a9947
chore: rename workload name
blumamir Sep 20, 2024
9ecccc3
test: add test from runtime version not detected
blumamir Sep 20, 2024
32b1110
Merge remote-tracking branch 'upstream/main' into e2e-workload-lifecycle
blumamir Sep 20, 2024
609442f
test: add assertions for nodejs-very-old-version
blumamir Sep 20, 2024
b2fac43
feat: add template for nodejs minimum version e2e scenario
blumamir Sep 20, 2024
6d6890c
Merge remote-tracking branch 'upstream/main' into e2e-workload-lifecycle
blumamir Sep 20, 2024
2d76c74
test: assert nodejs-minimum-version
blumamir Sep 20, 2024
083f64d
test: genrate traffic and test trace is created
blumamir Sep 21, 2024
8af3725
test: add nodejs-latest-version test case
blumamir Sep 21, 2024
e47302c
test: add cpp-http-server scenario to e2e test
blumamir Sep 21, 2024
71f7cc3
fix: cpp http server test sceario compilation issue
blumamir Sep 21, 2024
1d9f5a4
test: add nodejs-docker-env scenario
blumamir Sep 21, 2024
18c8719
test: dockerfile use another node option other than require
blumamir Sep 21, 2024
b0305aa
test: add workload for nodejs-manifest-env
blumamir Sep 21, 2024
3d191c6
test: add new step to update the workload manifests
blumamir Sep 21, 2024
497fe32
Merge remote-tracking branch 'upstream/main' into e2e-workload-lifecycle
blumamir Sep 21, 2024
a023a24
step 02 - update workload manifests
blumamir Sep 21, 2024
9e3f112
Merge remote-tracking branch 'upstream/main' into e2e-workload-lifecycle
blumamir Sep 21, 2024
a7b9496
Merge remote-tracking branch 'upstream/main' into e2e-workload-lifecycle
blumamir Sep 23, 2024
5b2f838
Merge remote-tracking branch 'upstream/main' into e2e-workload-lifecycle
blumamir Sep 25, 2024
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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ui/node_modules
frontend/webapp/node_modules
.git/
Dockerfile
odiglet/Dockerfile
odiglet/base.Dockerfile
odiglet/debug.Dockerfile
tests # not needed in context for odigos components builds
1 change: 1 addition & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- "helm-chart"
- "fe-synthetic"
- "cli-upgrade"
- "workload-lifecycle"
include:
- kube-version: "1.23"
kind-image: "kindest/node:v1.23.17@sha256:14d0a9a892b943866d7e6be119a06871291c517d279aedb816a4b4bc0ec0a5b3"
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,25 @@ cli-upgrade:
@echo "Installing odigos from source. version: $(ODIGOS_CLI_VERSION)"
cd ./cli ; go run -tags=embed_manifests . upgrade --version $(ODIGOS_CLI_VERSION) --yes

.PHONY: cli-build
cli-build:
@echo "Building the cli executable for tests"
cd cli && go build -tags=embed_manifests -o odigos .

.PHONY: api-all
api-all:
make -C api all

.PHONY: crd-apply
crd-apply: api-all cli-upgrade
@echo "Applying changes to CRDs in api directory"

.PHONY: dev-tests-kind-cluster
dev-tests-kind-cluster:
@echo "Creating a kind cluster for development"
kind delete cluster
kind create cluster

.PHONY: dev-tests-setup
dev-tests-setup: TAG := e2e-test
dev-tests-setup: dev-tests-kind-cluster cli-build build-images load-to-kind
12 changes: 12 additions & 0 deletions tests/e2e/workload-lifecycle/01-add-destination.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: odigos.io/v1alpha1
kind: Destination
metadata:
name: odigos.io.dest.tempo-123123
namespace: odigos-system
spec:
data:
TEMPO_URL: e2e-tests-tempo.traces:4317
destinationName: e2e-tests
signals:
- TRACES
type: tempo
14 changes: 14 additions & 0 deletions tests/e2e/workload-lifecycle/01-assert-apps-installed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Pod
metadata:
labels:
app: node-very-old-version
namespace: default
status:
containerStatuses:
- name: node-very-old-version
ready: true
restartCount: 0
started: true
phase: Running
---
13 changes: 13 additions & 0 deletions tests/e2e/workload-lifecycle/01-assert-instrumented.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: odigos.io/v1alpha1
kind: InstrumentedApplication
metadata:
namespace: default
name: deployment-node-very-old-version
status:
conditions:
- message: "javascript runtime version not supported by OpenTelemetry SDK. Found:
8.17.0, supports: 14.0.0"
observedGeneration: 1
reason: RuntimeVersionNotSupported
status: "False"
type: AppliedInstrumentationDevice
182 changes: 182 additions & 0 deletions tests/e2e/workload-lifecycle/01-assert-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
apiVersion: odigos.io/v1alpha1
kind: CollectorsGroup
metadata:
name: odigos-data-collection
namespace: odigos-system
spec:
role: NODE_COLLECTOR
status:
ready: true
---
apiVersion: odigos.io/v1alpha1
kind: CollectorsGroup
metadata:
name: odigos-gateway
namespace: odigos-system
spec:
role: CLUSTER_GATEWAY
status:
ready: true
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
odigos.io/collector-role: "CLUSTER_GATEWAY"
name: odigos-gateway
namespace: odigos-system
ownerReferences:
- apiVersion: odigos.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: CollectorsGroup
name: odigos-gateway
spec:
replicas: 1
selector:
matchLabels:
odigos.io/collector-role: "CLUSTER_GATEWAY"
template:
metadata:
labels:
odigos.io/collector-role: "CLUSTER_GATEWAY"
spec:
containers:
- env:
- name: ODIGOS_VERSION
valueFrom:
configMapKeyRef:
key: ODIGOS_VERSION
name: odigos-deployment
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
- name: GOMEMLIMIT
(value != null): true
name: gateway
resources:
requests:
(memory != null): true
volumeMounts:
- mountPath: /conf
name: collector-conf
volumes:
- configMap:
defaultMode: 420
items:
- key: collector-conf
path: collector-conf.yaml
name: odigos-gateway
name: collector-conf
status:
availableReplicas: 1
readyReplicas: 1
replicas: 1
---
apiVersion: v1
kind: ConfigMap
metadata:
name: odigos-gateway
namespace: odigos-system
ownerReferences:
- apiVersion: odigos.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: CollectorsGroup
name: odigos-gateway
(data != null): true
---
apiVersion: v1
kind: ConfigMap
metadata:
name: odigos-data-collection
namespace: odigos-system
ownerReferences:
- apiVersion: odigos.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: CollectorsGroup
name: odigos-data-collection
(data != null): true
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
odigos.io/collector-role: "NODE_COLLECTOR"
name: odigos-data-collection
namespace: odigos-system
ownerReferences:
- apiVersion: odigos.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: CollectorsGroup
name: odigos-data-collection
spec:
selector:
matchLabels:
odigos.io/collector-role: "NODE_COLLECTOR"
template:
metadata:
labels:
odigos.io/collector-role: "NODE_COLLECTOR"
spec:
containers:
- name: data-collection
securityContext:
privileged: true
volumeMounts:
- mountPath: /conf
name: conf
- mountPath: /var/lib/docker/containers
name: varlibdockercontainers
readOnly: true
- mountPath: /var/log
name: varlog
readOnly: true
- mountPath: /var/lib/kubelet/pod-resources
name: kubeletpodresources
readOnly: true
env:
- name: NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: POD_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.name
hostNetwork: true
nodeSelector:
kubernetes.io/os: linux
securityContext: {}
serviceAccount: odigos-data-collection
serviceAccountName: odigos-data-collection
volumes:
- configMap:
defaultMode: 420
items:
- key: conf
path: conf.yaml
name: odigos-data-collection
name: conf
- hostPath:
path: /var/log
type: ""
name: varlog
- hostPath:
path: /var/lib/docker/containers
type: ""
name: varlibdockercontainers
- hostPath:
path: /var/lib/kubelet/pod-resources
type: ""
name: kubeletpodresources
status:
numberAvailable: 1
numberReady: 1
---
17 changes: 17 additions & 0 deletions tests/e2e/workload-lifecycle/01-assert-runtime-detected.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: odigos.io/v1alpha1
kind: InstrumentedApplication
metadata:
name: deployment-node-very-old-version
namespace: default
ownerReferences:
- apiVersion: apps/v1
blockOwnerDeletion: true
controller: true
kind: Deployment
name: node-very-old-version
spec:
runtimeDetails:
- containerName: node-very-old-version
language: javascript
runtimeVersion: 8.17.0
---
26 changes: 26 additions & 0 deletions tests/e2e/workload-lifecycle/01-assert-workloads.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
generation: 1
labels:
app: node-very-old-version
name: node-very-old-version
namespace: default
spec:
selector:
matchLabels:
app: node-very-old-version
template:
spec:
containers:
- image: node-very-old-version:v0.0.1
name: node-very-old-version
resources: {}
status:
availableReplicas: 1
observedGeneration: 1
readyReplicas: 1
replicas: 1
updatedReplicas: 1
34 changes: 34 additions & 0 deletions tests/e2e/workload-lifecycle/01-install-test-apps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: node-very-old-version
namespace: default
labels:
app: node-very-old-version
spec:
selector:
matchLabels:
app: node-very-old-version
template:
metadata:
labels:
app: node-very-old-version
spec:
containers:
- name: node-very-old-version
image: node-very-old-version:v0.0.1
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
---
kind: Service
apiVersion: v1
metadata:
name: node-very-old-version
namespace: default
spec:
selector:
app: node-very-old-version
ports:
- protocol: TCP
port: 3000
6 changes: 6 additions & 0 deletions tests/e2e/workload-lifecycle/01-instrument-ns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: default
labels:
odigos-instrumentation: enabled
21 changes: 21 additions & 0 deletions tests/e2e/workload-lifecycle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Workload Lifecycle

This e2e test verify various scenarios related to the lifecycle of workloads in the cluster.

## Node.js Workloads

### node-very-old-version

This workload is running Node.js version 8 and verify that odigos can ignore it gracefully.
Odigos is expected to detect the runtime version from the environment in the base docker image and not apply any instrumentation device to the deployment, should not restart the pods, and report the issue in instrumented application CR.

## Steps

## Step 01

Adds the initial workloads, instrument the ns and add destination to odigos.
Verify the expected state for each workload according to it's caracteristics.

In this step we deploy the following workloads:

- node-very-old-version - should detect the runtime version and avoid instrumentation device.
Loading
Loading