Skip to content

Commit

Permalink
Merge pull request open-telemetry#98 from IshwarKanse/rebase-bot-main
Browse files Browse the repository at this point in the history
  • Loading branch information
openshift-merge-bot[bot] authored Oct 21, 2024
2 parents 020f0b4 + 79be5a4 commit 6d079c9
Show file tree
Hide file tree
Showing 53 changed files with 601 additions and 95 deletions.
16 changes: 16 additions & 0 deletions .chloggen/3330-python-otel-logs-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
component: auto-instrumentation

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: set OTEL_LOGS_EXPORTER env var to otlp in python instrumentation

# One or more tracking issues related to the change
issues: [3330]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
6 changes: 3 additions & 3 deletions .chloggen/inst-tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ subtext: |
secretName: otel-tls-certs
configMapName: otel-ca-bundle
# otel-ca-bundle
ca: ca.crt
ca_file: ca.crt
# present in otel-tls-certs
cert: tls.crt
cert_file: tls.crt
# present in otel-tls-certs
key: tls.key
key_file: tls.key
```
* Propagating secrets across namespaces can be done with https://github.com/EmberStack/kubernetes-reflector or https://github.com/zakkg3/ClusterSecret
Expand Down
21 changes: 21 additions & 0 deletions .chloggen/native_sidecar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action)
component: collector

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add native sidecar injection behind a feature gate which is disabled by default.

# One or more tracking issues related to the change
issues: [2376]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
Native sidecars are supported since Kubernetes version `1.28` and are availabe by default since `1.29`.
To use native sidecars on Kubernetes v1.28 make sure the "SidecarContainers" feature gate on kubernetes is enabled.
If native sidecars are available, the operator can be advised to use them by adding adding
the `--feature-gates=operator.sidecarcontainers.native` to the Operator args.
In the future this may will become availabe as deployment mode on the Collector CR. See [#3356](https://github.com/open-telemetry/opentelemetry-operator/issues/3356)
5 changes: 3 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ jobs:
setup: "add-operator-arg OPERATOR_ARG='--feature-gates=operator.targetallocator.mtls' add-certmanager-permissions prepare-e2e"
- group: e2e-automatic-rbac
setup: "add-rbac-permissions-to-operator prepare-e2e"
- group: e2e-native-sidecar
setup: "add-operator-arg OPERATOR_ARG='--feature-gates=operator.sidecarcontainers.native' prepare-e2e"
kube-version: "1.29"
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
Expand All @@ -59,8 +62,6 @@ jobs:
with:
path: bin
key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }}-${{ steps.setup-go.outputs.go-version }}
- name: Install chainsaw
uses: kyverno/action-install-chainsaw@v0.2.11
- name: Install tools
run: make install-tools
- name: Prepare e2e tests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-operator-hub-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
env:
VERSION: ${{ env.version }}
run: |
mkdir operators/opentelemetry-operator/${VERSION}
mkdir operators/opentelemetry-operator/${VERSION}
cp -R ./tmp/bundle/${{ inputs.folder }}/* operators/opentelemetry-operator/${VERSION}
rm -rf ./tmp
Expand All @@ -73,7 +73,7 @@ jobs:
message="Update the opentelemetry to $VERSION"
body="Release opentelemetry-operator \`$VERSION\`.
cc @pavolloffay @frzifus @yuriolisa @jaronoff97 @TylerHelmuth @swiatekm
cc @pavolloffay @frzifus @yuriolisa @jaronoff97 @TylerHelmuth @swiatekm @iblancasa
"
branch="update-opentelemetry-operator-to-${VERSION}"
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ generate: controller-gen
e2e: chainsaw
$(CHAINSAW) test --test-dir ./tests/e2e

# e2e-native-sidecar
# NOTE: make sure the k8s featuregate "SidecarContainers" is set to true.
# NOTE: make sure the operator featuregate "operator.sidecarcontainers.native" is enabled.
.PHONY: e2e-native-sidecar
e2e-native-sidecar: chainsaw
$(CHAINSAW) test --test-dir ./tests/e2e-native-sidecar

# end-to-end-test for testing automatic RBAC creation
.PHONY: e2e-automatic-rbac
e2e-automatic-rbac: chainsaw
Expand Down Expand Up @@ -466,7 +473,7 @@ KUSTOMIZE_VERSION ?= v5.0.3
CONTROLLER_TOOLS_VERSION ?= v0.16.1
GOLANGCI_LINT_VERSION ?= v1.57.2
KIND_VERSION ?= v0.20.0
CHAINSAW_VERSION ?= v0.2.5
CHAINSAW_VERSION ?= v0.2.8

.PHONY: install-tools
install-tools: kustomize golangci-lint kind controller-gen envtest crdoc kind operator-sdk chainsaw
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ spec:
mode: statefulset
targetAllocator:
enabled: true
config:
config:
receivers:
prometheus:
config:
Expand Down Expand Up @@ -740,7 +740,7 @@ spec:

### Configure resource attributes with labels

You can also use common labels to set resource attributes.
You can also use common labels to set resource attributes.

The following labels are supported:
- `app.kubernetes.io/name` becomes `service.name`
Expand Down Expand Up @@ -782,12 +782,12 @@ The priority for setting resource attributes is as follows (first found wins):

1. Resource attributes set via `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME` environment variables
2. Resource attributes set via annotations (with the `resource.opentelemetry.io/` prefix)
3. Resource attributes set via labels (e.g. `app.kubernetes.io/name`)
3. Resource attributes set via labels (e.g. `app.kubernetes.io/name`)
if the `Instrumentation` CR has defaults.useLabelsForResourceAttributes=true (see above)
4. Resource attributes calculated from the pod's metadata (e.g. `k8s.pod.name`)
5. Resource attributes set via the `Instrumentation` CR (in the `spec.resource.resourceAttributes` section)

This priority is applied for each resource attribute separately, so it is possible to set some attributes via
This priority is applied for each resource attribute separately, so it is possible to set some attributes via
annotations and others via labels.

## Compatibility matrix
Expand All @@ -807,7 +807,7 @@ We strive to be compatible with the widest range of Kubernetes versions as possi
We use `cert-manager` for some features of this operator and the third column shows the versions of the `cert-manager` that are known to work with this operator's versions.

The Target Allocator supports prometheus-operator CRDs like ServiceMonitor, and it does so by using packages imported from prometheus-operator itself. The table shows which version is shipped with a given operator version.
Generally speaking, these are backwards compatible, but specific features require the appropriate package versions.
Generally speaking, these are backwards compatible, but specific features require the appropriate package versions.

The OpenTelemetry Operator _might_ work on versions outside of the given range, but when opening new issues, please make sure to test your scenario on a supported version.

Expand Down Expand Up @@ -849,6 +849,7 @@ Approvers ([@open-telemetry/operator-approvers](https://github.com/orgs/open-tel
- [Benedikt Bongartz](https://github.com/frzifus), Red Hat
- [Tyler Helmuth](https://github.com/TylerHelmuth), Honeycomb
- [Yuri Oliveira Sa](https://github.com/yuriolisa), Red Hat
- [Israel Blancas](https://github.com/iblancasa), Red Hat

Emeritus Approvers:

Expand Down
3 changes: 2 additions & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ The operator should be released within a week after the [OpenTelemetry collector
| v0.113.0 | @pavolloffay |
| v0.114.0 | @TylerHelmuth |
| v0.115.0 | @jaronoff97 |
| v0.116.0 | @swiatekm |
| v0.116.0 | @swiatekm |
| v0.117.0 | @iblancasa |
6 changes: 3 additions & 3 deletions apis/v1alpha1/instrumentation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ type TLS struct {
// CA defines the key of certificate (e.g. ca.crt) in the configmap map, secret or absolute path to a certificate.
// The absolute path can be used when certificate is already present on the workload filesystem e.g.
// /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
CA string `json:"ca,omitempty"`
CA string `json:"ca_file,omitempty"`
// Cert defines the key (e.g. tls.crt) of the client certificate in the secret or absolute path to a certificate.
// The absolute path can be used when certificate is already present on the workload filesystem.
Cert string `json:"cert,omitempty"`
Cert string `json:"cert_file,omitempty"`
// Key defines a key (e.g. tls.key) of the private key in the secret or absolute path to a certificate.
// The absolute path can be used when certificate is already present on the workload filesystem.
Key string `json:"key,omitempty"`
Key string `json:"key_file,omitempty"`
}

// Sampler defines sampling configuration.
Expand Down
2 changes: 1 addition & 1 deletion autoinstrumentation/java/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.8.0
2.9.0
26 changes: 13 additions & 13 deletions autoinstrumentation/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
},
"devDependencies": {
"copyfiles": "^2.4.1",
"rimraf": "^5.0.8",
"typescript": "^5.5.3"
"rimraf": "^6.0.1",
"typescript": "^5.6.3"
},
"dependencies": {
"@opentelemetry/api": "1.9.0",
"@opentelemetry/auto-instrumentations-node": "0.48.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "0.52.1",
"@opentelemetry/exporter-prometheus": "0.52.1",
"@opentelemetry/exporter-trace-otlp-grpc": "0.52.1",
"@opentelemetry/resource-detector-alibaba-cloud": "0.28.10",
"@opentelemetry/resource-detector-aws": "1.5.2",
"@opentelemetry/resource-detector-container": "0.3.11",
"@opentelemetry/resource-detector-gcp": "0.29.10",
"@opentelemetry/resources": "1.25.1",
"@opentelemetry/sdk-metrics": "1.25.1",
"@opentelemetry/sdk-node": "0.52.1"
"@opentelemetry/auto-instrumentations-node": "0.51.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "0.53.0",
"@opentelemetry/exporter-prometheus": "0.53.0",
"@opentelemetry/exporter-trace-otlp-grpc": "0.53.0",
"@opentelemetry/resource-detector-alibaba-cloud": "0.29.3",
"@opentelemetry/resource-detector-aws": "1.6.2",
"@opentelemetry/resource-detector-container": "0.4.4",
"@opentelemetry/resource-detector-gcp": "0.29.12",
"@opentelemetry/resources": "1.26.0",
"@opentelemetry/sdk-metrics": "1.26.0",
"@opentelemetry/sdk-node": "0.53.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ metadata:
categories: Logging & Tracing,Monitoring
certified: "false"
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
createdAt: "2024-10-10T15:31:51Z"
createdAt: "2024-10-16T10:10:50Z"
description: Provides the OpenTelemetry components, including the Collector
operators.operatorframework.io/builder: operator-sdk-v1.29.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,13 @@ spec:
type: string
tls:
properties:
ca:
ca_file:
type: string
cert:
cert_file:
type: string
configMapName:
type: string
key:
key_file:
type: string
secretName:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ metadata:
categories: Logging & Tracing,Monitoring
certified: "false"
containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator
createdAt: "2024-10-10T15:31:51Z"
createdAt: "2024-10-16T10:10:50Z"
description: Provides the OpenTelemetry components, including the Collector
operators.operatorframework.io/builder: operator-sdk-v1.29.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,13 @@ spec:
type: string
tls:
properties:
ca:
ca_file:
type: string
cert:
cert_file:
type: string
configMapName:
type: string
key:
key_file:
type: string
secretName:
type: string
Expand Down
6 changes: 3 additions & 3 deletions config/crd/bases/opentelemetry.io_instrumentations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,13 @@ spec:
type: string
tls:
properties:
ca:
ca_file:
type: string
cert:
cert_file:
type: string
configMapName:
type: string
key:
key_file:
type: string
secretName:
type: string
Expand Down
6 changes: 3 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@ TLS needs to be enabled by specifying https:// scheme in the Endpoint.
</tr>
</thead>
<tbody><tr>
<td><b>ca</b></td>
<td><b>ca_file</b></td>
<td>string</td>
<td>
CA defines the key of certificate (e.g. ca.crt) in the configmap map, secret or absolute path to a certificate.
Expand All @@ -1668,7 +1668,7 @@ The absolute path can be used when certificate is already present on the workloa
</td>
<td>false</td>
</tr><tr>
<td><b>cert</b></td>
<td><b>cert_file</b></td>
<td>string</td>
<td>
Cert defines the key (e.g. tls.crt) of the client certificate in the secret or absolute path to a certificate.
Expand All @@ -1684,7 +1684,7 @@ used from the secret defined in SecretName.<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>key</b></td>
<td><b>key_file</b></td>
<td>string</td>
<td>
Key defines a key (e.g. tls.key) of the private key in the secret or absolute path to a certificate.
Expand Down
7 changes: 7 additions & 0 deletions pkg/collector/upgrade/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
"github.com/open-telemetry/opentelemetry-operator/apis/v1beta1"
"github.com/open-telemetry/opentelemetry-operator/internal/config"
"github.com/open-telemetry/opentelemetry-operator/internal/rbac"
"github.com/open-telemetry/opentelemetry-operator/internal/version"
)

var (
Expand Down Expand Up @@ -160,3 +161,9 @@ func TestMain(m *testing.M) {

os.Exit(code)
}

func makeVersion(v string) version.Version {
return version.Version{
OpenTelemetryCollector: v,
}
}
20 changes: 18 additions & 2 deletions pkg/collector/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ type VersionUpgrade struct {

const RecordBufferSize int = 100

func (u VersionUpgrade) semVer() *semver.Version {
if len(u.Version.OpenTelemetryCollector) == 0 {
return &Latest.Version
}
if v, err := semver.NewVersion(u.Version.OpenTelemetryCollector); err != nil {
return &Latest.Version
} else {
return v
}
}

// ManagedInstances finds all the otelcol instances for the current operator and upgrades them, if necessary.
func (u VersionUpgrade) ManagedInstances(ctx context.Context) error {
u.Log.Info("looking for managed instances to upgrade")
Expand Down Expand Up @@ -107,9 +118,9 @@ func (u VersionUpgrade) ManagedInstance(_ context.Context, otelcol v1beta1.OpenT
}

updated := *(otelcol.DeepCopy())
if instanceV.GreaterThan(&Latest.Version) {
if instanceV.GreaterThan(u.semVer()) {
// Update with the latest known version, which is what we have from versions.txt
u.Log.V(4).Info("no upgrade routines are needed for the OpenTelemetry instance", "name", updated.Name, "namespace", updated.Namespace, "version", updated.Status.Version, "latest", Latest.Version.String())
u.Log.V(4).Info("no upgrade routines are needed for the OpenTelemetry instance", "name", updated.Name, "namespace", updated.Namespace, "version", updated.Status.Version, "latest", u.semVer().String())

otelColV, err := semver.NewVersion(u.Version.OpenTelemetryCollector)
if err != nil {
Expand All @@ -126,6 +137,11 @@ func (u VersionUpgrade) ManagedInstance(_ context.Context, otelcol v1beta1.OpenT
}

for _, available := range versions {
// Don't run upgrades for versions after the webhook's set version.
// This is important only for testing.
if available.GreaterThan(u.semVer()) {
continue
}
if available.GreaterThan(instanceV) {
if available.upgrade != nil {
otelcolV1alpha1 := &v1alpha1.OpenTelemetryCollector{}
Expand Down
Loading

0 comments on commit 6d079c9

Please sign in to comment.