Skip to content

Commit 26835d0

Browse files
committed
Changed field
Signed-off-by: Yuri Sa <[email protected]>
2 parents 691e438 + 08b33a5 commit 26835d0

File tree

82 files changed

+2086
-848
lines changed

Some content is hidden

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

82 files changed

+2086
-848
lines changed

.chloggen/TEMPLATE.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
22
change_type:
33

4-
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
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)
55
component:
66

77
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).

.chloggen/add-poddns.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
change_type: 'enhancement'
33

44
# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action)
5-
component: operator
5+
component: collector
66

77
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
88
note: Added Pod DNSConfig

.chloggen/annotations-filter.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. operator, target allocator, github action)
5+
component: operator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: Created ability to filter out Annotations
9+
10+
# One or more tracking issues related to the change
11+
issues: [2627]
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,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. operator, target allocator, github action)
5+
component: target allocator
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: "Fix per-node target allocation for targets from endpointslices"
9+
10+
# One or more tracking issues related to the change
11+
issues: [2718]
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: "The per-node target allocation strategy was not matching endpointslice entries for with a `kind` of Node, such as those for the kubelet metrics created by the prometheus operator"

.github/ISSUE_TEMPLATE/bug_report.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ body:
1616
multiple: true
1717
options:
1818
- collector
19-
- instrumentation
19+
- auto-instrumentation
2020
- target allocator
21-
- opamp bridge
21+
- opamp
2222
- type: textarea
2323
attributes:
2424
label: What happened?

.github/ISSUE_TEMPLATE/feature_request.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ body:
1010
multiple: true
1111
options:
1212
- collector
13-
- instrumentation
13+
- auto-instrumentation
1414
- target allocator
15-
- opamp bridge
15+
- opamp
1616
- type: textarea
1717
attributes:
1818
label: Is your feature request related to a problem? Please describe.

.github/ISSUE_TEMPLATE/other.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ body:
1010
multiple: true
1111
options:
1212
- collector
13-
- instrumentation
13+
- auto-instrumentation
1414
- target allocator
15-
- opamp bridge
15+
- opamp
1616
- type: textarea
1717
attributes:
1818
label: Describe the issue you're reporting

.github/workflows/e2e.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ jobs:
3232
- e2e-targetallocator
3333
- e2e-upgrade
3434
- e2e-multi-instrumentation
35+
- e2e-metadata-filters
3536
include:
3637
- group: e2e-prometheuscr
3738
setup: "prepare-e2e-with-featuregates FEATUREGATES=+operator.observability.prometheus"
3839
- group: e2e-multi-instrumentation
3940
setup: "add-operator-arg OPERATOR_ARG=--enable-multi-instrumentation prepare-e2e"
41+
- group: e2e-metadata-filters
42+
setup: "add-operator-arg OPERATOR_ARG='--annotations-filter=*filter.out --labels=*filter.out' prepare-e2e"
4043

4144
steps:
4245
- name: Check out code into the Go module directory

CHANGELOG.md

+106-105
Large diffs are not rendered by default.

Makefile

+10-5
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ e2e-prometheuscr: chainsaw
240240
e2e-targetallocator: chainsaw
241241
$(CHAINSAW) test --test-dir ./tests/e2e-targetallocator
242242

