Skip to content

Commit e4b69c6

Browse files
authored
Merge branch 'main' into TA-update-configs-to-enable-mtls
2 parents 9f16d57 + e84193d commit e4b69c6

File tree

88 files changed

+3939
-741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3939
-741
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: 'breaking'
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: auto-instrumentation
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Enable multi instrumentation by default.
9+
10+
# One or more tracking issues related to the change
11+
issues: [3090]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext: |
17+
Starting with this release, the OpenTelemetry Operator now enables multi-instrumentation by default.
18+
This enhancement allows instrumentation of multiple containers in a pod with language-specific configurations.|
19+
Key Changes:
20+
- Single Instrumentation (Default Behavior): If no container names are specified using the
21+
`instrumentation.opentelemetry.io/container-names` annotation, instrumentation will be applied to the first container in
22+
the pod spec by default. This only applies when single instrumentation injection is configured.
23+
- Multi-Container Pods: In scenarios where different containers in a pod use distinct technologies, users must specify the
24+
container(s) for instrumentation using language-specific annotations. Without this specification, the default behavior may
25+
not work as expected for multi-container environments.
26+
Compatibility:
27+
- Users already utilizing the `instrumentation.opentelemetry.io/container-names` annotation do not need to take any action.
28+
Their existing setup will continue to function as before.
29+
- Important: Users who attempt to configure both `instrumentation.opentelemetry.io/container-names` and language-specific annotations
30+
(for multi-instrumentation) simultaneously will encounter an error, as this configuration is not supported.

