Skip to content

Commit fd2f49b

Browse files
wip of CRDs as config
1 parent 60ee6e8 commit fd2f49b

File tree

10 files changed

+1044
-7
lines changed

10 files changed

+1044
-7
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
jobs:
8+
java-autoinstrumentation:
9+
env:
10+
KUBECONFIG: /tmp/kube-config
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: make our image
15+
run: VERSION=dev make container
16+
- name: make java autoinstrumentation image
17+
run: |
18+
cd autoinstrumentation/java && docker build -t java-autoinstrumentation:dev --build-arg version=$(cat version.txt) .
19+
- name: Create kind cluster
20+
uses: helm/kind-action@v1.11.0
21+
with:
22+
cluster_name: kind
23+
node_image: kindest/node:v1.27.3
24+
- name: Deploy certificate signing request
25+
run: kubectl apply -f tests/integration/certs.yaml
26+
- name: Approve our certificate signing request
27+
run: kubectl certificate approve operator
28+
- name: register our image
29+
run: |
30+
img=$(docker images | grep operator | awk '{print $1":"$2}')
31+
docker tag $img manager:dev
32+
kind load docker-image manager:dev --name kind
33+
kind load docker-image java-autoinstrumentation:dev --name kind
34+
- name: Deploy collector
35+
run: kubectl apply -f tests/integration/collector.yaml
36+
- name: Deploy operator
37+
run: kubectl apply -f tests/integration/operator.yaml
38+
- name: Sleep 10s
39+
run: sleep 10
40+
- name: Deploy java app
41+
run: kubectl apply -f tests/integration/java.yaml
42+
- name: Sleep 20s
43+
run: sleep 20
44+
- name: Check logs
45+
run: |
46+
COLLECTOR_POD=$(kubectl get pod -l app=collector -o jsonpath="{.items[0].metadata.name}")
47+
LOGS=$(kubectl logs ${COLLECTOR_POD})
48+
echo ${LOGS}
49+
echo ${LOGS} | grep "Starting Servlet engine"

internal/config/config.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ type Config struct {
121121
Zap ZapConfig `yaml:"zap"`
122122
// EnableWebhooks enables the webhooks used by controllers.
123123
EnableWebhooks bool `yaml:"enable-webhooks"`
124+
// Instrumentation is the set of instrumentations to use if CRDs are not present
125+
Instrumentation Instrumentation `yaml:"instrumentations"`
126+
// EnableInstrumentationCRDs enables looking for instrumentation CRDs.
127+
EnableInstrumentationCRDs bool `yaml:"enable-instrumentation-crds"`
128+
}
129+
130+
type Instrumentation struct {
131+
ApacheHttpd *InstrumentationSpec `yaml:"apache-httpd,omitempty"`
132+
DotNet *InstrumentationSpec `yaml:"dotnet,omitempty"`
133+
Java *InstrumentationSpec `yaml:"java,omitempty"`
134+
Go *InstrumentationSpec `yaml:"go,omitempty"`
135+
NodeJS *InstrumentationSpec `yaml:"nodejs,omitempty"`
136+
Python *InstrumentationSpec `yaml:"python,omitempty"`
137+
Nginx *InstrumentationSpec `yaml:"nginx,omitempty"`
138+
Sdk *InstrumentationSpec `yaml:"sdk,omitempty"`
124139
}
125140

126141
// New constructs a new configuration.
@@ -172,7 +187,8 @@ func New() Config {
172187
LevelKey: "level",
173188
LevelFormat: "uppercase",
174189
},
175-
EnableWebhooks: true,
190+
EnableWebhooks: true,
191+
EnableInstrumentationCRDs: true,
176192
}
177193
}
178194

0 commit comments

Comments
 (0)