243+
# end-to-end-test for Annotations/Labels Filters
244+
.PHONY: e2e-metadata-filters
245+
e2e-metadata-filters: chainsaw
246+
$(CHAINSAW) test --test-dir ./tests/e2e-metadata-filters
247+
243248
# end-to-end-test for testing upgrading
244249
.PHONY: e2e-upgrade
245250
e2e-upgrade: undeploy chainsaw
@@ -497,11 +502,11 @@ chlog-insert-components:
497502
@echo "" >>components.md
498503
@echo "* [OpenTelemetry Collector - v${OTELCOL_VERSION}](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v${OTELCOL_VERSION})" >>components.md
499504
@echo "* [OpenTelemetry Contrib - v${OTELCOL_VERSION}](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v${OTELCOL_VERSION})" >>components.md
500-
@echo "* [Java auto-instrumentation - ${AUTO_INSTRUMENTATION_JAVA_VERSION}](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v${AUTO_INSTRUMENTATION_JAVA_VERSION})" >>components.md
501-
@echo "* [.NET auto-instrumentation - ${AUTO_INSTRUMENTATION_DOTNET_VERSION}](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/${AUTO_INSTRUMENTATION_DOTNET_VERSION})" >>components.md
502-
@echo "* [Node.JS - ${AUTO_INSTRUMENTATION_NODEJS_VERSION}](https://github.com/open-telemetry/opentelemetry-js-contrib/releases/tag/auto-instrumentations-node-${AUTO_INSTRUMENTATION_NODEJS_VERSION})" >>components.md
503-
@echo "* [Python - ${AUTO_INSTRUMENTATION_PYTHON_VERSION}](https://github.com/open-telemetry/opentelemetry-python-contrib/releases/tag/${AUTO_INSTRUMENTATION_PYTHON_VERSION})" >>components.md
504-
@echo "* [Go - v${AUTO_INSTRUMENTATION_GO_VERSION}](https://github.com/open-telemetry/opentelemetry-go-instrumentation/releases/tag/v${AUTO_INSTRUMENTATION_GO_VERSION})" >>components.md
505+
@echo "* [Java auto-instrumentation - v${AUTO_INSTRUMENTATION_JAVA_VERSION}](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v${AUTO_INSTRUMENTATION_JAVA_VERSION})" >>components.md
506+
@echo "* [.NET auto-instrumentation - v${AUTO_INSTRUMENTATION_DOTNET_VERSION}](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/$v{AUTO_INSTRUMENTATION_DOTNET_VERSION})" >>components.md
507+
@echo "* [Node.JS - v${AUTO_INSTRUMENTATION_NODEJS_VERSION}](https://github.com/open-telemetry/opentelemetry-js/releases/tag/experimental%2Fv${AUTO_INSTRUMENTATION_NODEJS_VERSION})" >>components.md
508+
@echo "* [Python - v${AUTO_INSTRUMENTATION_PYTHON_VERSION}](https://github.com/open-telemetry/opentelemetry-python-contrib/releases/tag/v${AUTO_INSTRUMENTATION_PYTHON_VERSION})" >>components.md
509+
@echo "* [Go - ${AUTO_INSTRUMENTATION_GO_VERSION}](https://github.com/open-telemetry/opentelemetry-go-instrumentation/releases/tag/${AUTO_INSTRUMENTATION_GO_VERSION})" >>components.md
505510
@echo "* [ApacheHTTPD - ${AUTO_INSTRUMENTATION_APACHE_HTTPD_VERSION}](https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/tag/webserver%2Fv${AUTO_INSTRUMENTATION_APACHE_HTTPD_VERSION})" >>components.md
506511
@echo "* [Nginx - ${AUTO_INSTRUMENTATION_NGINX_VERSION}](https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/tag/webserver%2Fv${AUTO_INSTRUMENTATION_NGINX_VERSION})" >>components.md
507512
@sed -i '/<!-- next version -->/rcomponents.md' CHANGELOG.md

apis/v1alpha1/convert.go

+46-3
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,53 @@ package v1alpha1
1616

1717
import (
1818
"errors"
19+
"fmt"
1920

2021
"gopkg.in/yaml.v3"
2122
appsv1 "k8s.io/api/apps/v1"
2223
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24+
"sigs.k8s.io/controller-runtime/pkg/conversion"
2325

2426
"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
2527
)
2628