.chloggen/3149-add-must-gather.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: auto-instrumentation, collector
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Add a must gather utility to help troubleshoot"
9+
10+
# One or more tracking issues related to the change
11+
issues: [3149]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext: |
17+
The new utility is available as part of a new container image.
18+
19+
To use the image in a running OpenShift cluster, you need to run the following command:
20+
21+
```sh
22+
oc adm must-gather --image=ghcr.io/open-telemetry/opentelemetry-operator/must-gather -- /usr/bin/must-gather --operator-namespace opentelemetry-operator-system
23+
```
24+
25+
See the [README](https://github.com/open-telemetry/opentelemetry-operator/blob/main/cmd/gather/README.md) for more details.

.chloggen/container-names.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: bug_fix
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: auto-instrumentation
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Fix ApacheHttpd, Nginx and SDK injectors to honour their container-names annotations.
9+
10+
# One or more tracking issues related to the change
11+
issues: [3313]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext: This is a breaking change if anyone is accidentally using the enablement flag with container names for these 3 injectors.

.chloggen/fips.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: collector
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Add flag to disable components when operator runs on FIPS enabled cluster.
9+
10+
# One or more tracking issues related to the change
11+
issues: [3315]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext: |
17+
Flag `--fips-disabled-components=receiver.otlp,exporter.otlp,processor.batch,extension.oidc` can be used to disable
18+
components when operator runs on FIPS enabled cluster. The operator uses `/proc/sys/crypto/fips_enabled` to check
19+
if FIPS is enabled.

.chloggen/improve-probe-parsing.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: enhancement
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
5+
component: collector
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Improves healthcheck parsing capabilities, allowing for future extensions to configure a healthcheck other than the v1 healthcheck extension.
9+
10+
# One or more tracking issues related to the change
11+
issues: [3184]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
change_type: enhancement
2+
3+
component: auto-instrumentation
4+
5+
note: Add support for k8s labels such as app.kubernetes.io/name for resource attributes
6+
7+
issues: [3112]
8+
9+
subtext: |
10+
You can opt-in as follows:
11+
```yaml
12+
apiVersion: opentelemetry.io/v1alpha1
13+
kind: Instrumentation
14+
metadata:
15+
name: my-instrumentation
16+
spec:
17+
defaults:
18+
useLabelsForResourceAttributes: true
19+
```
20+
The following labels are supported:
21+
- `app.kubernetes.io/name` becomes `service.name`
22+
- `app.kubernetes.io/version` becomes `service.version`
23+
- `app.kubernetes.io/part-of` becomes `service.namespace`
24+
- `app.kubernetes.io/instance` becomes `service.instance.id`

.github/workflows/e2e.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- group: e2e-instrumentation
4040
setup: "add-instrumentation-params prepare-e2e"
4141
- group: e2e-multi-instrumentation
42-
setup: "add-multi-instrumentation-params prepare-e2e"
42+
setup: "add-instrumentation-params prepare-e2e"
4343
- group: e2e-metadata-filters
4444
setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=.*filter.out --annotations-filter=config.*.gke.io.* --labels-filter=.*filter.out' prepare-e2e"
4545
- group: e2e-ta-collector-mtls
@@ -60,7 +60,7 @@ jobs:
6060
path: bin
6161
key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }}-${{ steps.setup-go.outputs.go-version }}
6262
- name: Install chainsaw
63-
uses: kyverno/[email protected].10
63+
uses: kyverno/[email protected].11
6464
- name: Install tools
6565
run: make install-tools
6666
- name: Prepare e2e tests
+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: "Publish must-gather image"
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
8+
workflow_dispatch:
9+
10+
env:
11+
PLATFORMS: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
12+
13+
jobs:
14+
publish:
15+
name: Publish must-gather container image
16+
runs-on: ubuntu-22.04
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version: '~1.22.4'
23+
24+
- name: Unshallow
25+
run: git fetch --prune --unshallow
26+
27+
- name: Build the binary for each supported architecture
28+
run: |
29+
for platform in $(echo $PLATFORMS | tr "," "\n"); do
30+
arch=${platform#*/}
31+
echo "Building must-gather for $arch"
32+
make must-gather ARCH=$arch
33+
done
34+
35+
- name: Docker meta
36+
id: docker_meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: |
40+
ghcr.io/open-telemetry/opentelemetry-operator/must-gather
41+
tags: |
42+
type=semver,pattern={{version}}
43+
type=semver,pattern={{major}}.{{minor}}
44+
type=semver,pattern={{raw}}
45+
type=ref,event=branch
46+
47+
- name: Set up QEMU
48+
uses: docker/setup-qemu-action@v3
49+
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v3
52+
53+
- name: Cache Docker layers
54+
uses: actions/cache@v4
55+
with:
56+
path: /tmp/.buildx-cache
57+
key: ${{ runner.os }}-buildx-${{ github.sha }}
58+
restore-keys: |
59+
${{ runner.os }}-buildx-
60+
61+
- name: Log into Docker.io
62+
uses: docker/login-action@v3
63+
if: ${{ github.event_name == 'push' }}
64+
with:
65+
username: ${{ secrets.DOCKER_USERNAME }}
66+
password: ${{ secrets.DOCKER_PASSWORD }}
67+
68+
- name: Login to GitHub Package Registry
69+
uses: docker/login-action@v3
70+
if: ${{ github.event_name == 'push' }}
71+
with:
72+
registry: ghcr.io
73+
username: ${{ github.repository_owner }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Build and push must-gather image
77+
uses: docker/build-push-action@v6
78+
with:
79+
context: .
80+
file: ./cmd/gather/Dockerfile
81+
platforms: ${{ env.PLATFORMS }}
82+
push: ${{ github.event_name != 'pull_request' }}
83+
tags: ${{ steps.docker_meta.outputs.tags }}
84+
labels: ${{ steps.docker_meta.outputs.labels }}
85+
cache-from: type=local,src=/tmp/.buildx-cache
86+
cache-to: type=local,dest=/tmp/.buildx-cache

Makefile

+15-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ OPERATOROPAMPBRIDGE_IMG ?= ${IMG_PREFIX}/${OPERATOROPAMPBRIDGE_IMG_REPO}:$(addpr
3838
BRIDGETESTSERVER_IMG_REPO ?= e2e-test-app-bridge-server
3939
BRIDGETESTSERVER_IMG ?= ${IMG_PREFIX}/${BRIDGETESTSERVER_IMG_REPO}:ve2e
4040

41+
MUSTGATHER_IMG ?= ${IMG_PREFIX}/must-gather
42+
4143
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
4244
ifeq (,$(shell go env GOBIN))
4345
GOBIN=$(shell go env GOPATH)/bin
@@ -143,6 +145,10 @@ ci: generate fmt vet test ensure-generate-is-noop
143145
manager: generate
144146
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH) go build -o bin/manager_${ARCH} -ldflags "${COMMON_LDFLAGS} ${OPERATOR_LDFLAGS}" main.go
145147

148+
.PHONY: must-gather
149+
must-gather:
150+
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH) go build -o bin/must-gather_${ARCH} -ldflags "${COMMON_LDFLAGS}" ./cmd/gather/main.go
151+
146152
# Build target allocator binary
147153
.PHONY: targetallocator
148154
targetallocator:
@@ -374,6 +380,15 @@ container-bridge-test-server: GOOS = linux
374380
container-bridge-test-server:
375381
docker build --load -t ${BRIDGETESTSERVER_IMG} tests/test-e2e-apps/bridge-server
376382

383+
.PHONY: container-must-gather
384+
container-must-gather: GOOS = linux
385+
container-must-gather: must-gather
386+
docker build -f cmd/gather/Dockerfile --load -t ${MUSTGATHER_IMG} .
387+
388+
.PHONY: container-must-gather-push
389+
container-must-gather-push:
390+
docker push ${MUSTGATHER_IMG}
391+
377392
.PHONY: start-kind
378393
start-kind: kind
379394
ifeq (true,$(START_KIND_CLUSTER))
@@ -400,7 +415,6 @@ else
400415
$(MAKE) container-push
401416
endif
402417

403-
404418
.PHONY: load-image-target-allocator
405419
load-image-target-allocator: container-target-allocator kind
406420
ifeq (true,$(START_KIND_CLUSTER))

README.md

+56-2
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,9 @@ spec:
717717
EOF
718718
```
719719

720-
### Setting instrumentation resource attributes via namespace annotations
720+
## Configure resource attributes
721+
722+
### Configure resource attributes with annotations
721723

722724
This example shows a pod configuration with OpenTelemetry annotations using the `resource.opentelemetry.io/` prefix. These annotations can be used to add resource attributes to data produced by OpenTelemetry instrumentation.
723725

@@ -734,7 +736,59 @@ spec:
734736
containers:
735737
- name: main-container
736738
image: your-image:tag
737-
```
739+
```
740+
741+
### Configure resource attributes with labels
742+
743+
You can also use common labels to set resource attributes.
744+
745+
The following labels are supported:
746+
- `app.kubernetes.io/name` becomes `service.name`
747+
- `app.kubernetes.io/version` becomes `service.version`
748+
- `app.kubernetes.io/part-of` becomes `service.namespace`
749+
- `app.kubernetes.io/instance` becomes `service.instance.id`
750+
751+
```yaml
752+
apiVersion: v1
753+
kind: Pod
754+
metadata:
755+
name: example-pod
756+
labels:
757+
app.kubernetes.io/name: "my-service"
758+
app.kubernetes.io/version: "1.0.0"
759+
app.kubernetes.io/part-of: "shop"
760+
app.kubernetes.io/instance: "my-service-123"
761+
spec:
762+
containers:
763+
- name: main-container
764+
image: your-image:tag
765+
```
766+
767+
This requires an explicit opt-in as follows:
768+
769+
```yaml
770+
apiVersion: opentelemetry.io/v1alpha1
771+
kind: Instrumentation
772+
metadata:
773+
name: my-instrumentation
774+
spec:
775+
defaults:
776+
useLabelsForResourceAttributes: true
777+
```
778+
779+
### Priority for setting resource attributes
780+
781+
The priority for setting resource attributes is as follows (first found wins):
782+
783+
1. Resource attributes set via `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME` environment variables
784+
2. Resource attributes set via annotations (with the `resource.opentelemetry.io/` prefix)
785+
3. Resource attributes set via labels (e.g. `app.kubernetes.io/name`)
786+
if the `Instrumentation` CR has defaults.useLabelsForResourceAttributes=true (see above)
787+
4. Resource attributes calculated from the pod's metadata (e.g. `k8s.pod.name`)
788+
5. Resource attributes set via the `Instrumentation` CR (in the `spec.resource.resourceAttributes` section)
789+
790+
This priority is applied for each resource attribute separately, so it is possible to set some attributes via
791+
annotations and others via labels.
738792

739793
## Compatibility matrix
740794

apis/v1alpha1/instrumentation_types.go

+13
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ type InstrumentationSpec struct {
4040
// +optional
4141
Sampler `json:"sampler,omitempty"`
4242

43+
// Defaults defines default values for the instrumentation.
44+
Defaults Defaults `json:"defaults,omitempty"`
45+
4346
// Env defines common env vars. There are four layers for env vars' definitions and
4447
// the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`.
4548
// If the former var had been defined, then the other vars would be ignored.
@@ -114,6 +117,16 @@ type Sampler struct {
114117
Argument string `json:"argument,omitempty"`
115118
}
116119

120+
// Defaults defines default values for the instrumentation.
121+
type Defaults struct {
122+
// UseLabelsForResourceAttributes defines whether to use common labels for resource attributes:
123+
// - `app.kubernetes.io/name` becomes `service.name`
124+
// - `app.kubernetes.io/version` becomes `service.version`
125+
// - `app.kubernetes.io/part-of` becomes `service.namespace`
126+
// - `app.kubernetes.io/instance` becomes `service.instance.id`
127+
UseLabelsForResourceAttributes bool `json:"useLabelsForResourceAttributes,omitempty"`
128+
}
129+
117130
// Java defines Java SDK and instrumentation configuration.
118131
type Java struct {
119132
// Image is a container image with javaagent auto-instrumentation JAR.

0 commit comments

Comments
 (0)