27-
func Tov1beta1(in OpenTelemetryCollector) (v1beta1.OpenTelemetryCollector, error) {
29+
var _ conversion.Convertible = &OpenTelemetryCollector{}
30+
31+
func (src *OpenTelemetryCollector) ConvertTo(dstRaw conversion.Hub) error {
32+
switch t := dstRaw.(type) {
33+
case *v1beta1.OpenTelemetryCollector:
34+
dst := dstRaw.(*v1beta1.OpenTelemetryCollector)
35+
convertedSrc, err := tov1beta1(*src)
36+
if err != nil {
37+
return fmt.Errorf("failed to convert to v1beta1: %w", err)
38+
}
39+
dst.ObjectMeta = convertedSrc.ObjectMeta
40+
dst.Spec = convertedSrc.Spec
41+
dst.Status = convertedSrc.Status
42+
default:
43+
return fmt.Errorf("unsupported type %v", t)
44+
}
45+
return nil
46+
}
47+
48+
func (dst *OpenTelemetryCollector) ConvertFrom(srcRaw conversion.Hub) error {
49+
switch t := srcRaw.(type) {
50+
case *v1beta1.OpenTelemetryCollector:
51+
src := srcRaw.(*v1beta1.OpenTelemetryCollector)
52+
srcConverted, err := tov1alpha1(*src)
53+
if err != nil {
54+
return fmt.Errorf("failed to convert to v1alpha1: %w", err)
55+
}
56+
dst.ObjectMeta = srcConverted.ObjectMeta
57+
dst.Spec = srcConverted.Spec
58+
dst.Status = srcConverted.Status
59+
default:
60+
return fmt.Errorf("unsupported type %v", t)
61+
}
62+
return nil
63+
}
64+
65+
func tov1beta1(in OpenTelemetryCollector) (v1beta1.OpenTelemetryCollector, error) {
2866
copy := in.DeepCopy()
2967
cfg := &v1beta1.Config{}
3068
if err := yaml.Unmarshal([]byte(copy.Spec.Config), cfg); err != nil {
@@ -121,6 +159,7 @@ func tov1beta1TA(in OpenTelemetryTargetAllocator) v1beta1.TargetAllocatorEmbedde
121159
PrometheusCR: v1beta1.TargetAllocatorPrometheusCR{
122160
Enabled: in.PrometheusCR.Enabled,
123161
ScrapeInterval: in.PrometheusCR.ScrapeInterval,
162+
// prometheus_cr.pod_monitor_selector shouldn't be nil when selector is empty
124163
PodMonitorSelector: &metav1.LabelSelector{
125164
MatchLabels: in.PrometheusCR.PodMonitorSelector,
126165
},
@@ -143,10 +182,14 @@ func tov1beta1TA(in OpenTelemetryTargetAllocator) v1beta1.TargetAllocatorEmbedde
143182
}
144183
}
145184

185+
// The conversion takes into account deprecated v1alpha1 spec.minReplicas and spec.maxReplicas.
146186
func tov1beta1Autoscaler(in *AutoscalerSpec, minReplicas, maxReplicas *int32) *v1beta1.AutoscalerSpec {
147-
if in == nil {
187+
if in == nil && minReplicas == nil && maxReplicas == nil {
148188
return nil
149189
}
190+
if in == nil {
191+
in = &AutoscalerSpec{}
192+
}
150193

151194
var metrics []v1beta1.MetricSpec
152195
for _, m := range in.Metrics {
@@ -237,7 +280,7 @@ func tov1alpha1(in v1beta1.OpenTelemetryCollector) (*OpenTelemetryCollector, err
237280
SecurityContext: copy.Spec.SecurityContext,
238281
PodSecurityContext: copy.Spec.PodSecurityContext,
239282
PodAnnotations: copy.Spec.PodAnnotations,
240-
TargetAllocator: tov1alpha1TA(in.Spec.TargetAllocator),
283+
TargetAllocator: tov1alpha1TA(copy.Spec.TargetAllocator),
241284
Mode: Mode(copy.Spec.Mode),
242285
ServiceAccount: copy.Spec.ServiceAccount,
243286
Image: copy.Spec.Image,

0 commit comments

Comments
 (0)