diff --git a/.chainsaw.yaml b/.chainsaw.yaml new file mode 100644 index 0000000000..20a9dbf07a --- /dev/null +++ b/.chainsaw.yaml @@ -0,0 +1,12 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Configuration +metadata: + name: configuration +spec: + parallel: 4 + timeouts: + assert: 5m0s + cleanup: 5m0s + delete: 5m0s + error: 5m0s diff --git a/.chloggen/fix-protocol-handling-in-serviceports.yaml b/.chloggen/fix-protocol-handling-in-serviceports.yaml deleted file mode 100644 index 29985f54a9..0000000000 --- a/.chloggen/fix-protocol-handling-in-serviceports.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) -component: operator - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Fixed handling of protocol in exposed ports." - -# One or more tracking issues related to the change -issues: [2619] - -# (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: | - Make distinction not only on the port number, but also on protocol. This fix allows to have multiple exposed - ServicePorts with the same port number, but different protocols. diff --git a/.chloggen/fix-syslog-tcplog-udplog.yaml b/.chloggen/fix-syslog-tcplog-udplog.yaml deleted file mode 100644 index cedf0cb242..0000000000 --- a/.chloggen/fix-syslog-tcplog-udplog.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix - -# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) -component: operator - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Fixed handling of exposed port protocol in syslog, tcplog and udplog receivers." - -# One or more tracking issues related to the change -issues: [767,2619] - -# (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: | - Please note that the operator currently exposes just one port (tcp or udp) of syslog receiver due to the current - receiver implementation (patches are welcome). diff --git a/.chloggen/fix_2589-watch-single-namespace.yaml b/.chloggen/multi-instrumentation-command-flag.yaml old mode 100644 new mode 100755 similarity index 80% rename from .chloggen/fix_2589-watch-single-namespace.yaml rename to .chloggen/multi-instrumentation-command-flag.yaml index 50498d493f..b4af3a899f --- a/.chloggen/fix_2589-watch-single-namespace.yaml +++ b/.chloggen/multi-instrumentation-command-flag.yaml @@ -1,16 +1,16 @@ # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: bug_fix +change_type: breaking # The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) component: operator # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: "Fixing WATCH_NAMESPACE for a single namespace value" +note: change multi instrumentation feature gate into command line flag --enable-multi-instrumentation # One or more tracking issues related to the change -issues: [2589] +issues: [2582] # (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: +subtext: diff --git a/.chloggen/per-node-allocation-strategy.yaml b/.chloggen/per-node-allocation-strategy.yaml deleted file mode 100755 index e4a6637bfe..0000000000 --- a/.chloggen/per-node-allocation-strategy.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# 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. operator, target allocator, github action) -component: target allocator - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add new "per node" allocation strategy to target allocator. This strategy will allocate targets to nodes on which given target resides. It should only be used conjunction with the daemonset mode. - -# One or more tracking issues related to the change -issues: [1828] - -# (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: diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 50eae65547..325398d28f 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -15,7 +15,6 @@ body: description: Which component(s) does your bug report concern? multiple: true options: - - operator - collector - instrumentation - target allocator diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 30de7c742a..c113ab14d4 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -9,7 +9,6 @@ body: description: Which component(s) does your feature request concern? multiple: true options: - - operator - collector - instrumentation - target allocator diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index d7be8e0b0f..40340c6de5 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -9,7 +9,6 @@ body: description: Which component(s) does your issue concern? multiple: true options: - - operator - collector - instrumentation - target allocator diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 23b91eeeed..bdef89424d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,7 +2,9 @@ -**Link to tracking Issue:** +**Link to tracking Issue(s):** + +- Resolves: #issue-number **Testing:** diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 3fc54126e3..18b2614cec 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -12,7 +12,6 @@ concurrency: jobs: e2e-tests: - name: End-to-end tests ${{ matrix.group }} on K8s ${{ matrix.kube-version }} runs-on: ubuntu-22.04 strategy: fail-fast: false @@ -25,50 +24,55 @@ jobs: - "1.29" group: - e2e - - e2e-instrumentation - - e2e-upgrade - e2e-autoscale - - e2e-pdb + - e2e-instrumentation - e2e-opampbridge - - e2e-targetallocator + - e2e-pdb - e2e-prometheuscr + - e2e-targetallocator + - e2e-upgrade - e2e-multi-instrumentation include: - group: e2e-prometheuscr setup: "prepare-e2e-with-featuregates FEATUREGATES=+operator.observability.prometheus" - group: e2e-multi-instrumentation - setup: "prepare-e2e-with-featuregates FEATUREGATES=+operator.autoinstrumentation.multi-instrumentation" + setup: "add-operator-arg OPERATOR_ARG=--enable-multi-instrumentation prepare-e2e" steps: - name: Check out code into the Go module directory uses: actions/checkout@v4 - - name: Set up Go uses: actions/setup-go@v5 with: go-version: "~1.21.3" - - name: Cache tools uses: actions/cache@v4 with: path: bin key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Makefile') }} - + - name: Install chainsaw + uses: kyverno/action-install-chainsaw@v0.1.4 - name: Install tools run: make install-tools - - - name: "run tests" + - name: Prepare e2e tests env: KUBE_VERSION: ${{ matrix.kube-version }} run: | + set -e make ${{ matrix.setup != '' && matrix.setup || 'prepare-e2e' }} KUBE_VERSION=$KUBE_VERSION VERSION=e2e + - name: Run e2e tests + env: + KUBE_VERSION: ${{ matrix.kube-version }} + run: | + set -e make ${{ matrix.group }} - - name: "log operator if failed" if: ${{ failure() }} env: KUBE_VERSION: ${{ matrix.kube-version }} - run: make e2e-log-operator KUBE_VERSION=$KUBE_VERSION + run: | + set -e + make e2e-log-operator KUBE_VERSION=$KUBE_VERSION e2e-tests-check: runs-on: ubuntu-22.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index 24a213e465..af6cdb7d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,37 @@ Changes by Version ================== +## 0.94.0 + +### 💡 Enhancements 💡 + +- `target allocator`: Add new "per node" allocation strategy to target allocator. This strategy will allocate targets to nodes on which given target resides. It should only be used conjunction with the daemonset mode. (#1828) + +### 🧰 Bug fixes 🧰 + +- `operator`: Fixed handling of protocol in exposed ports. (#2619) + Make distinction not only on the port number, but also on protocol. This fix allows to have multiple exposed + ServicePorts with the same port number, but different protocols. + +- `operator`: Fixed handling of exposed port protocol in syslog, tcplog and udplog receivers. (#767, #2619) + Please note that the operator currently exposes just one port (tcp or udp) of syslog receiver due to the current + receiver implementation (patches are welcome). + +- `operator`: Fixing WATCH_NAMESPACE for a single namespace value (#2589) + +### Components + +* [OpenTelemetry Collector - v0.94.0](https://github.com/open-telemetry/opentelemetry-collector/releases/tag/v0.94.0) +* [OpenTelemetry Contrib - v0.94.0](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.94.0) +* [Java auto-instrumentation - 1.32.1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v1.32.1) +* [.NET auto-instrumentation - 1.2.0](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/1.2.0) +* [Node.JS - 0.46.0](https://github.com/open-telemetry/opentelemetry-js-contrib/releases/tag/auto-instrumentations-node-0.46.0) +* [Python - 0.43b0](https://github.com/open-telemetry/opentelemetry-python-contrib/releases/tag/0.43b0) +* [Go - v0.10.1-alpha](https://github.com/open-telemetry/opentelemetry-go-instrumentation/releases/tag/v0.10.1-alpha) +* [ApacheHTTPD - 1.0.4](https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/tag/webserver%2Fv1.0.4) +* [Nginx - 1.0.4](https://github.com/open-telemetry/opentelemetry-cpp-contrib/releases/tag/webserver%2Fv1.0.4) + + ## 0.93.0 ### 🛑 Breaking changes 🛑 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 495c20fa6e..b7acec07bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -118,13 +118,13 @@ KUBEBUILDER_ASSETS=$(./bin/setup-envtest use -p path 1.23) go test ./pkg... ### End to end tests -To run the end-to-end tests, you'll need [`kind`](https://kind.sigs.k8s.io) and [`kuttl`](https://kuttl.dev). Refer to their documentation for installation instructions. +To run the end-to-end tests, you'll need [`kind`](https://kind.sigs.k8s.io) and [`chainsaw`](https://kyverno.github.io/chainsaw). Refer to their documentation for installation instructions. -Once they are installed, the tests can be executed with `make prepare-e2e`, which will build an image to use with the tests, followed by `make e2e`. Each call to the `e2e` target will setup a fresh `kind` cluster, making it safe to be executed multiple times with a single `prepare-e2e` step. +Once they are installed, the tests can be executed with `make prepare-e2e`, which will build an image to use with the tests, followed by `make e2e`. Each call to the `e2e` target will set up a fresh `kind` cluster, making it safe to be executed multiple times with a single `prepare-e2e` step. -The tests are located under `tests/e2e` and are written to be used with `kuttl`. Refer to their documentation to understand how tests are written. +The tests are located under `tests/e2e` and are written to be used with `chainsaw`. Refer to their documentation to understand how tests are written. -To evert the changes made by the `make prepare-e2e` run `make reset`. +To revert the changes made by the `make prepare-e2e` run `make reset`. ### OpenShift End to End tests To run the end-to-end tests written for OpenShift, you'll need a OpenShift cluster. @@ -133,7 +133,7 @@ To install the OpenTelemetry operator, please follow the instructions in [Opera Once the operator is installed, the tests can be executed using `make e2e-openshift`, which will call to the `e2e-openshift` target. Note that `kind` is disabled for the TestSuite as the requirement is to use an OpenShift cluster for these test cases. -The tests are located under `tests/e2e-openshift` and are written to be used with `kuttl`. +The tests are located under `tests/e2e-openshift` and are written to be used with `chainsaw`. ### Undeploying the operator from the local cluster diff --git a/Makefile b/Makefile index ce3a9787b3..ff2016a972 100644 --- a/Makefile +++ b/Makefile @@ -197,39 +197,18 @@ generate: controller-gen # end-to-tests .PHONY: e2e -e2e: - $(KUTTL) test - - -# instrumentation end-to-tests -.PHONY: e2e-instrumentation -e2e-instrumentation: - $(KUTTL) test --config kuttl-test-instrumentation.yaml - -# end-to-end-test for PrometheusCR E2E tests -.PHONY: e2e-prometheuscr -e2e-prometheuscr: - $(KUTTL) test --config kuttl-test-prometheuscr.yaml - -# end-to-end-test for testing upgrading -.PHONY: e2e-upgrade -e2e-upgrade: undeploy - $(KUTTL) test --config kuttl-test-upgrade.yaml +e2e: chainsaw + $(CHAINSAW) test --test-dir ./tests/e2e # end-to-end-test for testing autoscale .PHONY: e2e-autoscale -e2e-autoscale: - $(KUTTL) test --config kuttl-test-autoscale.yaml +e2e-autoscale: chainsaw + $(CHAINSAW) test --test-dir ./tests/e2e-autoscale -# end-to-end-test for testing pdb support -.PHONY: e2e-pdb -e2e-pdb: - $(KUTTL) test --config kuttl-test-pdb.yaml - -# end-to-end-test for testing OpenShift cases -.PHONY: e2e-openshift -e2e-openshift: - $(KUTTL) test --config kuttl-test-openshift.yaml +# instrumentation end-to-tests +.PHONY: e2e-instrumentation +e2e-instrumentation: chainsaw + $(CHAINSAW) test --test-dir ./tests/e2e-instrumentation .PHONY: e2e-log-operator e2e-log-operator: @@ -238,24 +217,41 @@ e2e-log-operator: # end-to-tests for multi-instrumentation .PHONY: e2e-multi-instrumentation -e2e-multi-instrumentation: - $(KUTTL) test --config kuttl-test-multi-instr.yaml +e2e-multi-instrumentation: chainsaw + $(CHAINSAW) test --test-dir ./tests/e2e-multi-instrumentation # OpAMPBridge CR end-to-tests .PHONY: e2e-opampbridge -e2e-opampbridge: - $(KUTTL) test --config kuttl-test-opampbridge.yaml +e2e-opampbridge: chainsaw + $(CHAINSAW) test --test-dir ./tests/e2e-opampbridge + +# end-to-end-test for testing pdb support +.PHONY: e2e-pdb +e2e-pdb: chainsaw + $(CHAINSAW) test --test-dir ./tests/e2e-pdb + +# end-to-end-test for PrometheusCR E2E tests +.PHONY: e2e-prometheuscr +e2e-prometheuscr: chainsaw + $(CHAINSAW) test --test-dir ./tests/e2e-prometheuscr # Target allocator end-to-tests .PHONY: e2e-targetallocator -e2e-targetallocator: - $(KUTTL) test --config kuttl-test-targetallocator.yaml +e2e-targetallocator: chainsaw + $(CHAINSAW) test --test-dir ./tests/e2e-targetallocator + +# end-to-end-test for testing upgrading +.PHONY: e2e-upgrade +e2e-upgrade: undeploy chainsaw + kubectl apply -f ./tests/e2e-upgrade/upgrade-test/opentelemetry-operator-v0.86.0.yaml + go run hack/check-operator-ready.go + $(CHAINSAW) test --test-dir ./tests/e2e-upgrade .PHONY: prepare-e2e -prepare-e2e: kuttl set-image-controller add-image-targetallocator add-image-opampbridge container container-target-allocator container-operator-opamp-bridge start-kind cert-manager install-metrics-server install-targetallocator-prometheus-crds load-image-all deploy +prepare-e2e: chainsaw set-image-controller add-image-targetallocator add-image-opampbridge container container-target-allocator container-operator-opamp-bridge start-kind cert-manager install-metrics-server install-targetallocator-prometheus-crds load-image-all deploy .PHONY: prepare-e2e-with-featuregates -prepare-e2e-with-featuregates: kuttl enable-operator-featuregates prepare-e2e +prepare-e2e-with-featuregates: chainsaw enable-operator-featuregates prepare-e2e .PHONY: scorecard-tests scorecard-tests: operator-sdk @@ -361,20 +357,20 @@ cmctl: KUSTOMIZE ?= $(LOCALBIN)/kustomize KIND ?= $(LOCALBIN)/kind -KUTTL ?= $(LOCALBIN)/kubectl-kuttl CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ENVTEST ?= $(LOCALBIN)/setup-envtest CHLOGGEN ?= $(LOCALBIN)/chloggen GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint +CHAINSAW ?= $(LOCALBIN)/chainsaw KUSTOMIZE_VERSION ?= v5.0.3 CONTROLLER_TOOLS_VERSION ?= v0.12.0 GOLANGCI_LINT_VERSION ?= v1.54.0 KIND_VERSION ?= v0.20.0 -KUTTL_VERSION ?= 0.15.0 +CHAINSAW_VERSION ?= v0.1.4 .PHONY: install-tools -install-tools: kustomize golangci-lint kind controller-gen envtest crdoc kuttl kind operator-sdk +install-tools: kustomize golangci-lint kind controller-gen envtest crdoc kind operator-sdk chainsaw .PHONY: kustomize kustomize: ## Download kustomize locally if necessary. @@ -403,6 +399,10 @@ CRDOC = $(shell pwd)/bin/crdoc crdoc: ## Download crdoc locally if necessary. $(call go-get-tool,$(CRDOC), fybrik.io/crdoc,v0.5.2) +.PHONY: chainsaw +chainsaw: ## Find or download chainsaw + $(call go-get-tool,$(CHAINSAW), github.com/kyverno/chainsaw,$(CHAINSAW_VERSION)) + # go-get-tool will 'go get' any package $2 and install it to $1. PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) define go-get-tool @@ -418,10 +418,6 @@ rm -rf $$TMP_DIR ;\ } endef -.PHONY: kuttl -kuttl: $(LOCALBIN) - @KUTTL=$(KUTTL) KUTTL_VERSION=$(KUTTL_VERSION) ./hack/install-kuttl.sh - OPERATOR_SDK = $(shell pwd)/bin/operator-sdk .PHONY: operator-sdk operator-sdk: $(LOCALBIN) @@ -451,6 +447,7 @@ reset: kustomize operator-sdk manifests $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle -q --overwrite --version ${OPERATOR_VERSION} $(BUNDLE_METADATA_OPTS) $(OPERATOR_SDK) bundle validate ./bundle ./hack/ignore-createdAt-bundle.sh + ./hack/add-openshift-annotations.sh git checkout config/manager/kustomization.yaml # Build the bundle image, used only for local dev purposes diff --git a/README.md b/README.md index 5a1d234f8c..430017d87e 100644 --- a/README.md +++ b/README.md @@ -710,6 +710,7 @@ The OpenTelemetry Operator *might* work on versions outside of the given range, | OpenTelemetry Operator | Kubernetes | Cert-Manager | |------------------------|----------------------|---------------------| +| v0.94.0 | v1.23 to v1.29 | v1 | | v0.93.0 | v1.23 to v1.29 | v1 | | v0.92.0 | v1.23 to v1.29 | v1 | | v0.91.0 | v1.23 to v1.29 | v1 | @@ -732,7 +733,6 @@ The OpenTelemetry Operator *might* work on versions outside of the given range, | v0.74.0 | v1.19 to v1.26 | v1 | | v0.73.0 | v1.19 to v1.26 | v1 | | v0.72.0 | v1.19 to v1.26 | v1 | -| v0.71.0 | v1.19 to v1.25 | v1 | ## Contributing and Developing diff --git a/RELEASE.md b/RELEASE.md index 1da9d1d9af..9badd2e4c5 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -40,10 +40,10 @@ The operator should be released within a week after the [OpenTelemetry collector | Version | Release manager | |----------|-----------------| -| v0.94.0 | @TylerHelmuth | | v0.95.0 | @swiatekm-sumo | | v0.96.0 | @frzifus | | v0.97.0 | @jaronoff97 | | v0.98.0 | @yuriolisa | | v0.99.0 | @pavolloffay | | v0.100.0 | @VineethReddy02 | +| v0.101.0 | @TylerHelmuth | diff --git a/apis/v1alpha2/instrumentation_types.go b/apis/v1alpha2/instrumentation_types.go deleted file mode 100644 index e07d350a81..0000000000 --- a/apis/v1alpha2/instrumentation_types.go +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright The OpenTelemetry Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// +kubebuilder:skip - -package v1alpha2 - -import ( - corev1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" -) - -// InstrumentationSpec defines the desired state of OpenTelemetry SDK and instrumentation. -type InstrumentationSpec struct { - // Exporter defines exporter configuration. - // +optional - Exporter `json:"exporter,omitempty"` - - // Resource defines the configuration for the resource attributes, as defined by the OpenTelemetry specification. - // +optional - Resource Resource `json:"resource,omitempty"` - - // Propagators defines inter-process context propagation configuration. - // Values in this list will be set in the OTEL_PROPAGATORS env var. - // Enum=tracecontext;baggage;b3;b3multi;jaeger;xray;ottrace;none - // +optional - Propagators []v1alpha1.Propagator `json:"propagators,omitempty"` - - // Sampler defines sampling configuration. - // +optional - Sampler `json:"sampler,omitempty"` - - // Env defines common env vars. There are four layers for env vars' definitions and - // the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. - // If the former var had been defined, then the other vars would be ignored. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - - // Java defines configuration for java auto-instrumentation. - // +optional - Java Java `json:"java,omitempty"` - - // NodeJS defines configuration for nodejs auto-instrumentation. - // +optional - NodeJS NodeJS `json:"nodejs,omitempty"` - - // Python defines configuration for python auto-instrumentation. - // +optional - Python Python `json:"python,omitempty"` - - // DotNet defines configuration for DotNet auto-instrumentation. - // +optional - DotNet DotNet `json:"dotnet,omitempty"` - - // Go defines configuration for Go auto-instrumentation. - // When using Go auto-instrumentation you must provide a value for the OTEL_GO_AUTO_TARGET_EXE env var via the - // Instrumentation env vars or via the instrumentation.opentelemetry.io/otel-go-auto-target-exe pod annotation. - // Failure to set this value causes instrumentation injection to abort, leaving the original pod unchanged. - // +optional - Go Go `json:"go,omitempty"` - - // ApacheHttpd defines configuration for Apache HTTPD auto-instrumentation. - // +optional - ApacheHttpd ApacheHttpd `json:"apacheHttpd,omitempty"` - - // Nginx defines configuration for Nginx auto-instrumentation. - // +optional - Nginx Nginx `json:"nginx,omitempty"` -} - -// Resource defines the configuration for the resource attributes, as defined by the OpenTelemetry specification. -// See also: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/overview.md#resources -type Resource struct { - // Attributes defines attributes that are added to the resource. - // For example environment: dev - // +optional - Attributes map[string]string `json:"resourceAttributes,omitempty"` - - // AddK8sUIDAttributes defines whether K8s UID attributes should be collected (e.g. k8s.deployment.uid). - // +optional - AddK8sUIDAttributes bool `json:"addK8sUIDAttributes,omitempty"` -} - -// Exporter defines OTLP exporter configuration. -type Exporter struct { - // Endpoint is address of the collector with OTLP endpoint. - // +optional - Endpoint string `json:"endpoint,omitempty"` -} - -// Sampler defines sampling configuration. -type Sampler struct { - // Type defines sampler type. - // The value will be set in the OTEL_TRACES_SAMPLER env var. - // The value can be for instance parentbased_always_on, parentbased_always_off, parentbased_traceidratio... - // +optional - Type v1alpha1.SamplerType `json:"type,omitempty"` - - // Argument defines sampler argument. - // The value depends on the sampler type. - // For instance for parentbased_traceidratio sampler type it is a number in range [0..1] e.g. 0.25. - // The value will be set in the OTEL_TRACES_SAMPLER_ARG env var. - // +optional - Argument string `json:"argument,omitempty"` -} - -// Java defines Java SDK and instrumentation configuration. -type Java struct { - // Image is a container image with javaagent auto-instrumentation JAR. - // +optional - Image string `json:"image,omitempty"` - - // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. - // The default size is 200Mi. - VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` - - // Env defines java specific env vars. There are four layers for env vars' definitions and - // the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. - // If the former var had been defined, then the other vars would be ignored. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - - // Resources describes the compute resource requirements. - // +optional - Resources corev1.ResourceRequirements `json:"resources,omitempty"` -} - -// NodeJS defines NodeJS SDK and instrumentation configuration. -type NodeJS struct { - // Image is a container image with NodeJS SDK and auto-instrumentation. - // +optional - Image string `json:"image,omitempty"` - - // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. - // The default size is 200Mi. - VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` - - // Env defines nodejs specific env vars. There are four layers for env vars' definitions and - // the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. - // If the former var had been defined, then the other vars would be ignored. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - - // Resources describes the compute resource requirements. - // +optional - Resources corev1.ResourceRequirements `json:"resourceRequirements,omitempty"` -} - -// Python defines Python SDK and instrumentation configuration. -type Python struct { - // Image is a container image with Python SDK and auto-instrumentation. - // +optional - Image string `json:"image,omitempty"` - - // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. - // The default size is 200Mi. - VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` - - // Env defines python specific env vars. There are four layers for env vars' definitions and - // the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. - // If the former var had been defined, then the other vars would be ignored. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - - // Resources describes the compute resource requirements. - // +optional - Resources corev1.ResourceRequirements `json:"resourceRequirements,omitempty"` -} - -// DotNet defines DotNet SDK and instrumentation configuration. -type DotNet struct { - // Image is a container image with DotNet SDK and auto-instrumentation. - // +optional - Image string `json:"image,omitempty"` - - // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. - // The default size is 200Mi. - VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` - - // Env defines DotNet specific env vars. There are four layers for env vars' definitions and - // the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. - // If the former var had been defined, then the other vars would be ignored. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - // Resources describes the compute resource requirements. - // +optional - Resources corev1.ResourceRequirements `json:"resourceRequirements,omitempty"` -} - -type Go struct { - // Image is a container image with Go SDK and auto-instrumentation. - // +optional - Image string `json:"image,omitempty"` - - // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. - // The default size is 200Mi. - VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` - - // Env defines Go specific env vars. There are four layers for env vars' definitions and - // the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. - // If the former var had been defined, then the other vars would be ignored. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - - // Resources describes the compute resource requirements. - // +optional - Resources corev1.ResourceRequirements `json:"resourceRequirements,omitempty"` -} - -// ApacheHttpd defines Apache SDK and instrumentation configuration. -type ApacheHttpd struct { - // Image is a container image with Apache SDK and auto-instrumentation. - // +optional - Image string `json:"image,omitempty"` - - // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. - // The default size is 200Mi. - VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` - - // Env defines Apache HTTPD specific env vars. There are four layers for env vars' definitions and - // the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. - // If the former var had been defined, then the other vars would be ignored. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - - // Attrs defines Apache HTTPD agent specific attributes. The precedence is: - // `agent default attributes` > `instrument spec attributes` . - // Attributes are documented at https://github.com/open-telemetry/opentelemetry-cpp-contrib/tree/main/instrumentation/otel-webserver-module - // +optional - Attrs []corev1.EnvVar `json:"attrs,omitempty"` - - // Apache HTTPD server version. One of 2.4 or 2.2. Default is 2.4 - // +optional - Version string `json:"version,omitempty"` - - // Location of Apache HTTPD server configuration. - // Needed only if different from default "/usr/local/apache2/conf" - // +optional - ConfigPath string `json:"configPath,omitempty"` - - // Resources describes the compute resource requirements. - // +optional - Resources corev1.ResourceRequirements `json:"resourceRequirements,omitempty"` -} - -// Nginx defines Nginx SDK and instrumentation configuration. -type Nginx struct { - // Image is a container image with Nginx SDK and auto-instrumentation. - // +optional - Image string `json:"image,omitempty"` - - // VolumeSizeLimit defines size limit for volume used for auto-instrumentation. - // The default size is 200Mi. - VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"` - - // Env defines Nginx specific env vars. There are four layers for env vars' definitions and - // the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. - // If the former var had been defined, then the other vars would be ignored. - // +optional - Env []corev1.EnvVar `json:"env,omitempty"` - - // Attrs defines Nginx agent specific attributes. The precedence order is: - // `agent default attributes` > `instrument spec attributes` . - // Attributes are documented at https://github.com/open-telemetry/opentelemetry-cpp-contrib/tree/main/instrumentation/otel-webserver-module - // +optional - Attrs []corev1.EnvVar `json:"attrs,omitempty"` - - // Location of Nginx configuration file. - // Needed only if different from default "/etx/nginx/nginx.conf" - // +optional - ConfigFile string `json:"configFile,omitempty"` - - // Resources describes the compute resource requirements. - // +optional - Resources corev1.ResourceRequirements `json:"resourceRequirements,omitempty"` -} - -// InstrumentationStatus defines status of the instrumentation. -type InstrumentationStatus struct { -} - -// +kubebuilder:object:root=true -// +kubebuilder:resource:shortName=otelinst;otelinsts -// +kubebuilder:subresource:status -// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".spec.exporter.endpoint" -// +kubebuilder:printcolumn:name="Sampler",type="string",JSONPath=".spec.sampler.type" -// +kubebuilder:printcolumn:name="Sampler Arg",type="string",JSONPath=".spec.sampler.argument" -// +operator-sdk:csv:customresourcedefinitions:displayName="OpenTelemetry Instrumentation" -// +operator-sdk:csv:customresourcedefinitions:resources={{Pod,v1}} - -// Instrumentation is the spec for OpenTelemetry instrumentation. -type Instrumentation struct { - Status InstrumentationStatus `json:"status,omitempty"` - metav1.TypeMeta `json:",inline"` - Spec InstrumentationSpec `json:"spec,omitempty"` - metav1.ObjectMeta `json:"metadata,omitempty"` -} - -// +kubebuilder:object:root=true - -// InstrumentationList contains a list of Instrumentation. -type InstrumentationList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []Instrumentation `json:"items"` -} - -func init() { - SchemeBuilder.Register(&Instrumentation{}, &InstrumentationList{}) -} diff --git a/apis/v1alpha2/allocation_strategy.go b/apis/v1beta1/allocation_strategy.go similarity index 99% rename from apis/v1alpha2/allocation_strategy.go rename to apis/v1beta1/allocation_strategy.go index 9b710920de..b66c4f2cfe 100644 --- a/apis/v1alpha2/allocation_strategy.go +++ b/apis/v1beta1/allocation_strategy.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 type ( // TargetAllocatorAllocationStrategy represent a strategy Target Allocator uses to distribute targets to each collector diff --git a/apis/v1alpha2/collector_webhook.go b/apis/v1beta1/collector_webhook.go similarity index 99% rename from apis/v1alpha2/collector_webhook.go rename to apis/v1beta1/collector_webhook.go index 8bdf145fa0..67082a02cd 100644 --- a/apis/v1alpha2/collector_webhook.go +++ b/apis/v1beta1/collector_webhook.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 import ( "context" diff --git a/apis/v1alpha2/collector_webhook_test.go b/apis/v1beta1/collector_webhook_test.go similarity index 99% rename from apis/v1alpha2/collector_webhook_test.go rename to apis/v1beta1/collector_webhook_test.go index b6f9210745..9b7647cca5 100644 --- a/apis/v1alpha2/collector_webhook_test.go +++ b/apis/v1beta1/collector_webhook_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 import ( "testing" diff --git a/apis/v1alpha2/common.go b/apis/v1beta1/common.go similarity index 99% rename from apis/v1alpha2/common.go rename to apis/v1beta1/common.go index 209ade803b..2c7531b92d 100644 --- a/apis/v1alpha2/common.go +++ b/apis/v1beta1/common.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 import ( autoscalingv2 "k8s.io/api/autoscaling/v2" diff --git a/apis/v1alpha2/config.go b/apis/v1beta1/config.go similarity index 99% rename from apis/v1alpha2/config.go rename to apis/v1beta1/config.go index b437ac3f7f..a34a8cacfd 100644 --- a/apis/v1alpha2/config.go +++ b/apis/v1beta1/config.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 import ( "bytes" diff --git a/apis/v1alpha2/config_test.go b/apis/v1beta1/config_test.go similarity index 99% rename from apis/v1alpha2/config_test.go rename to apis/v1beta1/config_test.go index a8ebd29b4c..ac067f9ea1 100644 --- a/apis/v1alpha2/config_test.go +++ b/apis/v1beta1/config_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 import ( "encoding/json" diff --git a/apis/v1alpha2/groupversion_info.go b/apis/v1beta1/groupversion_info.go similarity index 90% rename from apis/v1alpha2/groupversion_info.go rename to apis/v1beta1/groupversion_info.go index 4a5c2ac8c6..2995664a09 100644 --- a/apis/v1alpha2/groupversion_info.go +++ b/apis/v1beta1/groupversion_info.go @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package v1alpha2 contains API Schema definitions for the v1alpha2 API group +// Package v1beta1 contains API Schema definitions for the v1beta1 API group // +kubebuilder:object:generate=true // +groupName=opentelemetry.io -package v1alpha2 +package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime/schema" @@ -24,7 +24,7 @@ import ( var ( // GroupVersion is group version used to register these objects. - GroupVersion = schema.GroupVersion{Group: "opentelemetry.io", Version: "v1alpha2"} + GroupVersion = schema.GroupVersion{Group: "opentelemetry.io", Version: "v1beta1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} diff --git a/apis/v1alpha2/ingress_type.go b/apis/v1beta1/ingress_type.go similarity index 99% rename from apis/v1alpha2/ingress_type.go rename to apis/v1beta1/ingress_type.go index 8808d09339..7d248a30d2 100644 --- a/apis/v1alpha2/ingress_type.go +++ b/apis/v1beta1/ingress_type.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 type ( // IngressType represents how a collector should be exposed (ingress vs route). diff --git a/apis/v1alpha2/mode.go b/apis/v1beta1/mode.go similarity index 98% rename from apis/v1alpha2/mode.go rename to apis/v1beta1/mode.go index 8cd8a46cf8..68d661c24d 100644 --- a/apis/v1alpha2/mode.go +++ b/apis/v1beta1/mode.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 type ( // Mode represents how the collector should be deployed (deployment vs. daemonset) diff --git a/apis/v1alpha2/opentelemetrycollector_types.go b/apis/v1beta1/opentelemetrycollector_types.go similarity index 99% rename from apis/v1alpha2/opentelemetrycollector_types.go rename to apis/v1beta1/opentelemetrycollector_types.go index 3521afcdaf..c93cc7af34 100644 --- a/apis/v1alpha2/opentelemetrycollector_types.go +++ b/apis/v1beta1/opentelemetrycollector_types.go @@ -14,7 +14,7 @@ // +kubebuilder:skip -package v1alpha2 +package v1beta1 import ( appsv1 "k8s.io/api/apps/v1" diff --git a/apis/v1alpha2/targetallocator_types.go b/apis/v1beta1/targetallocator_types.go similarity index 99% rename from apis/v1alpha2/targetallocator_types.go rename to apis/v1beta1/targetallocator_types.go index 74885ca1f7..05e06f7c23 100644 --- a/apis/v1alpha2/targetallocator_types.go +++ b/apis/v1beta1/targetallocator_types.go @@ -14,7 +14,7 @@ // +kubebuilder:skip -package v1alpha2 +package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/apis/v1alpha2/testdata/otelcol-connectors.yaml b/apis/v1beta1/testdata/otelcol-connectors.yaml similarity index 100% rename from apis/v1alpha2/testdata/otelcol-connectors.yaml rename to apis/v1beta1/testdata/otelcol-connectors.yaml diff --git a/apis/v1alpha2/testdata/otelcol-couchbase.yaml b/apis/v1beta1/testdata/otelcol-couchbase.yaml similarity index 100% rename from apis/v1alpha2/testdata/otelcol-couchbase.yaml rename to apis/v1beta1/testdata/otelcol-couchbase.yaml diff --git a/apis/v1alpha2/testdata/otelcol-demo.yaml b/apis/v1beta1/testdata/otelcol-demo.yaml similarity index 100% rename from apis/v1alpha2/testdata/otelcol-demo.yaml rename to apis/v1beta1/testdata/otelcol-demo.yaml diff --git a/apis/v1alpha2/testdata/otelcol-extensions.yaml b/apis/v1beta1/testdata/otelcol-extensions.yaml similarity index 100% rename from apis/v1alpha2/testdata/otelcol-extensions.yaml rename to apis/v1beta1/testdata/otelcol-extensions.yaml diff --git a/apis/v1alpha2/testdata/otelcol-filelog.yaml b/apis/v1beta1/testdata/otelcol-filelog.yaml similarity index 100% rename from apis/v1alpha2/testdata/otelcol-filelog.yaml rename to apis/v1beta1/testdata/otelcol-filelog.yaml diff --git a/apis/v1alpha2/testdata/otelcol-null-values.yaml b/apis/v1beta1/testdata/otelcol-null-values.yaml similarity index 100% rename from apis/v1alpha2/testdata/otelcol-null-values.yaml rename to apis/v1beta1/testdata/otelcol-null-values.yaml diff --git a/apis/v1alpha2/upgrade_strategy.go b/apis/v1beta1/upgrade_strategy.go similarity index 98% rename from apis/v1alpha2/upgrade_strategy.go rename to apis/v1beta1/upgrade_strategy.go index 5f26b4b3db..25ccc7eff0 100644 --- a/apis/v1alpha2/upgrade_strategy.go +++ b/apis/v1beta1/upgrade_strategy.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package v1alpha2 +package v1beta1 type ( // UpgradeStrategy represents how the operator will handle upgrades to the CR when a newer version of the operator is deployed diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1beta1/zz_generated.deepcopy.go similarity index 67% rename from apis/v1alpha2/zz_generated.deepcopy.go rename to apis/v1beta1/zz_generated.deepcopy.go index 3ceafb521c..f6b298811f 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1beta1/zz_generated.deepcopy.go @@ -17,7 +17,7 @@ // Code generated by controller-gen. DO NOT EDIT. -package v1alpha2 +package v1beta1 import ( "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" @@ -29,41 +29,6 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ApacheHttpd) DeepCopyInto(out *ApacheHttpd) { - *out = *in - if in.VolumeSizeLimit != nil { - in, out := &in.VolumeSizeLimit, &out.VolumeSizeLimit - x := (*in).DeepCopy() - *out = &x - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Attrs != nil { - in, out := &in.Attrs, &out.Attrs - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Resources.DeepCopyInto(&out.Resources) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApacheHttpd. -func (in *ApacheHttpd) DeepCopy() *ApacheHttpd { - if in == nil { - return nil - } - out := new(ApacheHttpd) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AutoscalerSpec) DeepCopyInto(out *AutoscalerSpec) { *out = *in @@ -141,77 +106,6 @@ func (in *Config) DeepCopy() *Config { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *DotNet) DeepCopyInto(out *DotNet) { - *out = *in - if in.VolumeSizeLimit != nil { - in, out := &in.VolumeSizeLimit, &out.VolumeSizeLimit - x := (*in).DeepCopy() - *out = &x - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Resources.DeepCopyInto(&out.Resources) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DotNet. -func (in *DotNet) DeepCopy() *DotNet { - if in == nil { - return nil - } - out := new(DotNet) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Exporter) DeepCopyInto(out *Exporter) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Exporter. -func (in *Exporter) DeepCopy() *Exporter { - if in == nil { - return nil - } - out := new(Exporter) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Go) DeepCopyInto(out *Go) { - *out = *in - if in.VolumeSizeLimit != nil { - in, out := &in.VolumeSizeLimit, &out.VolumeSizeLimit - x := (*in).DeepCopy() - *out = &x - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Resources.DeepCopyInto(&out.Resources) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Go. -func (in *Go) DeepCopy() *Go { - if in == nil { - return nil - } - out := new(Go) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Ingress) DeepCopyInto(out *Ingress) { *out = *in @@ -247,145 +141,6 @@ func (in *Ingress) DeepCopy() *Ingress { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Instrumentation) DeepCopyInto(out *Instrumentation) { - *out = *in - out.Status = in.Status - out.TypeMeta = in.TypeMeta - in.Spec.DeepCopyInto(&out.Spec) - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instrumentation. -func (in *Instrumentation) DeepCopy() *Instrumentation { - if in == nil { - return nil - } - out := new(Instrumentation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Instrumentation) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstrumentationList) DeepCopyInto(out *InstrumentationList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Instrumentation, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstrumentationList. -func (in *InstrumentationList) DeepCopy() *InstrumentationList { - if in == nil { - return nil - } - out := new(InstrumentationList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *InstrumentationList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstrumentationSpec) DeepCopyInto(out *InstrumentationSpec) { - *out = *in - out.Exporter = in.Exporter - in.Resource.DeepCopyInto(&out.Resource) - if in.Propagators != nil { - in, out := &in.Propagators, &out.Propagators - *out = make([]v1alpha1.Propagator, len(*in)) - copy(*out, *in) - } - out.Sampler = in.Sampler - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Java.DeepCopyInto(&out.Java) - in.NodeJS.DeepCopyInto(&out.NodeJS) - in.Python.DeepCopyInto(&out.Python) - in.DotNet.DeepCopyInto(&out.DotNet) - in.Go.DeepCopyInto(&out.Go) - in.ApacheHttpd.DeepCopyInto(&out.ApacheHttpd) - in.Nginx.DeepCopyInto(&out.Nginx) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstrumentationSpec. -func (in *InstrumentationSpec) DeepCopy() *InstrumentationSpec { - if in == nil { - return nil - } - out := new(InstrumentationSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *InstrumentationStatus) DeepCopyInto(out *InstrumentationStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InstrumentationStatus. -func (in *InstrumentationStatus) DeepCopy() *InstrumentationStatus { - if in == nil { - return nil - } - out := new(InstrumentationStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Java) DeepCopyInto(out *Java) { - *out = *in - if in.VolumeSizeLimit != nil { - in, out := &in.VolumeSizeLimit, &out.VolumeSizeLimit - x := (*in).DeepCopy() - *out = &x - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Resources.DeepCopyInto(&out.Resources) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Java. -func (in *Java) DeepCopy() *Java { - if in == nil { - return nil - } - out := new(Java) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetricSpec) DeepCopyInto(out *MetricSpec) { *out = *in @@ -406,69 +161,6 @@ func (in *MetricSpec) DeepCopy() *MetricSpec { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Nginx) DeepCopyInto(out *Nginx) { - *out = *in - if in.VolumeSizeLimit != nil { - in, out := &in.VolumeSizeLimit, &out.VolumeSizeLimit - x := (*in).DeepCopy() - *out = &x - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Attrs != nil { - in, out := &in.Attrs, &out.Attrs - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Resources.DeepCopyInto(&out.Resources) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Nginx. -func (in *Nginx) DeepCopy() *Nginx { - if in == nil { - return nil - } - out := new(Nginx) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NodeJS) DeepCopyInto(out *NodeJS) { - *out = *in - if in.VolumeSizeLimit != nil { - in, out := &in.VolumeSizeLimit, &out.VolumeSizeLimit - x := (*in).DeepCopy() - *out = &x - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Resources.DeepCopyInto(&out.Resources) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeJS. -func (in *NodeJS) DeepCopy() *NodeJS { - if in == nil { - return nil - } - out := new(NodeJS) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OpenShiftRoute) DeepCopyInto(out *OpenShiftRoute) { *out = *in @@ -813,71 +505,6 @@ func (in *Probe) DeepCopy() *Probe { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Python) DeepCopyInto(out *Python) { - *out = *in - if in.VolumeSizeLimit != nil { - in, out := &in.VolumeSizeLimit, &out.VolumeSizeLimit - x := (*in).DeepCopy() - *out = &x - } - if in.Env != nil { - in, out := &in.Env, &out.Env - *out = make([]v1.EnvVar, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - in.Resources.DeepCopyInto(&out.Resources) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Python. -func (in *Python) DeepCopy() *Python { - if in == nil { - return nil - } - out := new(Python) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Resource) DeepCopyInto(out *Resource) { - *out = *in - if in.Attributes != nil { - in, out := &in.Attributes, &out.Attributes - *out = make(map[string]string, len(*in)) - for key, val := range *in { - (*out)[key] = val - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resource. -func (in *Resource) DeepCopy() *Resource { - if in == nil { - return nil - } - out := new(Resource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Sampler) DeepCopyInto(out *Sampler) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sampler. -func (in *Sampler) DeepCopy() *Sampler { - if in == nil { - return nil - } - out := new(Sampler) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Service) DeepCopyInto(out *Service) { *out = *in diff --git a/autoinstrumentation/java/version.txt b/autoinstrumentation/java/version.txt index 96cd6ee1e7..7ec1d6db40 100644 --- a/autoinstrumentation/java/version.txt +++ b/autoinstrumentation/java/version.txt @@ -1 +1 @@ -1.32.1 +2.1.0 diff --git a/bundle.Dockerfile b/bundle.Dockerfile index 367ef8fe76..ced174751f 100644 --- a/bundle.Dockerfile +++ b/bundle.Dockerfile @@ -18,4 +18,4 @@ LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/ COPY bundle/manifests /manifests/ COPY bundle/metadata /metadata/ COPY bundle/tests/scorecard /tests/scorecard/ -LABEL com.redhat.openshift.versions="v4.11-v4.15" +LABEL com.redhat.openshift.versions="v4.12-v4.15" diff --git a/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml index 39790e95e8..0357e2f701 100644 --- a/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -65,13 +65,13 @@ metadata: categories: Logging & Tracing,Monitoring certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2024-02-02T16:02:46Z" + createdAt: "2024-02-15T18:18:46Z" 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 repository: github.com/open-telemetry/opentelemetry-operator support: OpenTelemetry Community - name: opentelemetry-operator.v0.93.0 + name: opentelemetry-operator.v0.94.0 namespace: placeholder spec: apiservicedefinitions: {} @@ -402,7 +402,7 @@ spec: - --zap-log-level=info - --zap-time-encoding=rfc3339nano - --feature-gates=+operator.autoinstrumentation.go,+operator.autoinstrumentation.nginx - image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.93.0 + image: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.94.0 livenessProbe: httpGet: path: /healthz @@ -510,7 +510,7 @@ spec: minKubeVersion: 1.23.0 provider: name: OpenTelemetry Community - version: 0.93.0 + version: 0.94.0 webhookdefinitions: - admissionReviewVersions: - v1 diff --git a/bundle/metadata/annotations.yaml b/bundle/metadata/annotations.yaml index 1dc119a11f..a06dde3728 100644 --- a/bundle/metadata/annotations.yaml +++ b/bundle/metadata/annotations.yaml @@ -14,4 +14,4 @@ annotations: operators.operatorframework.io.test.config.v1: tests/scorecard/ # OpenShift specific annotations - com.redhat.openshift.versions: "v4.11-v4.15" + com.redhat.openshift.versions: "v4.12-v4.15" diff --git a/cmd/otel-allocator/watcher/promOperator_test.go b/cmd/otel-allocator/watcher/promOperator_test.go index 37c651d73d..b9e997d5c7 100644 --- a/cmd/otel-allocator/watcher/promOperator_test.go +++ b/cmd/otel-allocator/watcher/promOperator_test.go @@ -902,25 +902,23 @@ func TestNamespaceLabelUpdate(t *testing.T) { sanitizeScrapeConfigsForTest(got.ScrapeConfigs) assert.Equal(t, want_before.ScrapeConfigs, got.ScrapeConfigs) - require.Eventually(t, func() bool { - source.Modify(&v1.Namespace{ObjectMeta: metav1.ObjectMeta{ - Name: "labellednamespace", - Labels: map[string]string{ - "label2": "label2", - }, - }}) + source.Modify(&v1.Namespace{ObjectMeta: metav1.ObjectMeta{ + Name: "labellednamespace", + Labels: map[string]string{ + "label2": "label2", + }, + }}) - select { - case <-events: - got, err := w.LoadConfig(context.Background()) - assert.NoError(t, err) + select { + case <-events: + case <-time.After(time.Second): + } - sanitizeScrapeConfigsForTest(got.ScrapeConfigs) - return assert.Equal(t, want_after.ScrapeConfigs, got.ScrapeConfigs) - default: - return false - } - }, time.Second, time.Millisecond) + got, err = w.LoadConfig(context.Background()) + assert.NoError(t, err) + + sanitizeScrapeConfigsForTest(got.ScrapeConfigs) + assert.Equal(t, want_after.ScrapeConfigs, got.ScrapeConfigs) } func TestRateLimit(t *testing.T) { diff --git a/controllers/builder_test.go b/controllers/builder_test.go index 7b69e16962..8dd0bcfa21 100644 --- a/controllers/builder_test.go +++ b/controllers/builder_test.go @@ -34,7 +34,7 @@ import ( colfeaturegate "go.opentelemetry.io/collector/featuregate" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/pkg/featuregate" @@ -87,12 +87,12 @@ service: exporters: [logging] ` - goodConfig := v1alpha2.Config{} + goodConfig := v1beta1.Config{} err := go_yaml.Unmarshal([]byte(goodConfigYaml), &goodConfig) require.NoError(t, err) one := int32(1) type args struct { - instance v1alpha2.OpenTelemetryCollector + instance v1beta1.OpenTelemetryCollector } tests := []struct { name string @@ -103,13 +103,13 @@ service: { name: "base case", args: args{ - instance: v1alpha2.OpenTelemetryCollector{ + instance: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "test", Replicas: &one, }, @@ -342,19 +342,19 @@ service: { name: "ingress", args: args{ - instance: v1alpha2.OpenTelemetryCollector{ + instance: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "test", Replicas: &one, }, Mode: "deployment", - Ingress: v1alpha2.Ingress{ - Type: v1alpha2.IngressTypeNginx, + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressTypeNginx, Hostname: "example.com", Annotations: map[string]string{ "something": "true", @@ -627,13 +627,13 @@ service: { name: "specified service account case", args: args{ - instance: v1alpha2.OpenTelemetryCollector{ + instance: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "test", Replicas: &one, ServiceAccount: "my-special-sa", @@ -1121,12 +1121,12 @@ service: exporters: [logging] ` - goodConfig := v1alpha2.Config{} + goodConfig := v1beta1.Config{} err := go_yaml.Unmarshal([]byte(goodConfigYaml), &goodConfig) require.NoError(t, err) one := int32(1) type args struct { - instance v1alpha2.OpenTelemetryCollector + instance v1beta1.OpenTelemetryCollector } tests := []struct { name string @@ -1138,22 +1138,22 @@ service: { name: "base case", args: args{ - instance: v1alpha2.OpenTelemetryCollector{ + instance: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "test", Replicas: &one, }, Mode: "statefulset", Config: goodConfig, - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, FilterStrategy: "relabel-config", - PrometheusCR: v1alpha2.TargetAllocatorPrometheusCR{ + PrometheusCR: v1beta1.TargetAllocatorPrometheusCR{ Enabled: true, }, }, @@ -1530,21 +1530,21 @@ prometheus_cr: { name: "enable metrics case", args: args{ - instance: v1alpha2.OpenTelemetryCollector{ + instance: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "test", Namespace: "test", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "test", Replicas: &one, }, Mode: "statefulset", Config: goodConfig, - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, - PrometheusCR: v1alpha2.TargetAllocatorPrometheusCR{ + PrometheusCR: v1beta1.TargetAllocatorPrometheusCR{ Enabled: true, }, FilterStrategy: "relabel-config", diff --git a/go.mod b/go.mod index baf219dbda..a213c7baf4 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.0 github.com/prometheus-operator/prometheus-operator/pkg/client v0.71.0 github.com/prometheus/client_golang v1.18.0 - github.com/prometheus/common v0.46.0 + github.com/prometheus/common v0.47.0 github.com/prometheus/prometheus v0.48.1 github.com/shirou/gopsutil v3.21.11+incompatible github.com/spf13/pflag v1.0.5 @@ -38,15 +38,15 @@ require ( go.uber.org/multierr v1.11.0 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 - k8s.io/api v0.29.1 - k8s.io/apiextensions-apiserver v0.29.1 - k8s.io/apimachinery v0.29.1 - k8s.io/client-go v0.29.1 - k8s.io/component-base v0.29.1 + k8s.io/api v0.29.2 + k8s.io/apiextensions-apiserver v0.29.2 + k8s.io/apimachinery v0.29.2 + k8s.io/client-go v0.29.2 + k8s.io/component-base v0.29.2 k8s.io/klog/v2 v2.120.1 - k8s.io/kubectl v0.29.1 + k8s.io/kubectl v0.29.2 k8s.io/utils v0.0.0-20231127182322-b307cd553661 - sigs.k8s.io/controller-runtime v0.17.1 + sigs.k8s.io/controller-runtime v0.17.2 sigs.k8s.io/yaml v1.4.0 ) diff --git a/go.sum b/go.sum index 9a47ce80e0..87ec0ac3a8 100644 --- a/go.sum +++ b/go.sum @@ -572,8 +572,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.46.0 h1:doXzt5ybi1HBKpsZOL0sSkaNHJJqkyfEWZGGqqScV0Y= -github.com/prometheus/common v0.46.0/go.mod h1:Tp0qkxpb9Jsg54QMe+EAmqXkSV7Evdy1BTn+g2pa/hQ= +github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k= +github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= @@ -1052,30 +1052,30 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/api v0.29.1 h1:DAjwWX/9YT7NQD4INu49ROJuZAAAP/Ijki48GUPzxqw= -k8s.io/api v0.29.1/go.mod h1:7Kl10vBRUXhnQQI8YR/R327zXC8eJ7887/+Ybta+RoQ= -k8s.io/apiextensions-apiserver v0.29.1 h1:S9xOtyk9M3Sk1tIpQMu9wXHm5O2MX6Y1kIpPMimZBZw= -k8s.io/apiextensions-apiserver v0.29.1/go.mod h1:zZECpujY5yTW58co8V2EQR4BD6A9pktVgHhvc0uLfeU= -k8s.io/apimachinery v0.29.1 h1:KY4/E6km/wLBguvCZv8cKTeOwwOBqFNjwJIdMkMbbRc= -k8s.io/apimachinery v0.29.1/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= -k8s.io/client-go v0.29.1 h1:19B/+2NGEwnFLzt0uB5kNJnfTsbV8w6TgQRz9l7ti7A= -k8s.io/client-go v0.29.1/go.mod h1:TDG/psL9hdet0TI9mGyHJSgRkW3H9JZk2dNEUS7bRks= -k8s.io/component-base v0.29.1 h1:MUimqJPCRnnHsskTTjKD+IC1EHBbRCVyi37IoFBrkYw= -k8s.io/component-base v0.29.1/go.mod h1:fP9GFjxYrLERq1GcWWZAE3bqbNcDKDytn2srWuHTtKc= +k8s.io/api v0.29.2 h1:hBC7B9+MU+ptchxEqTNW2DkUosJpp1P+Wn6YncZ474A= +k8s.io/api v0.29.2/go.mod h1:sdIaaKuU7P44aoyyLlikSLayT6Vb7bvJNCX105xZXY0= +k8s.io/apiextensions-apiserver v0.29.2 h1:UK3xB5lOWSnhaCk0RFZ0LUacPZz9RY4wi/yt2Iu+btg= +k8s.io/apiextensions-apiserver v0.29.2/go.mod h1:aLfYjpA5p3OwtqNXQFkhJ56TB+spV8Gc4wfMhUA3/b8= +k8s.io/apimachinery v0.29.2 h1:EWGpfJ856oj11C52NRCHuU7rFDwxev48z+6DSlGNsV8= +k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/client-go v0.29.2 h1:FEg85el1TeZp+/vYJM7hkDlSTFZ+c5nnK44DJ4FyoRg= +k8s.io/client-go v0.29.2/go.mod h1:knlvFZE58VpqbQpJNbCbctTVXcd35mMyAAwBdpt4jrA= +k8s.io/component-base v0.29.2 h1:lpiLyuvPA9yV1aQwGLENYyK7n/8t6l3nn3zAtFTJYe8= +k8s.io/component-base v0.29.2/go.mod h1:BfB3SLrefbZXiBfbM+2H1dlat21Uewg/5qtKOl8degM= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a h1:ZeIPbyHHqahGIbeyLJJjAUhnxCKqXaDY+n89Ms8szyA= k8s.io/kube-openapi v0.0.0-20231129212854-f0671cc7e66a/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= -k8s.io/kubectl v0.29.1 h1:rWnW3hi/rEUvvg7jp4iYB68qW5un/urKbv7fu3Vj0/s= -k8s.io/kubectl v0.29.1/go.mod h1:SZzvLqtuOJYSvZzPZR9weSuP0wDQ+N37CENJf0FhDF4= +k8s.io/kubectl v0.29.2 h1:uaDYaBhumvkwz0S2XHt36fK0v5IdNgL7HyUniwb2IUo= +k8s.io/kubectl v0.29.2/go.mod h1:BhizuYBGcKaHWyq+G7txGw2fXg576QbPrrnQdQDZgqI= k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6RxQGZDnzuLcrUTI= k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/controller-runtime v0.17.1 h1:V1dQELMGVk46YVXXQUbTFujU7u4DQj6YUj9Rb6cuzz8= -sigs.k8s.io/controller-runtime v0.17.1/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= +sigs.k8s.io/controller-runtime v0.17.2 h1:FwHwD1CTUemg0pW2otk7/U5/i5m2ymzvOXdbeGOUvw0= +sigs.k8s.io/controller-runtime v0.17.2/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/hack/add-openshift-annotations.sh b/hack/add-openshift-annotations.sh index b4ac3ad1b8..cc7f27bed5 100755 --- a/hack/add-openshift-annotations.sh +++ b/hack/add-openshift-annotations.sh @@ -1,6 +1,6 @@ #!/bin/bash -OPENSHIFT_VERSIONS="\"v4.11-v4.15\"" +OPENSHIFT_VERSIONS="\"v4.12-v4.15\"" { echo "" diff --git a/hack/install-kuttl.sh b/hack/install-kuttl.sh deleted file mode 100755 index 41a725a98d..0000000000 --- a/hack/install-kuttl.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -if (${KUTTL} version | grep ${KUTTL_VERSION}) > /dev/null 2>&1; then - exit 0; -fi - -OS=$(go env GOOS) -ARCH=$(uname -m) - -curl -Lo ${KUTTL} https://github.com/kudobuilder/kuttl/releases/download/v${KUTTL_VERSION}/kubectl-kuttl_${KUTTL_VERSION}_${OS}_${ARCH} -chmod +x ${KUTTL} - diff --git a/internal/api/convert/v1alpha.go b/internal/api/convert/v1alpha.go index 4c5331086b..53e37ebd7e 100644 --- a/internal/api/convert/v1alpha.go +++ b/internal/api/convert/v1alpha.go @@ -21,37 +21,37 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" ) -func V1Alpha1to2(in v1alpha1.OpenTelemetryCollector) (v1alpha2.OpenTelemetryCollector, error) { +func V1Alpha1to2(in v1alpha1.OpenTelemetryCollector) (v1beta1.OpenTelemetryCollector, error) { copy := in.DeepCopy() - out := v1alpha2.OpenTelemetryCollector{ + out := v1beta1.OpenTelemetryCollector{ TypeMeta: copy.TypeMeta, ObjectMeta: copy.ObjectMeta, } - cfg := &v1alpha2.Config{} + cfg := &v1beta1.Config{} if err := yaml.Unmarshal([]byte(in.Spec.Config), cfg); err != nil { - return v1alpha2.OpenTelemetryCollector{}, errors.New("could not convert config json to v1alpha2.Config") + return v1beta1.OpenTelemetryCollector{}, errors.New("could not convert config json to v1beta1.Config") } out.Spec.Config = *cfg - out.Spec.OpenTelemetryCommonFields.ManagementState = v1alpha2.ManagementStateType(copy.Spec.ManagementState) + out.Spec.OpenTelemetryCommonFields.ManagementState = v1beta1.ManagementStateType(copy.Spec.ManagementState) out.Spec.OpenTelemetryCommonFields.Resources = copy.Spec.Resources out.Spec.OpenTelemetryCommonFields.NodeSelector = copy.Spec.NodeSelector out.Spec.OpenTelemetryCommonFields.Args = copy.Spec.NodeSelector out.Spec.OpenTelemetryCommonFields.Replicas = copy.Spec.Replicas if copy.Spec.Autoscaler != nil { - metrics := make([]v1alpha2.MetricSpec, len(copy.Spec.Autoscaler.Metrics)) + metrics := make([]v1beta1.MetricSpec, len(copy.Spec.Autoscaler.Metrics)) for i, m := range copy.Spec.Autoscaler.Metrics { - metrics[i] = v1alpha2.MetricSpec{ + metrics[i] = v1beta1.MetricSpec{ Type: m.Type, Pods: m.Pods, } } - out.Spec.OpenTelemetryCommonFields.Autoscaler = &v1alpha2.AutoscalerSpec{ + out.Spec.OpenTelemetryCommonFields.Autoscaler = &v1beta1.AutoscalerSpec{ MinReplicas: copy.Spec.Autoscaler.MinReplicas, MaxReplicas: copy.Spec.Autoscaler.MaxReplicas, Behavior: copy.Spec.Autoscaler.Behavior, @@ -62,7 +62,7 @@ func V1Alpha1to2(in v1alpha1.OpenTelemetryCollector) (v1alpha2.OpenTelemetryColl } if copy.Spec.PodDisruptionBudget != nil { - out.Spec.OpenTelemetryCommonFields.PodDisruptionBudget = &v1alpha2.PodDisruptionBudgetSpec{ + out.Spec.OpenTelemetryCommonFields.PodDisruptionBudget = &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: copy.Spec.PodDisruptionBudget.MinAvailable, MaxUnavailable: copy.Spec.PodDisruptionBudget.MaxUnavailable, } @@ -96,18 +96,18 @@ func V1Alpha1to2(in v1alpha1.OpenTelemetryCollector) (v1alpha2.OpenTelemetryColl out.Spec.TargetAllocator = TargetAllocatorEmbedded(copy.Spec.TargetAllocator) - out.Spec.Mode = v1alpha2.Mode(copy.Spec.Mode) - out.Spec.UpgradeStrategy = v1alpha2.UpgradeStrategy(copy.Spec.UpgradeStrategy) - out.Spec.Ingress.Type = v1alpha2.IngressType(copy.Spec.Ingress.Type) - out.Spec.Ingress.RuleType = v1alpha2.IngressRuleType(copy.Spec.Ingress.RuleType) + out.Spec.Mode = v1beta1.Mode(copy.Spec.Mode) + out.Spec.UpgradeStrategy = v1beta1.UpgradeStrategy(copy.Spec.UpgradeStrategy) + out.Spec.Ingress.Type = v1beta1.IngressType(copy.Spec.Ingress.Type) + out.Spec.Ingress.RuleType = v1beta1.IngressRuleType(copy.Spec.Ingress.RuleType) out.Spec.Ingress.Hostname = copy.Spec.Ingress.Hostname out.Spec.Ingress.Annotations = copy.Spec.Ingress.Annotations out.Spec.Ingress.TLS = copy.Spec.Ingress.TLS out.Spec.Ingress.IngressClassName = copy.Spec.Ingress.IngressClassName - out.Spec.Ingress.Route.Termination = v1alpha2.TLSRouteTerminationType(copy.Spec.Ingress.Route.Termination) + out.Spec.Ingress.Route.Termination = v1beta1.TLSRouteTerminationType(copy.Spec.Ingress.Route.Termination) if copy.Spec.LivenessProbe != nil { - out.Spec.LivenessProbe = &v1alpha2.Probe{ + out.Spec.LivenessProbe = &v1beta1.Probe{ InitialDelaySeconds: copy.Spec.LivenessProbe.InitialDelaySeconds, TimeoutSeconds: copy.Spec.LivenessProbe.TimeoutSeconds, PeriodSeconds: copy.Spec.LivenessProbe.PeriodSeconds, @@ -127,13 +127,13 @@ func V1Alpha1to2(in v1alpha1.OpenTelemetryCollector) (v1alpha2.OpenTelemetryColl return out, nil } -func TargetAllocatorEmbedded(in v1alpha1.OpenTelemetryTargetAllocator) v1alpha2.TargetAllocatorEmbedded { - out := v1alpha2.TargetAllocatorEmbedded{} +func TargetAllocatorEmbedded(in v1alpha1.OpenTelemetryTargetAllocator) v1beta1.TargetAllocatorEmbedded { + out := v1beta1.TargetAllocatorEmbedded{} out.Replicas = in.Replicas out.NodeSelector = in.NodeSelector out.Resources = in.Resources - out.AllocationStrategy = v1alpha2.TargetAllocatorAllocationStrategy(in.AllocationStrategy) - out.FilterStrategy = v1alpha2.TargetAllocatorFilterStrategy(in.FilterStrategy) + out.AllocationStrategy = v1beta1.TargetAllocatorAllocationStrategy(in.AllocationStrategy) + out.FilterStrategy = v1beta1.TargetAllocatorFilterStrategy(in.FilterStrategy) out.ServiceAccount = in.ServiceAccount out.Image = in.Image out.Enabled = in.Enabled @@ -158,7 +158,7 @@ func TargetAllocatorEmbedded(in v1alpha1.OpenTelemetryTargetAllocator) v1alpha2. MatchLabels: in.PrometheusCR.ServiceMonitorSelector, } if in.PodDisruptionBudget != nil { - out.PodDisruptionBudget = &v1alpha2.PodDisruptionBudgetSpec{ + out.PodDisruptionBudget = &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: in.PodDisruptionBudget.MinAvailable, MaxUnavailable: in.PodDisruptionBudget.MaxUnavailable, } diff --git a/internal/api/convert/v1alpha_test.go b/internal/api/convert/v1alpha_test.go index 3d7f959336..0859cb5a48 100644 --- a/internal/api/convert/v1alpha_test.go +++ b/internal/api/convert/v1alpha_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" ) func Test_V1Alpha1to2(t *testing.T) { @@ -72,7 +72,7 @@ service: } _, err := V1Alpha1to2(cfgV1) - assert.ErrorContains(t, err, "could not convert config json to v1alpha2.Config") + assert.ErrorContains(t, err, "could not convert config json to v1beta1.Config") }) } @@ -174,17 +174,17 @@ func Test_TargetAllocator(t *testing.T) { }, } - expected := v1alpha2.TargetAllocatorEmbedded{ + expected := v1beta1.TargetAllocatorEmbedded{ Replicas: input.Replicas, NodeSelector: input.NodeSelector, Resources: input.Resources, - AllocationStrategy: v1alpha2.TargetAllocatorAllocationStrategyConsistentHashing, - FilterStrategy: v1alpha2.TargetAllocatorFilterStrategyRelabelConfig, + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyConsistentHashing, + FilterStrategy: v1beta1.TargetAllocatorFilterStrategyRelabelConfig, ServiceAccount: input.ServiceAccount, Image: input.Image, Enabled: input.Enabled, Affinity: input.Affinity, - PrometheusCR: v1alpha2.TargetAllocatorPrometheusCR{ + PrometheusCR: v1beta1.TargetAllocatorPrometheusCR{ Enabled: input.PrometheusCR.Enabled, ScrapeInterval: input.PrometheusCR.ScrapeInterval, PodMonitorSelector: &metav1.LabelSelector{ @@ -200,7 +200,7 @@ func Test_TargetAllocator(t *testing.T) { Tolerations: input.Tolerations, Env: input.Env, Observability: input.Observability, - PodDisruptionBudget: &v1alpha2.PodDisruptionBudgetSpec{ + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: input.PodDisruptionBudget.MinAvailable, MaxUnavailable: input.PodDisruptionBudget.MaxUnavailable, }, diff --git a/internal/config/main.go b/internal/config/main.go index 9ec5c521e8..8180aeb36c 100644 --- a/internal/config/main.go +++ b/internal/config/main.go @@ -43,6 +43,7 @@ type Config struct { collectorImage string collectorConfigMapEntry string createRBACPermissions bool + enableMultiInstrumentation bool autoInstrumentationDotNetImage string autoInstrumentationGoImage string autoInstrumentationApacheHttpdImage string @@ -75,6 +76,7 @@ func New(opts ...Option) Config { collectorImage: o.collectorImage, collectorConfigMapEntry: o.collectorConfigMapEntry, createRBACPermissions: o.createRBACPermissions, + enableMultiInstrumentation: o.enableMultiInstrumentation, targetAllocatorImage: o.targetAllocatorImage, operatorOpAMPBridgeImage: o.operatorOpAMPBridgeImage, targetAllocatorConfigMapEntry: o.targetAllocatorConfigMapEntry, @@ -109,6 +111,11 @@ func (c *Config) CollectorImage() string { return c.collectorImage } +// EnableMultiInstrumentation is true when the operator supports multi instrumentation. +func (c *Config) EnableMultiInstrumentation() bool { + return c.enableMultiInstrumentation +} + // CollectorConfigMapEntry represents the configuration file name for the collector. Immutable. func (c *Config) CollectorConfigMapEntry() string { return c.collectorConfigMapEntry diff --git a/internal/config/options.go b/internal/config/options.go index bb8c840e10..daa8543746 100644 --- a/internal/config/options.go +++ b/internal/config/options.go @@ -42,6 +42,7 @@ type options struct { collectorImage string collectorConfigMapEntry string createRBACPermissions bool + enableMultiInstrumentation bool targetAllocatorConfigMapEntry string operatorOpAMPBridgeConfigMapEntry string targetAllocatorImage string @@ -80,6 +81,11 @@ func WithCreateRBACPermissions(s bool) Option { o.createRBACPermissions = s } } +func WithEnableMultiInstrumentation(s bool) Option { + return func(o *options) { + o.enableMultiInstrumentation = s + } +} func WithTargetAllocatorConfigMapEntry(s string) Option { return func(o *options) { o.targetAllocatorConfigMapEntry = s diff --git a/internal/manifests/collector/annotations.go b/internal/manifests/collector/annotations.go index 32201ea412..5f4c7c41be 100644 --- a/internal/manifests/collector/annotations.go +++ b/internal/manifests/collector/annotations.go @@ -19,11 +19,11 @@ import ( "encoding/json" "fmt" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" ) // Annotations return the annotations for OpenTelemetryCollector pod. -func Annotations(instance v1alpha2.OpenTelemetryCollector) (map[string]string, error) { +func Annotations(instance v1beta1.OpenTelemetryCollector) (map[string]string, error) { // new map every time, so that we don't touch the instance's annotations annotations := map[string]string{} @@ -54,7 +54,7 @@ func Annotations(instance v1alpha2.OpenTelemetryCollector) (map[string]string, e } // PodAnnotations return the spec annotations for OpenTelemetryCollector pod. -func PodAnnotations(instance v1alpha2.OpenTelemetryCollector) (map[string]string, error) { +func PodAnnotations(instance v1beta1.OpenTelemetryCollector) (map[string]string, error) { // new map every time, so that we don't touch the instance's annotations podAnnotations := map[string]string{} @@ -84,7 +84,7 @@ func PodAnnotations(instance v1alpha2.OpenTelemetryCollector) (map[string]string return podAnnotations, nil } -func getConfigMapSHA(config v1alpha2.Config) (string, error) { +func getConfigMapSHA(config v1beta1.Config) (string, error) { b, err := json.Marshal(&config) if err != nil { return "", err diff --git a/internal/manifests/collector/annotations_test.go b/internal/manifests/collector/annotations_test.go index 9119bbda0a..ec773f195a 100644 --- a/internal/manifests/collector/annotations_test.go +++ b/internal/manifests/collector/annotations_test.go @@ -22,19 +22,19 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" ) func TestDefaultAnnotations(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-ns", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - Config: v1alpha2.Config{ - Service: v1alpha2.Service{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Config: v1beta1.Config{ + Service: v1beta1.Service{ Extensions: func() *[]string { res := []string{"test"} return &res @@ -64,12 +64,12 @@ func TestDefaultAnnotations(t *testing.T) { func TestNonDefaultPodAnnotation(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-ns", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Observability: v1alpha1.ObservabilitySpec{ Metrics: v1alpha1.MetricsConfigSpec{ DisablePrometheusAnnotations: true, @@ -98,7 +98,7 @@ func TestNonDefaultPodAnnotation(t *testing.T) { func TestUserAnnotations(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-ns", @@ -108,9 +108,9 @@ func TestUserAnnotations(t *testing.T) { "opentelemetry-operator-config/sha256": "shouldBeOverwritten", }, }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - Config: v1alpha2.Config{ - Service: v1alpha2.Service{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Config: v1beta1.Config{ + Service: v1beta1.Service{ Extensions: func() *[]string { res := []string{"test2"} return &res @@ -136,12 +136,12 @@ func TestUserAnnotations(t *testing.T) { func TestAnnotationsPropagateDown(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Annotations: map[string]string{"myapp": "mycomponent"}, }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodAnnotations: map[string]string{"pod_annotation": "pod_annotation_value"}, }, }, diff --git a/internal/manifests/collector/collector.go b/internal/manifests/collector/collector.go index e673b168aa..3b984d6918 100644 --- a/internal/manifests/collector/collector.go +++ b/internal/manifests/collector/collector.go @@ -17,7 +17,7 @@ package collector import ( "sigs.k8s.io/controller-runtime/pkg/client" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/pkg/featuregate" ) @@ -31,15 +31,15 @@ func Build(params manifests.Params) ([]client.Object, error) { var resourceManifests []client.Object var manifestFactories []manifests.K8sManifestFactory switch params.OtelCol.Spec.Mode { - case v1alpha2.ModeDeployment: + case v1beta1.ModeDeployment: manifestFactories = append(manifestFactories, manifests.Factory(Deployment)) manifestFactories = append(manifestFactories, manifests.Factory(PodDisruptionBudget)) - case v1alpha2.ModeStatefulSet: + case v1beta1.ModeStatefulSet: manifestFactories = append(manifestFactories, manifests.Factory(StatefulSet)) manifestFactories = append(manifestFactories, manifests.Factory(PodDisruptionBudget)) - case v1alpha2.ModeDaemonSet: + case v1beta1.ModeDaemonSet: manifestFactories = append(manifestFactories, manifests.Factory(DaemonSet)) - case v1alpha2.ModeSidecar: + case v1beta1.ModeSidecar: params.Log.V(5).Info("not building sidecar...") } manifestFactories = append(manifestFactories, []manifests.K8sManifestFactory{ @@ -53,7 +53,7 @@ func Build(params manifests.Params) ([]client.Object, error) { }...) if params.OtelCol.Spec.Observability.Metrics.EnableMetrics && featuregate.PrometheusOperatorIsAvailable.IsEnabled() { - if params.OtelCol.Spec.Mode == v1alpha2.ModeSidecar { + if params.OtelCol.Spec.Mode == v1beta1.ModeSidecar { manifestFactories = append(manifestFactories, manifests.Factory(PodMonitor)) } else { manifestFactories = append(manifestFactories, manifests.Factory(ServiceMonitor)) diff --git a/internal/manifests/collector/config_replace.go b/internal/manifests/collector/config_replace.go index 79c636b483..ddeeec172a 100644 --- a/internal/manifests/collector/config_replace.go +++ b/internal/manifests/collector/config_replace.go @@ -21,7 +21,7 @@ import ( _ "github.com/prometheus/prometheus/discovery/install" // Package install has the side-effect of registering all builtin. "gopkg.in/yaml.v3" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/adapters" ta "github.com/open-telemetry/opentelemetry-operator/internal/manifests/targetallocator/adapters" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -42,7 +42,7 @@ type Config struct { TargetAllocConfig *targetAllocator `yaml:"target_allocator,omitempty"` } -func ReplaceConfig(instance v1alpha2.OpenTelemetryCollector) (string, error) { +func ReplaceConfig(instance v1beta1.OpenTelemetryCollector) (string, error) { cfgStr, err := instance.Spec.Config.Yaml() if err != nil { return "", err diff --git a/internal/manifests/collector/container.go b/internal/manifests/collector/container.go index 00f6e2ee2b..d6603a98d2 100644 --- a/internal/manifests/collector/container.go +++ b/internal/manifests/collector/container.go @@ -25,7 +25,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/validation" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/adapters" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -36,7 +36,7 @@ import ( const maxPortLen = 15 // Container builds a container for the given collector. -func Container(cfg config.Config, logger logr.Logger, otelcol v1alpha2.OpenTelemetryCollector, addConfig bool) corev1.Container { +func Container(cfg config.Config, logger logr.Logger, otelcol v1beta1.OpenTelemetryCollector, addConfig bool) corev1.Container { image := otelcol.Spec.Image if len(image) == 0 { image = cfg.CollectorImage() @@ -226,7 +226,7 @@ func portMapToList(portMap map[string]corev1.ContainerPort) []corev1.ContainerPo return ports } -func getLivenessProbe(config map[interface{}]interface{}, probeConfig *v1alpha2.Probe) (*corev1.Probe, error) { +func getLivenessProbe(config map[interface{}]interface{}, probeConfig *v1beta1.Probe) (*corev1.Probe, error) { probe, err := adapters.ConfigToContainerProbe(config) if err != nil { return nil, err diff --git a/internal/manifests/collector/container_test.go b/internal/manifests/collector/container_test.go index 6536d81f2b..de80f962c2 100644 --- a/internal/manifests/collector/container_test.go +++ b/internal/manifests/collector/container_test.go @@ -26,7 +26,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" ) @@ -53,9 +53,9 @@ func TestContainerNewDefault(t *testing.T) { metrics: receivers: [otlp] exporters: [debug]` - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Ports: []corev1.ServicePort{ { Name: "metrics", @@ -79,9 +79,9 @@ func TestContainerNewDefault(t *testing.T) { func TestContainerWithImageOverridden(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "overridden-image", }, }, @@ -350,10 +350,10 @@ service: for _, testCase := range tests { t.Run(testCase.description, func(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Config: mustUnmarshalToConfig(t, testCase.specConfig), - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Ports: testCase.specPorts, }, }, @@ -371,9 +371,9 @@ service: func TestContainerConfigFlagIsIgnored(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{ "key": "value", "config": "/some-custom-file.yaml", @@ -394,9 +394,9 @@ func TestContainerConfigFlagIsIgnored(t *testing.T) { func TestContainerCustomVolumes(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ VolumeMounts: []corev1.VolumeMount{{ Name: "custom-volume-mount", }}, @@ -415,8 +415,8 @@ func TestContainerCustomVolumes(t *testing.T) { func TestContainerCustomConfigMapsVolumes(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ ConfigMaps: []v1alpha1.ConfigMapsSpec{{ Name: "test", MountPath: "/", @@ -441,7 +441,7 @@ func TestContainerCustomConfigMapsVolumes(t *testing.T) { func TestContainerCustomSecurityContext(t *testing.T) { // default config without security context - c1 := Container(config.New(), logger, v1alpha2.OpenTelemetryCollector{Spec: v1alpha2.OpenTelemetryCollectorSpec{}}, true) + c1 := Container(config.New(), logger, v1beta1.OpenTelemetryCollector{Spec: v1beta1.OpenTelemetryCollectorSpec{}}, true) // verify assert.Nil(t, c1.SecurityContext) @@ -451,9 +451,9 @@ func TestContainerCustomSecurityContext(t *testing.T) { uid := int64(1234) // test - c2 := Container(config.New(), logger, v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + c2 := Container(config.New(), logger, v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ SecurityContext: &corev1.SecurityContext{ Privileged: &isPrivileged, @@ -470,9 +470,9 @@ func TestContainerCustomSecurityContext(t *testing.T) { } func TestContainerEnvVarsOverridden(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Env: []corev1.EnvVar{ { Name: "foo", @@ -495,8 +495,8 @@ func TestContainerEnvVarsOverridden(t *testing.T) { } func TestContainerDefaultEnvVars(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{}, + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{}, } cfg := config.New() @@ -513,8 +513,8 @@ func TestContainerProxyEnvVars(t *testing.T) { err := os.Setenv("NO_PROXY", "localhost") require.NoError(t, err) defer os.Unsetenv("NO_PROXY") - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{}, + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{}, } cfg := config.New() @@ -530,9 +530,9 @@ func TestContainerProxyEnvVars(t *testing.T) { } func TestContainerResourceRequirements(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ corev1.ResourceCPU: resource.MustParse("100m"), @@ -560,8 +560,8 @@ func TestContainerResourceRequirements(t *testing.T) { } func TestContainerDefaultResourceRequirements(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{}, + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{}, } cfg := config.New() @@ -575,9 +575,9 @@ func TestContainerDefaultResourceRequirements(t *testing.T) { func TestContainerArgs(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{ "metrics-level": "detailed", "log-level": "debug", @@ -597,9 +597,9 @@ func TestContainerArgs(t *testing.T) { func TestContainerOrderedArgs(t *testing.T) { // prepare a scenario where the debug level and a feature gate has been enabled - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Args: map[string]string{ "log-level": "debug", "feature-gates": "+random-feature", @@ -621,9 +621,9 @@ func TestContainerOrderedArgs(t *testing.T) { func TestContainerImagePullPolicy(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ ImagePullPolicy: corev1.PullIfNotPresent, }, }, @@ -653,9 +653,9 @@ func TestContainerEnvFrom(t *testing.T) { }, }, } - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ EnvFrom: []corev1.EnvFromSource{ envFrom1, envFrom2, @@ -681,13 +681,13 @@ func TestContainerProbe(t *testing.T) { successThreshold := int32(13) failureThreshold := int32(14) terminationGracePeriodSeconds := int64(15) - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Config: mustUnmarshalToConfig(t, `extensions: health_check: service: extensions: [health_check]`), - LivenessProbe: &v1alpha2.Probe{ + LivenessProbe: &v1beta1.Probe{ InitialDelaySeconds: &initialDelaySeconds, TimeoutSeconds: &timeoutSeconds, PeriodSeconds: &periodSeconds, @@ -718,13 +718,13 @@ service: func TestContainerProbeEmptyConfig(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Config: mustUnmarshalToConfig(t, `extensions: health_check: service: extensions: [health_check]`), - LivenessProbe: &v1alpha2.Probe{}, + LivenessProbe: &v1beta1.Probe{}, }, } cfg := config.New() @@ -740,8 +740,8 @@ service: func TestContainerProbeNoConfig(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Config: mustUnmarshalToConfig(t, `extensions: health_check: service: @@ -761,9 +761,9 @@ service: func TestContainerLifecycle(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Lifecycle: &corev1.Lifecycle{ PostStart: &corev1.LifecycleHandler{ Exec: &corev1.ExecAction{Command: []string{"sh", "sleep 100"}}, @@ -793,8 +793,8 @@ func TestContainerLifecycle(t *testing.T) { assert.Equal(t, expectedLifecycleHooks, *c.Lifecycle) } -func mustUnmarshalToConfig(t *testing.T, config string) v1alpha2.Config { - cfg := v1alpha2.Config{} +func mustUnmarshalToConfig(t *testing.T, config string) v1beta1.Config { + cfg := v1beta1.Config{} if err := yaml.Unmarshal([]byte(config), &cfg); err != nil { t.Fatal(err) } diff --git a/internal/manifests/collector/daemonset_test.go b/internal/manifests/collector/daemonset_test.go index da86c2afe8..17a326967c 100644 --- a/internal/manifests/collector/daemonset_test.go +++ b/internal/manifests/collector/daemonset_test.go @@ -24,7 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" @@ -34,13 +34,13 @@ func TestDaemonSetNewDefault(t *testing.T) { // prepare params := manifests.Params{ Config: config.New(), - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Tolerations: testTolerationValues, }, }, @@ -98,12 +98,12 @@ func TestDaemonSetNewDefault(t *testing.T) { func TestDaemonsetHostNetwork(t *testing.T) { params1 := manifests.Params{ Config: config.New(), - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{}, + Spec: v1beta1.OpenTelemetryCollectorSpec{}, }, Log: logger, } @@ -116,13 +116,13 @@ func TestDaemonsetHostNetwork(t *testing.T) { // verify custom params2 := manifests.Params{ Config: config.New(), - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ HostNetwork: true, }, }, @@ -138,12 +138,12 @@ func TestDaemonsetHostNetwork(t *testing.T) { func TestDaemonsetPodAnnotations(t *testing.T) { // prepare testPodAnnotationValues := map[string]string{"annotation-key": "annotation-value"} - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodAnnotations: testPodAnnotationValues, }, }, @@ -182,12 +182,12 @@ func TestDaemonstPodSecurityContext(t *testing.T) { runAsUser := int64(1337) runasGroup := int64(1338) - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodSecurityContext: &v1.PodSecurityContext{ RunAsNonRoot: &runAsNonRoot, RunAsUser: &runAsUser, @@ -219,12 +219,12 @@ func TestDaemonsetFilterLabels(t *testing.T) { "app.foo.bar": "1", } - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Labels: excludedLabels, }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{}, + Spec: v1beta1.OpenTelemetryCollectorSpec{}, } cfg := config.New(config.WithLabelFilters([]string{"foo*", "app.*.bar"})) @@ -246,7 +246,7 @@ func TestDaemonsetFilterLabels(t *testing.T) { func TestDaemonSetNodeSelector(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -266,12 +266,12 @@ func TestDaemonSetNodeSelector(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.NodeSelector) // Test nodeSelector - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-nodeselector", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ HostNetwork: true, NodeSelector: map[string]string{ "node-key": "node-value", @@ -294,7 +294,7 @@ func TestDaemonSetNodeSelector(t *testing.T) { } func TestDaemonSetPriorityClassName(t *testing.T) { - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -314,12 +314,12 @@ func TestDaemonSetPriorityClassName(t *testing.T) { priorityClassName := "test-class" - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-priortyClassName", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PriorityClassName: priorityClassName, }, }, @@ -339,7 +339,7 @@ func TestDaemonSetPriorityClassName(t *testing.T) { } func TestDaemonSetAffinity(t *testing.T) { - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -357,12 +357,12 @@ func TestDaemonSetAffinity(t *testing.T) { require.NoError(t, err) assert.Nil(t, d1.Spec.Template.Spec.Affinity) - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-priortyClassName", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Affinity: testAffinityValue, }, }, @@ -384,13 +384,13 @@ func TestDaemonSetAffinity(t *testing.T) { func TestDaemonSetInitContainer(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ InitContainers: []v1.Container{ { Name: "test", @@ -420,13 +420,13 @@ func TestDaemonSetInitContainer(t *testing.T) { func TestDaemonSetAdditionalContainer(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ AdditionalContainers: []v1.Container{ { Name: "test", @@ -457,12 +457,12 @@ func TestDaemonSetAdditionalContainer(t *testing.T) { func TestDaemonSetDefaultUpdateStrategy(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ DaemonSetUpdateStrategy: appsv1.DaemonSetUpdateStrategy{ Type: "RollingUpdate", RollingUpdate: &appsv1.RollingUpdateDaemonSet{ @@ -492,12 +492,12 @@ func TestDaemonSetDefaultUpdateStrategy(t *testing.T) { func TestDaemonSetOnDeleteUpdateStrategy(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ DaemonSetUpdateStrategy: appsv1.DaemonSetUpdateStrategy{ Type: "OnDelete", RollingUpdate: &appsv1.RollingUpdateDaemonSet{ @@ -528,11 +528,11 @@ func TestDaemonSetOnDeleteUpdateStrategy(t *testing.T) { func TestDaemonsetShareProcessNamespace(t *testing.T) { params1 := manifests.Params{ Config: config.New(), - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{}, + Spec: v1beta1.OpenTelemetryCollectorSpec{}, }, Log: logger, } @@ -544,12 +544,12 @@ func TestDaemonsetShareProcessNamespace(t *testing.T) { // verify custom params2 := manifests.Params{ Config: config.New(), - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-with-shareprocessnamespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ ShareProcessNamespace: true, }, }, diff --git a/internal/manifests/collector/deployment_test.go b/internal/manifests/collector/deployment_test.go index 8d33edabd9..662ef1de62 100644 --- a/internal/manifests/collector/deployment_test.go +++ b/internal/manifests/collector/deployment_test.go @@ -24,7 +24,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" @@ -71,13 +71,13 @@ var testTopologySpreadConstraintValue = []v1.TopologySpreadConstraint{ func TestDeploymentNewDefault(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Tolerations: testTolerationValues, }, }, @@ -140,12 +140,12 @@ func TestDeploymentNewDefault(t *testing.T) { func TestDeploymentPodAnnotations(t *testing.T) { // prepare testPodAnnotationValues := map[string]string{"annotation-key": "annotation-value"} - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodAnnotations: testPodAnnotationValues, }, }, @@ -184,12 +184,12 @@ func TestDeploymenttPodSecurityContext(t *testing.T) { runAsUser := int64(1337) runasGroup := int64(1338) - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodSecurityContext: &v1.PodSecurityContext{ RunAsNonRoot: &runAsNonRoot, RunAsUser: &runAsUser, @@ -216,11 +216,11 @@ func TestDeploymenttPodSecurityContext(t *testing.T) { } func TestDeploymentUpdateStrategy(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ DeploymentUpdateStrategy: appsv1.DeploymentStrategy{ Type: "RollingUpdate", RollingUpdate: &appsv1.RollingUpdateDeployment{ @@ -249,7 +249,7 @@ func TestDeploymentUpdateStrategy(t *testing.T) { func TestDeploymentHostNetwork(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -270,12 +270,12 @@ func TestDeploymentHostNetwork(t *testing.T) { assert.Equal(t, d1.Spec.Template.Spec.DNSPolicy, v1.DNSClusterFirst) // Test hostNetwork=true - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-hostnetwork", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ HostNetwork: true, }, }, @@ -301,12 +301,12 @@ func TestDeploymentFilterLabels(t *testing.T) { "app.foo.bar": "1", } - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Labels: excludedLabels, }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{}, + Spec: v1beta1.OpenTelemetryCollectorSpec{}, } cfg := config.New(config.WithLabelFilters([]string{"foo*", "app.*.bar"})) @@ -328,7 +328,7 @@ func TestDeploymentFilterLabels(t *testing.T) { func TestDeploymentNodeSelector(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -348,12 +348,12 @@ func TestDeploymentNodeSelector(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.NodeSelector) // Test nodeSelector - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-nodeselector", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ HostNetwork: true, NodeSelector: map[string]string{ "node-key": "node-value", @@ -376,7 +376,7 @@ func TestDeploymentNodeSelector(t *testing.T) { } func TestDeploymentPriorityClassName(t *testing.T) { - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -396,12 +396,12 @@ func TestDeploymentPriorityClassName(t *testing.T) { priorityClassName := "test-class" - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-priortyClassName", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PriorityClassName: priorityClassName, }, }, @@ -421,7 +421,7 @@ func TestDeploymentPriorityClassName(t *testing.T) { } func TestDeploymentAffinity(t *testing.T) { - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -439,12 +439,12 @@ func TestDeploymentAffinity(t *testing.T) { require.NoError(t, err) assert.Nil(t, d1.Spec.Template.Spec.Affinity) - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-priortyClassName", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Affinity: testAffinityValue, }, }, @@ -465,7 +465,7 @@ func TestDeploymentAffinity(t *testing.T) { } func TestDeploymentTerminationGracePeriodSeconds(t *testing.T) { - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -485,12 +485,12 @@ func TestDeploymentTerminationGracePeriodSeconds(t *testing.T) { gracePeriodSec := int64(60) - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-terminationGracePeriodSeconds", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ TerminationGracePeriodSeconds: &gracePeriodSec, }, }, @@ -512,13 +512,13 @@ func TestDeploymentTerminationGracePeriodSeconds(t *testing.T) { func TestDeploymentSetInitContainer(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ InitContainers: []v1.Container{ { Name: "test", @@ -548,7 +548,7 @@ func TestDeploymentSetInitContainer(t *testing.T) { func TestDeploymentTopologySpreadConstraints(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -567,12 +567,12 @@ func TestDeploymentTopologySpreadConstraints(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.TopologySpreadConstraints) // Test TopologySpreadConstraints - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-topologyspreadconstraint", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ TopologySpreadConstraints: testTopologySpreadConstraintValue, }, }, @@ -595,13 +595,13 @@ func TestDeploymentTopologySpreadConstraints(t *testing.T) { func TestDeploymentAdditionalContainers(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ AdditionalContainers: []v1.Container{ { Name: "test", @@ -632,7 +632,7 @@ func TestDeploymentAdditionalContainers(t *testing.T) { func TestDeploymentShareProcessNamespace(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -651,12 +651,12 @@ func TestDeploymentShareProcessNamespace(t *testing.T) { assert.False(t, *d1.Spec.Template.Spec.ShareProcessNamespace) // Test hostNetwork=true - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-with-shareprocessnamespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ ShareProcessNamespace: true, }, }, diff --git a/internal/manifests/collector/horizontalpodautoscaler_test.go b/internal/manifests/collector/horizontalpodautoscaler_test.go index 79f2074dc2..7ade5d1874 100644 --- a/internal/manifests/collector/horizontalpodautoscaler_test.go +++ b/internal/manifests/collector/horizontalpodautoscaler_test.go @@ -23,7 +23,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" @@ -41,14 +41,14 @@ func TestHPA(t *testing.T) { var cpuUtilization int32 = 66 var memoryUtilization int32 = 77 - otelcols := []v1alpha2.OpenTelemetryCollector{ + otelcols := []v1beta1.OpenTelemetryCollector{ { ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ - Autoscaler: &v1alpha2.AutoscalerSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + Autoscaler: &v1beta1.AutoscalerSpec{ MinReplicas: &minReplicas, MaxReplicas: &maxReplicas, TargetCPUUtilization: &cpuUtilization, @@ -61,9 +61,9 @@ func TestHPA(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ - Autoscaler: &v1alpha2.AutoscalerSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + Autoscaler: &v1beta1.AutoscalerSpec{ MinReplicas: &minReplicas, MaxReplicas: &maxReplicas, TargetCPUUtilization: &cpuUtilization, @@ -80,11 +80,11 @@ func TestHPA(t *testing.T) { configuration := config.New() params := manifests.Params{ Config: configuration, - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ ObjectMeta: otelcol.ObjectMeta, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ - Autoscaler: &v1alpha2.AutoscalerSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ + Autoscaler: &v1beta1.AutoscalerSpec{ MinReplicas: otelcol.Spec.Autoscaler.MinReplicas, MaxReplicas: otelcol.Spec.Autoscaler.MaxReplicas, TargetCPUUtilization: otelcol.Spec.OpenTelemetryCommonFields.Autoscaler.TargetCPUUtilization, diff --git a/internal/manifests/collector/ingress.go b/internal/manifests/collector/ingress.go index 2992aa941f..fecd6d6a92 100644 --- a/internal/manifests/collector/ingress.go +++ b/internal/manifests/collector/ingress.go @@ -22,14 +22,14 @@ import ( networkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/adapters" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) func Ingress(params manifests.Params) (*networkingv1.Ingress, error) { - if params.OtelCol.Spec.Ingress.Type != v1alpha2.IngressTypeNginx { + if params.OtelCol.Spec.Ingress.Type != v1beta1.IngressTypeNginx { return nil, nil } @@ -47,9 +47,9 @@ func Ingress(params manifests.Params) (*networkingv1.Ingress, error) { var rules []networkingv1.IngressRule switch params.OtelCol.Spec.Ingress.RuleType { - case v1alpha2.IngressRuleTypePath, "": + case v1beta1.IngressRuleTypePath, "": rules = []networkingv1.IngressRule{createPathIngressRules(params.OtelCol.Name, params.OtelCol.Spec.Ingress.Hostname, ports)} - case v1alpha2.IngressRuleTypeSubdomain: + case v1beta1.IngressRuleTypeSubdomain: rules = createSubdomainIngressRules(params.OtelCol.Name, params.OtelCol.Spec.Ingress.Hostname, ports) } @@ -136,7 +136,7 @@ func createSubdomainIngressRules(otelcol string, hostname string, ports []corev1 return rules } -func servicePortsFromCfg(logger logr.Logger, otelcol v1alpha2.OpenTelemetryCollector) ([]corev1.ServicePort, error) { +func servicePortsFromCfg(logger logr.Logger, otelcol v1beta1.OpenTelemetryCollector) ([]corev1.ServicePort, error) { out, err := otelcol.Spec.Config.Yaml() if err != nil { return nil, err diff --git a/internal/manifests/collector/ingress_test.go b/internal/manifests/collector/ingress_test.go index 5dbede9a93..9a7ae7ff10 100644 --- a/internal/manifests/collector/ingress_test.go +++ b/internal/manifests/collector/ingress_test.go @@ -26,7 +26,7 @@ import ( "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/naming" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" ) @@ -37,10 +37,10 @@ func TestDesiredIngresses(t *testing.T) { params := manifests.Params{ Config: config.Config{}, Log: logger, - OtelCol: v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - Ingress: v1alpha2.Ingress{ - Type: v1alpha2.IngressType("unknown"), + OtelCol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressType("unknown"), }, }, }, @@ -55,11 +55,11 @@ func TestDesiredIngresses(t *testing.T) { params := manifests.Params{ Config: config.Config{}, Log: logger, - OtelCol: v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - Config: v1alpha2.Config{}, - Ingress: v1alpha2.Ingress{ - Type: v1alpha2.IngressTypeNginx, + OtelCol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Config: v1beta1.Config{}, + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressTypeNginx, }, }, }, @@ -83,8 +83,8 @@ func TestDesiredIngresses(t *testing.T) { } params.OtelCol.Namespace = ns - params.OtelCol.Spec.Ingress = v1alpha2.Ingress{ - Type: v1alpha2.IngressTypeNginx, + params.OtelCol.Spec.Ingress = v1beta1.Ingress{ + Type: v1beta1.IngressTypeNginx, Hostname: hostname, Annotations: map[string]string{"some.key": "some.value"}, IngressClassName: &ingressClassName, @@ -171,9 +171,9 @@ func TestDesiredIngresses(t *testing.T) { } params.OtelCol.Namespace = ns - params.OtelCol.Spec.Ingress = v1alpha2.Ingress{ - Type: v1alpha2.IngressTypeNginx, - RuleType: v1alpha2.IngressRuleTypeSubdomain, + params.OtelCol.Spec.Ingress = v1beta1.Ingress{ + Type: v1beta1.IngressTypeNginx, + RuleType: v1beta1.IngressRuleTypeSubdomain, Hostname: hostname, Annotations: map[string]string{"some.key": "some.value"}, IngressClassName: &ingressClassName, diff --git a/internal/manifests/collector/poddisruptionbudget_test.go b/internal/manifests/collector/poddisruptionbudget_test.go index b759d4b677..7bf709a6be 100644 --- a/internal/manifests/collector/poddisruptionbudget_test.go +++ b/internal/manifests/collector/poddisruptionbudget_test.go @@ -22,7 +22,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" @@ -65,7 +65,7 @@ func TestPDB(t *testing.T) { }, } - otelcols := []v1alpha2.OpenTelemetryCollector{ + otelcols := []v1beta1.OpenTelemetryCollector{ { ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", @@ -76,7 +76,7 @@ func TestPDB(t *testing.T) { for _, otelcol := range otelcols { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - otelcol.Spec.PodDisruptionBudget = &v1alpha2.PodDisruptionBudgetSpec{ + otelcol.Spec.PodDisruptionBudget = &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: test.MinAvailable, MaxUnavailable: test.MaxUnavailable, } diff --git a/internal/manifests/collector/podmonitor.go b/internal/manifests/collector/podmonitor.go index f51c7c95b1..73c63bf56b 100644 --- a/internal/manifests/collector/podmonitor.go +++ b/internal/manifests/collector/podmonitor.go @@ -22,7 +22,7 @@ import ( monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/adapters" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -39,7 +39,7 @@ func PodMonitor(params manifests.Params) (*monitoringv1.PodMonitor, error) { } var pm monitoringv1.PodMonitor - if params.OtelCol.Spec.Mode != v1alpha2.ModeSidecar { + if params.OtelCol.Spec.Mode != v1beta1.ModeSidecar { return nil, nil } @@ -77,7 +77,7 @@ func PodMonitor(params manifests.Params) (*monitoringv1.PodMonitor, error) { return &pm, nil } -func metricsEndpointsFromConfig(logger logr.Logger, otelcol v1alpha2.OpenTelemetryCollector) []monitoringv1.PodMetricsEndpoint { +func metricsEndpointsFromConfig(logger logr.Logger, otelcol v1beta1.OpenTelemetryCollector) []monitoringv1.PodMetricsEndpoint { // TODO: https://github.com/open-telemetry/opentelemetry-operator/issues/2603 cfgStr, err := otelcol.Spec.Config.Yaml() if err != nil { diff --git a/internal/manifests/collector/podmonitor_test.go b/internal/manifests/collector/podmonitor_test.go index 2feaa996c8..c83950ea85 100644 --- a/internal/manifests/collector/podmonitor_test.go +++ b/internal/manifests/collector/podmonitor_test.go @@ -18,14 +18,14 @@ import ( "fmt" "testing" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/stretchr/testify/assert" ) func sidecarParams() manifests.Params { - return paramsWithMode(v1alpha2.ModeSidecar) + return paramsWithMode(v1beta1.ModeSidecar) } func TestDesiredPodMonitors(t *testing.T) { @@ -45,7 +45,7 @@ func TestDesiredPodMonitors(t *testing.T) { params, err = newParams("", "testdata/prometheus-exporter.yaml") assert.NoError(t, err) - params.OtelCol.Spec.Mode = v1alpha2.ModeSidecar + params.OtelCol.Spec.Mode = v1beta1.ModeSidecar params.OtelCol.Spec.Observability.Metrics.EnableMetrics = true actual, err = PodMonitor(params) assert.NoError(t, err) diff --git a/internal/manifests/collector/route.go b/internal/manifests/collector/route.go index b30fe59288..29fa385c38 100644 --- a/internal/manifests/collector/route.go +++ b/internal/manifests/collector/route.go @@ -21,31 +21,31 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/autodetect/openshift" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) func Routes(params manifests.Params) ([]*routev1.Route, error) { - if params.OtelCol.Spec.Ingress.Type != v1alpha2.IngressTypeRoute || params.Config.OpenShiftRoutesAvailability() != openshift.RoutesAvailable { + if params.OtelCol.Spec.Ingress.Type != v1beta1.IngressTypeRoute || params.Config.OpenShiftRoutesAvailability() != openshift.RoutesAvailable { return nil, nil } - if params.OtelCol.Spec.Mode == v1alpha2.ModeSidecar { + if params.OtelCol.Spec.Mode == v1beta1.ModeSidecar { params.Log.V(3).Info("ingress settings are not supported in sidecar mode") return nil, nil } var tlsCfg *routev1.TLSConfig switch params.OtelCol.Spec.Ingress.Route.Termination { - case v1alpha2.TLSRouteTerminationTypeInsecure: + case v1beta1.TLSRouteTerminationTypeInsecure: // NOTE: insecure, no tls cfg. - case v1alpha2.TLSRouteTerminationTypeEdge: + case v1beta1.TLSRouteTerminationTypeEdge: tlsCfg = &routev1.TLSConfig{Termination: routev1.TLSTerminationEdge} - case v1alpha2.TLSRouteTerminationTypePassthrough: + case v1beta1.TLSRouteTerminationTypePassthrough: tlsCfg = &routev1.TLSConfig{Termination: routev1.TLSTerminationPassthrough} - case v1alpha2.TLSRouteTerminationTypeReencrypt: + case v1beta1.TLSRouteTerminationTypeReencrypt: tlsCfg = &routev1.TLSConfig{Termination: routev1.TLSTerminationReencrypt} default: // NOTE: if unsupported, end here. return nil, nil diff --git a/internal/manifests/collector/route_test.go b/internal/manifests/collector/route_test.go index 2826f2dd37..b7ec294e7b 100644 --- a/internal/manifests/collector/route_test.go +++ b/internal/manifests/collector/route_test.go @@ -25,7 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -36,10 +36,10 @@ func TestDesiredRoutes(t *testing.T) { params := manifests.Params{ Config: config.Config{}, Log: logger, - OtelCol: v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - Ingress: v1alpha2.Ingress{ - Type: v1alpha2.IngressType("unknown"), + OtelCol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressType("unknown"), }, }, }, @@ -54,13 +54,13 @@ func TestDesiredRoutes(t *testing.T) { params := manifests.Params{ Config: config.Config{}, Log: logger, - OtelCol: v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - Config: v1alpha2.Config{}, - Ingress: v1alpha2.Ingress{ - Type: v1alpha2.IngressTypeRoute, - Route: v1alpha2.OpenShiftRoute{ - Termination: v1alpha2.TLSRouteTerminationTypeInsecure, + OtelCol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + Config: v1beta1.Config{}, + Ingress: v1beta1.Ingress{ + Type: v1beta1.IngressTypeRoute, + Route: v1beta1.OpenShiftRoute{ + Termination: v1beta1.TLSRouteTerminationTypeInsecure, }, }, }, @@ -84,12 +84,12 @@ func TestDesiredRoutes(t *testing.T) { } params.OtelCol.Namespace = ns - params.OtelCol.Spec.Ingress = v1alpha2.Ingress{ - Type: v1alpha2.IngressTypeRoute, + params.OtelCol.Spec.Ingress = v1beta1.Ingress{ + Type: v1beta1.IngressTypeRoute, Hostname: hostname, Annotations: map[string]string{"some.key": "some.value"}, - Route: v1alpha2.OpenShiftRoute{ - Termination: v1alpha2.TLSRouteTerminationTypeInsecure, + Route: v1beta1.OpenShiftRoute{ + Termination: v1beta1.TLSRouteTerminationTypeInsecure, }, } @@ -134,11 +134,11 @@ func TestDesiredRoutes(t *testing.T) { } params.OtelCol.Namespace = "test" - params.OtelCol.Spec.Ingress = v1alpha2.Ingress{ + params.OtelCol.Spec.Ingress = v1beta1.Ingress{ Hostname: "example.com", - Type: v1alpha2.IngressTypeRoute, - Route: v1alpha2.OpenShiftRoute{ - Termination: v1alpha2.TLSRouteTerminationTypeInsecure, + Type: v1beta1.IngressTypeRoute, + Route: v1beta1.OpenShiftRoute{ + Termination: v1beta1.TLSRouteTerminationTypeInsecure, }, } @@ -156,10 +156,10 @@ func TestDesiredRoutes(t *testing.T) { } params.OtelCol.Namespace = "test" - params.OtelCol.Spec.Ingress = v1alpha2.Ingress{ - Type: v1alpha2.IngressTypeRoute, - Route: v1alpha2.OpenShiftRoute{ - Termination: v1alpha2.TLSRouteTerminationTypeInsecure, + params.OtelCol.Spec.Ingress = v1beta1.Ingress{ + Type: v1beta1.IngressTypeRoute, + Route: v1beta1.OpenShiftRoute{ + Termination: v1beta1.TLSRouteTerminationTypeInsecure, }, } diff --git a/internal/manifests/collector/service.go b/internal/manifests/collector/service.go index ffec4288c1..8ac13a3e6d 100644 --- a/internal/manifests/collector/service.go +++ b/internal/manifests/collector/service.go @@ -22,7 +22,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/adapters" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" @@ -120,7 +120,7 @@ func Service(params manifests.Params) (*corev1.Service, error) { // OpenShift uses HA proxy that uses appProtocol for its configuration. for i := range ports { h2c := "h2c" - if params.OtelCol.Spec.Ingress.Type == v1alpha2.IngressTypeRoute && ports[i].AppProtocol != nil && strings.EqualFold(*ports[i].AppProtocol, "grpc") { + if params.OtelCol.Spec.Ingress.Type == v1beta1.IngressTypeRoute && ports[i].AppProtocol != nil && strings.EqualFold(*ports[i].AppProtocol, "grpc") { ports[i].AppProtocol = &h2c } } @@ -152,7 +152,7 @@ func Service(params manifests.Params) (*corev1.Service, error) { } trafficPolicy := corev1.ServiceInternalTrafficPolicyCluster - if params.OtelCol.Spec.Mode == v1alpha2.ModeDaemonSet { + if params.OtelCol.Spec.Mode == v1beta1.ModeDaemonSet { trafficPolicy = corev1.ServiceInternalTrafficPolicyLocal } diff --git a/internal/manifests/collector/service_test.go b/internal/manifests/collector/service_test.go index 0878a7c03f..0498a071a8 100644 --- a/internal/manifests/collector/service_test.go +++ b/internal/manifests/collector/service_test.go @@ -24,7 +24,7 @@ import ( "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" ) @@ -156,8 +156,8 @@ func TestDesiredService(t *testing.T) { params := manifests.Params{ Config: config.Config{}, Log: logger, - OtelCol: v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{Config: v1alpha2.Config{}}, + OtelCol: v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{Config: v1beta1.Config{}}, }, } @@ -195,7 +195,7 @@ func TestDesiredService(t *testing.T) { params := deploymentParams() - params.OtelCol.Spec.Ingress.Type = v1alpha2.IngressTypeRoute + params.OtelCol.Spec.Ingress.Type = v1beta1.IngressTypeRoute actual, err := Service(params) ports := append(params.OtelCol.Spec.Ports, jaegerPort) @@ -214,7 +214,7 @@ func TestDesiredService(t *testing.T) { Port: 14250, AppProtocol: &grpc, } - p := paramsWithMode(v1alpha2.ModeDaemonSet) + p := paramsWithMode(v1beta1.ModeDaemonSet) ports := append(p.OtelCol.Spec.Ports, jaegerPorts) expected := serviceWithInternalTrafficPolicy("test-collector", ports, v1.ServiceInternalTrafficPolicyLocal) @@ -256,9 +256,9 @@ func TestMonitoringService(t *testing.T) { Port: 9090, }} params := deploymentParams() - params.OtelCol.Spec.Config = v1alpha2.Config{ - Service: v1alpha2.Service{ - Telemetry: &v1alpha2.AnyConfig{ + params.OtelCol.Spec.Config = v1beta1.Config{ + Service: v1beta1.Service{ + Telemetry: &v1beta1.AnyConfig{ Object: map[string]interface{}{ "metrics": map[string]interface{}{ "level": "detailed", diff --git a/internal/manifests/collector/serviceaccount.go b/internal/manifests/collector/serviceaccount.go index d5f481dea0..4ad29bf696 100644 --- a/internal/manifests/collector/serviceaccount.go +++ b/internal/manifests/collector/serviceaccount.go @@ -18,14 +18,14 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // ServiceAccountName returns the name of the existing or self-provisioned service account to use for the given instance. -func ServiceAccountName(instance v1alpha2.OpenTelemetryCollector) string { +func ServiceAccountName(instance v1beta1.OpenTelemetryCollector) string { if len(instance.Spec.ServiceAccount) == 0 { return naming.ServiceAccount(instance.Name) } diff --git a/internal/manifests/collector/serviceaccount_test.go b/internal/manifests/collector/serviceaccount_test.go index 7a66caf2f8..3a7c3ec351 100644 --- a/internal/manifests/collector/serviceaccount_test.go +++ b/internal/manifests/collector/serviceaccount_test.go @@ -20,13 +20,13 @@ import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" ) func TestServiceAccountNewDefault(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -41,12 +41,12 @@ func TestServiceAccountNewDefault(t *testing.T) { func TestServiceAccountOverride(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ ServiceAccount: "my-special-sa", }, }, diff --git a/internal/manifests/collector/servicemonitor.go b/internal/manifests/collector/servicemonitor.go index 02496e7898..f7cb6b9d70 100644 --- a/internal/manifests/collector/servicemonitor.go +++ b/internal/manifests/collector/servicemonitor.go @@ -22,7 +22,7 @@ import ( monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector/adapters" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -39,7 +39,7 @@ func ServiceMonitor(params manifests.Params) (*monitoringv1.ServiceMonitor, erro } var sm monitoringv1.ServiceMonitor - if params.OtelCol.Spec.Mode == v1alpha2.ModeSidecar { + if params.OtelCol.Spec.Mode == v1beta1.ModeSidecar { return nil, nil } sm = monitoringv1.ServiceMonitor{ @@ -73,7 +73,7 @@ func ServiceMonitor(params manifests.Params) (*monitoringv1.ServiceMonitor, erro return &sm, nil } -func endpointsFromConfig(logger logr.Logger, otelcol v1alpha2.OpenTelemetryCollector) []monitoringv1.Endpoint { +func endpointsFromConfig(logger logr.Logger, otelcol v1beta1.OpenTelemetryCollector) []monitoringv1.Endpoint { // TODO: https://github.com/open-telemetry/opentelemetry-operator/issues/2603 cfgStr, err := otelcol.Spec.Config.Yaml() if err != nil { diff --git a/internal/manifests/collector/statefulset_test.go b/internal/manifests/collector/statefulset_test.go index 36df6de3e3..0a9d822f29 100644 --- a/internal/manifests/collector/statefulset_test.go +++ b/internal/manifests/collector/statefulset_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" @@ -33,14 +33,14 @@ import ( func TestStatefulSetNewDefault(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Mode: "statefulset", - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Tolerations: testTolerationValues, }, }, @@ -109,13 +109,13 @@ func TestStatefulSetNewDefault(t *testing.T) { func TestStatefulSetReplicas(t *testing.T) { // prepare replicaInt := int32(3) - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Mode: "statefulset", - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Replicas: &replicaInt, }, }, @@ -138,13 +138,13 @@ func TestStatefulSetReplicas(t *testing.T) { func TestStatefulSetVolumeClaimTemplates(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Mode: "statefulset", - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ VolumeClaimTemplates: []corev1.PersistentVolumeClaim{{ ObjectMeta: metav1.ObjectMeta{ Name: "added-volume", @@ -184,12 +184,12 @@ func TestStatefulSetVolumeClaimTemplates(t *testing.T) { func TestStatefulSetPodAnnotations(t *testing.T) { // prepare testPodAnnotationValues := map[string]string{"annotation-key": "annotation-value"} - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodAnnotations: testPodAnnotationValues, }, }, @@ -226,12 +226,12 @@ func TestStatefulSetPodSecurityContext(t *testing.T) { runAsUser := int64(1337) runasGroup := int64(1338) - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PodSecurityContext: &v1.PodSecurityContext{ RunAsNonRoot: &runAsNonRoot, RunAsUser: &runAsUser, @@ -259,7 +259,7 @@ func TestStatefulSetPodSecurityContext(t *testing.T) { func TestStatefulSetHostNetwork(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -280,12 +280,12 @@ func TestStatefulSetHostNetwork(t *testing.T) { assert.Equal(t, d1.Spec.Template.Spec.DNSPolicy, v1.DNSClusterFirst) // Test hostNetwork=true - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-hostnetwork", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ HostNetwork: true, }, }, @@ -311,12 +311,12 @@ func TestStatefulSetFilterLabels(t *testing.T) { "app.foo.bar": "1", } - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Labels: excludedLabels, }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{}, + Spec: v1beta1.OpenTelemetryCollectorSpec{}, } cfg := config.New(config.WithLabelFilters([]string{"foo*", "app.*.bar"})) @@ -338,7 +338,7 @@ func TestStatefulSetFilterLabels(t *testing.T) { func TestStatefulSetNodeSelector(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -358,12 +358,12 @@ func TestStatefulSetNodeSelector(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.NodeSelector) // Test nodeSelector - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-nodeselector", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ HostNetwork: true, NodeSelector: map[string]string{ "node-key": "node-value", @@ -386,7 +386,7 @@ func TestStatefulSetNodeSelector(t *testing.T) { } func TestStatefulSetPriorityClassName(t *testing.T) { - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -406,12 +406,12 @@ func TestStatefulSetPriorityClassName(t *testing.T) { priorityClassName := "test-class" - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-priortyClassName", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ PriorityClassName: priorityClassName, }, }, @@ -431,7 +431,7 @@ func TestStatefulSetPriorityClassName(t *testing.T) { } func TestStatefulSetAffinity(t *testing.T) { - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -449,12 +449,12 @@ func TestStatefulSetAffinity(t *testing.T) { require.NoError(t, err) assert.Nil(t, sts1.Spec.Template.Spec.Affinity) - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-priortyClassName", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Affinity: testAffinityValue, }, }, @@ -476,13 +476,13 @@ func TestStatefulSetAffinity(t *testing.T) { func TestStatefulSetInitContainer(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ InitContainers: []v1.Container{ { Name: "test", @@ -512,7 +512,7 @@ func TestStatefulSetInitContainer(t *testing.T) { func TestStatefulSetTopologySpreadConstraints(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -531,12 +531,12 @@ func TestStatefulSetTopologySpreadConstraints(t *testing.T) { assert.Empty(t, s1.Spec.Template.Spec.TopologySpreadConstraints) // Test TopologySpreadConstraints - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-topologyspreadconstraint", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ TopologySpreadConstraints: testTopologySpreadConstraintValue, }, }, @@ -560,13 +560,13 @@ func TestStatefulSetTopologySpreadConstraints(t *testing.T) { func TestStatefulSetAdditionalContainers(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ AdditionalContainers: []v1.Container{ { Name: "test", @@ -597,7 +597,7 @@ func TestStatefulSetAdditionalContainers(t *testing.T) { func TestStatefulSetShareProcessNamespace(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -616,12 +616,12 @@ func TestStatefulSetShareProcessNamespace(t *testing.T) { assert.False(t, *d1.Spec.Template.Spec.ShareProcessNamespace) // Test shareProcessNamespace=true - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-with-shareprocessnamespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ ShareProcessNamespace: true, }, }, diff --git a/internal/manifests/collector/suite_test.go b/internal/manifests/collector/suite_test.go index 88975a4fdb..64593c7e5b 100644 --- a/internal/manifests/collector/suite_test.go +++ b/internal/manifests/collector/suite_test.go @@ -26,7 +26,7 @@ import ( "k8s.io/client-go/tools/record" logf "sigs.k8s.io/controller-runtime/pkg/log" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/autodetect/openshift" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" @@ -43,23 +43,23 @@ const ( ) func deploymentParams() manifests.Params { - return paramsWithMode(v1alpha2.ModeDeployment) + return paramsWithMode(v1beta1.ModeDeployment) } -func paramsWithMode(mode v1alpha2.Mode) manifests.Params { +func paramsWithMode(mode v1beta1.Mode) manifests.Params { replicas := int32(2) configYAML, err := os.ReadFile("testdata/test.yaml") if err != nil { fmt.Printf("Error getting yaml file: %v", err) } - cfg := v1alpha2.Config{} + cfg := v1beta1.Config{} err = go_yaml.Unmarshal(configYAML, &cfg) if err != nil { fmt.Printf("Error unmarshalling YAML: %v", err) } return manifests.Params{ Config: config.New(config.WithCollectorImage(defaultCollectorImage), config.WithTargetAllocatorImage(defaultTaAllocationImage)), - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ TypeMeta: metav1.TypeMeta{ Kind: "opentelemetry.io", APIVersion: "v1", @@ -69,8 +69,8 @@ func paramsWithMode(mode v1alpha2.Mode) manifests.Params { Namespace: "default", UID: instanceUID, }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.47.0", Ports: []v1.ServicePort{{ @@ -107,7 +107,7 @@ func newParams(taContainerImage string, file string) (manifests.Params, error) { return manifests.Params{}, fmt.Errorf("error getting yaml file: %w", err) } - colCfg := v1alpha2.Config{} + colCfg := v1beta1.Config{} err = go_yaml.Unmarshal(configYAML, &colCfg) if err != nil { return manifests.Params{}, fmt.Errorf("failed to unmarshal config: %w", err) @@ -121,7 +121,7 @@ func newParams(taContainerImage string, file string) (manifests.Params, error) { return manifests.Params{ Config: cfg, - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ TypeMeta: metav1.TypeMeta{ Kind: "opentelemetry.io", APIVersion: "v1", @@ -131,8 +131,8 @@ func newParams(taContainerImage string, file string) (manifests.Params, error) { Namespace: "default", UID: instanceUID, }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Ports: []v1.ServicePort{{ Name: "web", Port: 80, @@ -145,8 +145,8 @@ func newParams(taContainerImage string, file string) (manifests.Params, error) { Replicas: &replicas, }, - Mode: v1alpha2.ModeStatefulSet, - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + Mode: v1beta1.ModeStatefulSet, + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Image: taContainerImage, }, diff --git a/internal/manifests/collector/utils.go b/internal/manifests/collector/utils.go index 250e7dbcbd..da75763f0d 100644 --- a/internal/manifests/collector/utils.go +++ b/internal/manifests/collector/utils.go @@ -17,10 +17,10 @@ package collector import ( corev1 "k8s.io/api/core/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" ) -func getDNSPolicy(otelcol v1alpha2.OpenTelemetryCollector) corev1.DNSPolicy { +func getDNSPolicy(otelcol v1beta1.OpenTelemetryCollector) corev1.DNSPolicy { dnsPolicy := corev1.DNSClusterFirst if otelcol.Spec.HostNetwork { dnsPolicy = corev1.DNSClusterFirstWithHostNet diff --git a/internal/manifests/collector/volume.go b/internal/manifests/collector/volume.go index 634694c2a0..5cf82fde7a 100644 --- a/internal/manifests/collector/volume.go +++ b/internal/manifests/collector/volume.go @@ -18,13 +18,13 @@ package collector import ( corev1 "k8s.io/api/core/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // Volumes builds the volumes for the given instance, including the config map volume. -func Volumes(cfg config.Config, otelcol v1alpha2.OpenTelemetryCollector) []corev1.Volume { +func Volumes(cfg config.Config, otelcol v1beta1.OpenTelemetryCollector) []corev1.Volume { volumes := []corev1.Volume{{ Name: naming.ConfigMapVolume(), VolumeSource: corev1.VolumeSource{ diff --git a/internal/manifests/collector/volume_test.go b/internal/manifests/collector/volume_test.go index 9f355320d2..0101699ebf 100644 --- a/internal/manifests/collector/volume_test.go +++ b/internal/manifests/collector/volume_test.go @@ -21,7 +21,7 @@ import ( corev1 "k8s.io/api/core/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -29,7 +29,7 @@ import ( func TestVolumeNewDefault(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{} + otelcol := v1beta1.OpenTelemetryCollector{} cfg := config.New() // test @@ -44,9 +44,9 @@ func TestVolumeNewDefault(t *testing.T) { func TestVolumeAllowsMoreToBeAdded(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Volumes: []corev1.Volume{{ Name: "my-volume", }}, @@ -67,8 +67,8 @@ func TestVolumeAllowsMoreToBeAdded(t *testing.T) { func TestVolumeWithMoreConfigMaps(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ ConfigMaps: []v1alpha1.ConfigMapsSpec{{ Name: "configmap-test", MountPath: "/", diff --git a/internal/manifests/collector/volumeclaim.go b/internal/manifests/collector/volumeclaim.go index cd076cbcd1..d3c94ed6f3 100644 --- a/internal/manifests/collector/volumeclaim.go +++ b/internal/manifests/collector/volumeclaim.go @@ -18,12 +18,12 @@ package collector import ( corev1 "k8s.io/api/core/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" ) // VolumeClaimTemplates builds the volumeClaimTemplates for the given instance, // including the config map volume mount. -func VolumeClaimTemplates(otelcol v1alpha2.OpenTelemetryCollector) []corev1.PersistentVolumeClaim { +func VolumeClaimTemplates(otelcol v1beta1.OpenTelemetryCollector) []corev1.PersistentVolumeClaim { if otelcol.Spec.Mode != "statefulset" { return []corev1.PersistentVolumeClaim{} } diff --git a/internal/manifests/collector/volumeclaim_test.go b/internal/manifests/collector/volumeclaim_test.go index f848c98867..df34a41ab0 100644 --- a/internal/manifests/collector/volumeclaim_test.go +++ b/internal/manifests/collector/volumeclaim_test.go @@ -22,16 +22,16 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" . "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" ) func TestVolumeClaimAllowsUserToAdd(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Mode: "statefulset", - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ VolumeClaimTemplates: []corev1.PersistentVolumeClaim{{ ObjectMeta: metav1.ObjectMeta{ Name: "added-volume", @@ -65,10 +65,10 @@ func TestVolumeClaimAllowsUserToAdd(t *testing.T) { func TestVolumeClaimChecksForStatefulset(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ Mode: "daemonset", - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ VolumeClaimTemplates: []corev1.PersistentVolumeClaim{{ ObjectMeta: metav1.ObjectMeta{ Name: "added-volume", diff --git a/internal/manifests/params.go b/internal/manifests/params.go index 95a922a910..93a728e2ae 100644 --- a/internal/manifests/params.go +++ b/internal/manifests/params.go @@ -21,7 +21,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" ) @@ -31,7 +31,7 @@ type Params struct { Recorder record.EventRecorder Scheme *runtime.Scheme Log logr.Logger - OtelCol v1alpha2.OpenTelemetryCollector + OtelCol v1beta1.OpenTelemetryCollector OpAMPBridge v1alpha1.OpAMPBridge Config config.Config } diff --git a/internal/manifests/targetallocator/annotations.go b/internal/manifests/targetallocator/annotations.go index 8ad5b0d894..8d98e55a81 100644 --- a/internal/manifests/targetallocator/annotations.go +++ b/internal/manifests/targetallocator/annotations.go @@ -20,13 +20,13 @@ import ( v1 "k8s.io/api/core/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" ) const configMapHashAnnotationKey = "opentelemetry-targetallocator-config/hash" // Annotations returns the annotations for the TargetAllocator Pod. -func Annotations(instance v1alpha2.OpenTelemetryCollector, configMap *v1.ConfigMap) map[string]string { +func Annotations(instance v1beta1.OpenTelemetryCollector, configMap *v1.ConfigMap) map[string]string { // Make a copy of PodAnnotations to be safe annotations := make(map[string]string, len(instance.Spec.PodAnnotations)) for key, value := range instance.Spec.PodAnnotations { diff --git a/internal/manifests/targetallocator/annotations_test.go b/internal/manifests/targetallocator/annotations_test.go index bb5a839098..bcdb127e52 100644 --- a/internal/manifests/targetallocator/annotations_test.go +++ b/internal/manifests/targetallocator/annotations_test.go @@ -23,7 +23,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" ) @@ -58,7 +58,7 @@ func TestConfigMapHash(t *testing.T) { func TestInvalidConfigNoHash(t *testing.T) { instance := collectorInstance() - instance.Spec.Config = v1alpha2.Config{} + instance.Spec.Config = v1beta1.Config{} annotations := Annotations(instance, nil) require.NotContains(t, annotations, configMapHashAnnotationKey) } diff --git a/internal/manifests/targetallocator/configmap.go b/internal/manifests/targetallocator/configmap.go index e4ddb5182a..f4fe2be293 100644 --- a/internal/manifests/targetallocator/configmap.go +++ b/internal/manifests/targetallocator/configmap.go @@ -19,7 +19,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" @@ -64,7 +64,7 @@ func ConfigMap(params manifests.Params) (*corev1.ConfigMap, error) { if len(params.OtelCol.Spec.TargetAllocator.AllocationStrategy) > 0 { taConfig["allocation_strategy"] = params.OtelCol.Spec.TargetAllocator.AllocationStrategy } else { - taConfig["allocation_strategy"] = v1alpha2.TargetAllocatorAllocationStrategyConsistentHashing + taConfig["allocation_strategy"] = v1beta1.TargetAllocatorAllocationStrategyConsistentHashing } taConfig["filter_strategy"] = params.OtelCol.Spec.TargetAllocator.FilterStrategy diff --git a/internal/manifests/targetallocator/container.go b/internal/manifests/targetallocator/container.go index 53cbfc3a70..18848c7849 100644 --- a/internal/manifests/targetallocator/container.go +++ b/internal/manifests/targetallocator/container.go @@ -20,13 +20,13 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // Container builds a container for the given TargetAllocator. -func Container(cfg config.Config, logger logr.Logger, otelcol v1alpha2.OpenTelemetryCollector) corev1.Container { +func Container(cfg config.Config, logger logr.Logger, otelcol v1beta1.OpenTelemetryCollector) corev1.Container { image := otelcol.Spec.TargetAllocator.Image if len(image) == 0 { image = cfg.TargetAllocatorImage() diff --git a/internal/manifests/targetallocator/container_test.go b/internal/manifests/targetallocator/container_test.go index 9957740c9a..9efc93ca8f 100644 --- a/internal/manifests/targetallocator/container_test.go +++ b/internal/manifests/targetallocator/container_test.go @@ -25,7 +25,7 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" logf "sigs.k8s.io/controller-runtime/pkg/log" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) @@ -34,7 +34,7 @@ var logger = logf.Log.WithName("unit-tests") func TestContainerNewDefault(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{} + otelcol := v1beta1.OpenTelemetryCollector{} cfg := config.New(config.WithTargetAllocatorImage("default-image")) // test @@ -46,9 +46,9 @@ func TestContainerNewDefault(t *testing.T) { func TestContainerWithImageOverridden(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Image: "overridden-image", }, @@ -65,9 +65,9 @@ func TestContainerWithImageOverridden(t *testing.T) { func TestContainerPorts(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Image: "default-image", }, @@ -86,9 +86,9 @@ func TestContainerPorts(t *testing.T) { func TestContainerVolumes(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Image: "default-image", }, @@ -105,9 +105,9 @@ func TestContainerVolumes(t *testing.T) { } func TestContainerResourceRequirements(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Resources: corev1.ResourceRequirements{ Limits: corev1.ResourceList{ corev1.ResourceCPU: resource.MustParse("100m"), @@ -143,9 +143,9 @@ func TestContainerResourceRequirements(t *testing.T) { func TestContainerHasEnvVars(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Env: []corev1.EnvVar{ { @@ -228,9 +228,9 @@ func TestContainerHasProxyEnvVars(t *testing.T) { defer os.Unsetenv("NO_PROXY") // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Env: []corev1.EnvVar{ { @@ -254,9 +254,9 @@ func TestContainerHasProxyEnvVars(t *testing.T) { func TestContainerDoesNotOverrideEnvVars(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, Env: []corev1.EnvVar{ { @@ -320,9 +320,9 @@ func TestContainerDoesNotOverrideEnvVars(t *testing.T) { assert.Equal(t, expected, c) } func TestReadinessProbe(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, }, }, @@ -345,9 +345,9 @@ func TestReadinessProbe(t *testing.T) { } func TestLivenessProbe(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, }, }, @@ -375,9 +375,9 @@ func TestSecurityContext(t *testing.T) { RunAsNonRoot: &runAsNonRoot, } // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + otelcol := v1beta1.OpenTelemetryCollector{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Enabled: true, SecurityContext: securityContext, }, diff --git a/internal/manifests/targetallocator/deployment_test.go b/internal/manifests/targetallocator/deployment_test.go index 61efa1550f..96647bea3a 100644 --- a/internal/manifests/targetallocator/deployment_test.go +++ b/internal/manifests/targetallocator/deployment_test.go @@ -24,7 +24,7 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" ) @@ -78,7 +78,7 @@ var testSecurityContextValue = &v1.PodSecurityContext{ func TestDeploymentSecurityContext(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -98,12 +98,12 @@ func TestDeploymentSecurityContext(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.SecurityContext) // Test SecurityContext - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-securitycontext", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ PodSecurityContext: testSecurityContextValue, }, }, @@ -175,27 +175,27 @@ func TestDeploymentPodAnnotations(t *testing.T) { assert.Subset(t, ds.Spec.Template.Annotations, testPodAnnotationValues) } -func collectorInstance() v1alpha2.OpenTelemetryCollector { +func collectorInstance() v1beta1.OpenTelemetryCollector { configYAML, err := os.ReadFile("testdata/test.yaml") if err != nil { fmt.Printf("Error getting yaml file: %v", err) } - cfg := v1alpha2.Config{} + cfg := v1beta1.Config{} err = go_yaml.Unmarshal(configYAML, &cfg) if err != nil { fmt.Printf("Error unmarshalling YAML: %v", err) } - return v1alpha2.OpenTelemetryCollector{ + return v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "default", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Image: "ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator:0.47.0", }, Config: cfg, - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Image: "ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-targetallocator:0.47.0", FilterStrategy: "relabel-config", }, @@ -205,7 +205,7 @@ func collectorInstance() v1alpha2.OpenTelemetryCollector { func TestDeploymentNodeSelector(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -223,12 +223,12 @@ func TestDeploymentNodeSelector(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.NodeSelector) // Test nodeSelector - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-nodeselector", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ NodeSelector: map[string]string{ "node-key": "node-value", }, @@ -250,7 +250,7 @@ func TestDeploymentNodeSelector(t *testing.T) { } func TestDeploymentAffinity(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -268,12 +268,12 @@ func TestDeploymentAffinity(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.Affinity) // Test affinity - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-affinity", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Affinity: testAffinityValue, }, }, @@ -294,7 +294,7 @@ func TestDeploymentAffinity(t *testing.T) { func TestDeploymentTolerations(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -312,12 +312,12 @@ func TestDeploymentTolerations(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.Tolerations) // Test Tolerations - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-toleration", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ Tolerations: testTolerationValues, }, }, @@ -338,7 +338,7 @@ func TestDeploymentTolerations(t *testing.T) { func TestDeploymentTopologySpreadConstraints(t *testing.T) { // Test default - otelcol1 := v1alpha2.OpenTelemetryCollector{ + otelcol1 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -357,12 +357,12 @@ func TestDeploymentTopologySpreadConstraints(t *testing.T) { assert.Empty(t, d1.Spec.Template.Spec.TopologySpreadConstraints) // Test TopologySpreadConstraints - otelcol2 := v1alpha2.OpenTelemetryCollector{ + otelcol2 := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance-topologyspreadconstraint", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ TopologySpreadConstraints: testTopologySpreadConstraintValue, }, }, diff --git a/internal/manifests/targetallocator/labels.go b/internal/manifests/targetallocator/labels.go index f2b87c1c0e..09a43e4108 100644 --- a/internal/manifests/targetallocator/labels.go +++ b/internal/manifests/targetallocator/labels.go @@ -15,18 +15,18 @@ package targetallocator import ( - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/manifestutils" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // Labels return the common labels to all TargetAllocator objects that are part of a managed OpenTelemetryCollector. -func Labels(instance v1alpha2.OpenTelemetryCollector, name string) map[string]string { +func Labels(instance v1beta1.OpenTelemetryCollector, name string) map[string]string { return manifestutils.Labels(instance.ObjectMeta, name, instance.Spec.TargetAllocator.Image, ComponentOpenTelemetryTargetAllocator, nil) } // SelectorLabels return the selector labels for Target Allocator Pods. -func SelectorLabels(instance v1alpha2.OpenTelemetryCollector) map[string]string { +func SelectorLabels(instance v1beta1.OpenTelemetryCollector) map[string]string { selectorLabels := manifestutils.SelectorLabels(instance.ObjectMeta, ComponentOpenTelemetryTargetAllocator) // TargetAllocator uses the name label as well for selection // This is inconsistent with the Collector, but changing is a somewhat painful breaking change diff --git a/internal/manifests/targetallocator/labels_test.go b/internal/manifests/targetallocator/labels_test.go index d029dd5a97..382835d532 100644 --- a/internal/manifests/targetallocator/labels_test.go +++ b/internal/manifests/targetallocator/labels_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) @@ -31,7 +31,7 @@ const ( func TestLabelsCommonSet(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, @@ -50,7 +50,7 @@ func TestLabelsCommonSet(t *testing.T) { func TestLabelsPropagateDown(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Labels: map[string]string{ "myapp": "mycomponent", @@ -70,7 +70,7 @@ func TestLabelsPropagateDown(t *testing.T) { func TestSelectorLabels(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, diff --git a/internal/manifests/targetallocator/poddisruptionbudget.go b/internal/manifests/targetallocator/poddisruptionbudget.go index ed4a441500..f4e93869cc 100644 --- a/internal/manifests/targetallocator/poddisruptionbudget.go +++ b/internal/manifests/targetallocator/poddisruptionbudget.go @@ -17,7 +17,7 @@ package targetallocator import ( "fmt" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -35,7 +35,7 @@ func PodDisruptionBudget(params manifests.Params) (*policyV1.PodDisruptionBudget // defaulter doesn't set PodDisruptionBudget if the strategy isn't valid, // if PodDisruptionBudget != nil and stategy isn't correct, users have set // it wrongly - if params.OtelCol.Spec.TargetAllocator.AllocationStrategy != v1alpha2.TargetAllocatorAllocationStrategyConsistentHashing { + if params.OtelCol.Spec.TargetAllocator.AllocationStrategy != v1beta1.TargetAllocatorAllocationStrategyConsistentHashing { params.Log.V(4).Info("current allocation strategy not compatible, skipping podDisruptionBudget creation") return nil, fmt.Errorf("target allocator pdb has been configured but the allocation strategy isn't not compatible") } diff --git a/internal/manifests/targetallocator/poddisruptionbudget_test.go b/internal/manifests/targetallocator/poddisruptionbudget_test.go index 88a3097a1c..f15e552a69 100644 --- a/internal/manifests/targetallocator/poddisruptionbudget_test.go +++ b/internal/manifests/targetallocator/poddisruptionbudget_test.go @@ -21,7 +21,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" ) @@ -66,17 +66,17 @@ var tests = []test{ func TestPDBWithValidStrategy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ - PodDisruptionBudget: &v1alpha2.PodDisruptionBudgetSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: test.MinAvailable, MaxUnavailable: test.MaxUnavailable, }, - AllocationStrategy: v1alpha2.TargetAllocatorAllocationStrategyConsistentHashing, + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyConsistentHashing, }, }, } @@ -100,17 +100,17 @@ func TestPDBWithValidStrategy(t *testing.T) { func TestPDBWithNotValidStrategy(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ - PodDisruptionBudget: &v1alpha2.PodDisruptionBudgetSpec{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ + PodDisruptionBudget: &v1beta1.PodDisruptionBudgetSpec{ MinAvailable: test.MinAvailable, MaxUnavailable: test.MaxUnavailable, }, - AllocationStrategy: v1alpha2.TargetAllocatorAllocationStrategyLeastWeighted, + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyLeastWeighted, }, }, } @@ -129,13 +129,13 @@ func TestPDBWithNotValidStrategy(t *testing.T) { } func TestNoPDB(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ - AllocationStrategy: v1alpha2.TargetAllocatorAllocationStrategyLeastWeighted, + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ + AllocationStrategy: v1beta1.TargetAllocatorAllocationStrategyLeastWeighted, }, }, } diff --git a/internal/manifests/targetallocator/serviceaccount.go b/internal/manifests/targetallocator/serviceaccount.go index d9e0b1d3e6..6d29796c09 100644 --- a/internal/manifests/targetallocator/serviceaccount.go +++ b/internal/manifests/targetallocator/serviceaccount.go @@ -18,13 +18,13 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // ServiceAccountName returns the name of the existing or self-provisioned service account to use for the given instance. -func ServiceAccountName(instance v1alpha2.OpenTelemetryCollector) string { +func ServiceAccountName(instance v1beta1.OpenTelemetryCollector) string { if len(instance.Spec.TargetAllocator.ServiceAccount) == 0 { return naming.TargetAllocatorServiceAccount(instance.Name) } diff --git a/internal/manifests/targetallocator/serviceaccount_test.go b/internal/manifests/targetallocator/serviceaccount_test.go index bf31c21422..4d469f2e9c 100644 --- a/internal/manifests/targetallocator/serviceaccount_test.go +++ b/internal/manifests/targetallocator/serviceaccount_test.go @@ -21,13 +21,13 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" ) func TestServiceAccountDefaultName(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -42,12 +42,12 @@ func TestServiceAccountDefaultName(t *testing.T) { func TestServiceAccountOverrideName(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ ServiceAccount: "my-special-sa", }, }, @@ -62,7 +62,7 @@ func TestServiceAccountOverrideName(t *testing.T) { func TestServiceAccountDefault(t *testing.T) { params := manifests.Params{ - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, @@ -86,12 +86,12 @@ func TestServiceAccountDefault(t *testing.T) { func TestServiceAccountOverride(t *testing.T) { params := manifests.Params{ - OtelCol: v1alpha2.OpenTelemetryCollector{ + OtelCol: v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - TargetAllocator: v1alpha2.TargetAllocatorEmbedded{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + TargetAllocator: v1beta1.TargetAllocatorEmbedded{ ServiceAccount: "my-special-sa", }, }, diff --git a/internal/manifests/targetallocator/servicemonitor_test.go b/internal/manifests/targetallocator/servicemonitor_test.go index acb704a102..ac5027e5ac 100644 --- a/internal/manifests/targetallocator/servicemonitor_test.go +++ b/internal/manifests/targetallocator/servicemonitor_test.go @@ -20,7 +20,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests" @@ -28,16 +28,16 @@ import ( ) func TestDesiredServiceMonitors(t *testing.T) { - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "my-instance", Namespace: "my-namespace", }, - Spec: v1alpha2.OpenTelemetryCollectorSpec{ - OpenTelemetryCommonFields: v1alpha2.OpenTelemetryCommonFields{ + Spec: v1beta1.OpenTelemetryCollectorSpec{ + OpenTelemetryCommonFields: v1beta1.OpenTelemetryCommonFields{ Tolerations: testTolerationValues, }, - Mode: v1alpha2.ModeStatefulSet, + Mode: v1beta1.ModeStatefulSet, }, } cfg := config.New() diff --git a/internal/manifests/targetallocator/volume.go b/internal/manifests/targetallocator/volume.go index e52a57297f..ee649e10d8 100644 --- a/internal/manifests/targetallocator/volume.go +++ b/internal/manifests/targetallocator/volume.go @@ -17,13 +17,13 @@ package targetallocator import ( corev1 "k8s.io/api/core/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) // Volumes builds the volumes for the given instance, including the config map volume. -func Volumes(cfg config.Config, otelcol v1alpha2.OpenTelemetryCollector) []corev1.Volume { +func Volumes(cfg config.Config, otelcol v1beta1.OpenTelemetryCollector) []corev1.Volume { volumes := []corev1.Volume{{ Name: naming.TAConfigMapVolume(), VolumeSource: corev1.VolumeSource{ diff --git a/internal/manifests/targetallocator/volume_test.go b/internal/manifests/targetallocator/volume_test.go index 76da542d12..3aecc91136 100644 --- a/internal/manifests/targetallocator/volume_test.go +++ b/internal/manifests/targetallocator/volume_test.go @@ -19,14 +19,14 @@ import ( "github.com/stretchr/testify/assert" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" ) func TestVolumeNewDefault(t *testing.T) { // prepare - otelcol := v1alpha2.OpenTelemetryCollector{} + otelcol := v1beta1.OpenTelemetryCollector{} cfg := config.New() // test diff --git a/internal/status/collector/handle.go b/internal/status/collector/handle.go index d1f1331aed..9620d37975 100644 --- a/internal/status/collector/handle.go +++ b/internal/status/collector/handle.go @@ -39,7 +39,7 @@ const ( // HandleReconcileStatus handles updating the status of the CRDs managed by the operator. // TODO: make the status more useful https://github.com/open-telemetry/opentelemetry-operator/issues/1972 -// TODO: update status to use v1alpha2 https://github.com/open-telemetry/opentelemetry-operator/milestone/4 +// TODO: update status to use v1beta1 https://github.com/open-telemetry/opentelemetry-operator/milestone/4 func HandleReconcileStatus(ctx context.Context, log logr.Logger, params manifests.Params, otelcol v1alpha1.OpenTelemetryCollector, err error) (ctrl.Result, error) { log.V(2).Info("updating collector status") if err != nil { diff --git a/kuttl-test-autoscale.yaml b/kuttl-test-autoscale.yaml deleted file mode 100644 index 9f97b6ce4c..0000000000 --- a/kuttl-test-autoscale.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -artifactsDir: ./tests/_build/artifacts/ -testDirs: - - ./tests/e2e-autoscale/ -timeout: 300 diff --git a/kuttl-test-instrumentation.yaml b/kuttl-test-instrumentation.yaml deleted file mode 100644 index 545357c420..0000000000 --- a/kuttl-test-instrumentation.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -testDirs: - - ./tests/e2e-instrumentation/ -timeout: 300 diff --git a/kuttl-test-multi-instr.yaml b/kuttl-test-multi-instr.yaml deleted file mode 100644 index 62d26978c2..0000000000 --- a/kuttl-test-multi-instr.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -artifactsDir: ./tests/_build/artifacts/ -testDirs: - - ./tests/e2e-multi-instrumentation/ -timeout: 300 diff --git a/kuttl-test-opampbridge.yaml b/kuttl-test-opampbridge.yaml deleted file mode 100644 index f658ce15ac..0000000000 --- a/kuttl-test-opampbridge.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -artifactsDir: ./tests/_build/artifacts/ -testDirs: - - ./tests/e2e-opampbridge/ -timeout: 300 diff --git a/kuttl-test-openshift.yaml b/kuttl-test-openshift.yaml deleted file mode 100644 index 24fc7da7a4..0000000000 --- a/kuttl-test-openshift.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -startKIND: false -testDirs: - - ./tests/e2e-openshift/ -timeout: 300 diff --git a/kuttl-test-pdb.yaml b/kuttl-test-pdb.yaml deleted file mode 100644 index 68034a0a57..0000000000 --- a/kuttl-test-pdb.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -artifactsDir: ./tests/_build/artifacts/ -testDirs: - - ./tests/e2e-pdb/ -timeout: 300 diff --git a/kuttl-test-prometheuscr.yaml b/kuttl-test-prometheuscr.yaml deleted file mode 100644 index e3e48a910e..0000000000 --- a/kuttl-test-prometheuscr.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Make sure that the OT operator after upgrading itself, can upgrade the OT collectors without error. -# The test is based on the version v0.49.0, a breaking change was introduced from PR -# https://github.com/open-telemetry/opentelemetry-operator/pull/797, which added a version label "app.kubernetes.io/version", -# The version label would change between OT operator upgrade, and since at the time, the collector pod selector was the same -# as this labels, resulted in selector being modified during reconciliation which caused error due to the selector is immutable. -# Please be aware of that the collector labels are changeable in various ways, so this issue may happen in any operator < v0.52.0 -# which changed the selector to be a static set of labels. -# The fix for this issue including: -# https://github.com/open-telemetry/opentelemetry-operator/issues/840, make the selector be a static set of labels; -# https://github.com/open-telemetry/opentelemetry-operator/issues/1117, delete the old collector to let the operator -# create a new one when the selector changed. -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -testDirs: - - ./tests/e2e-prometheuscr/ -timeout: 300 diff --git a/kuttl-test-targetallocator.yaml b/kuttl-test-targetallocator.yaml deleted file mode 100644 index eca8f5336e..0000000000 --- a/kuttl-test-targetallocator.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -artifactsDir: ./tests/_build/artifacts/ -testDirs: - - ./tests/e2e-targetallocator/ -timeout: 600 diff --git a/kuttl-test-upgrade.yaml b/kuttl-test-upgrade.yaml deleted file mode 100644 index 0c4f7e7d8b..0000000000 --- a/kuttl-test-upgrade.yaml +++ /dev/null @@ -1,19 +0,0 @@ -# Make sure that the OT operator after upgrading itself, can upgrade the OT collectors without error. -# The test is based on the version v0.49.0, a breaking change was introduced from PR -# https://github.com/open-telemetry/opentelemetry-operator/pull/797, which added a version label "app.kubernetes.io/version", -# The version label would change between OT operator upgrade, and since at the time, the collector pod selector was the same -# as this labels, resulted in selector being modified during reconciliation which caused error due to the selector is immutable. -# Please be aware of that the collector labels are changeable in various ways, so this issue may happen in any operator < v0.52.0 -# which changed the selector to be a static set of labels. -# The fix for this issue including: -# https://github.com/open-telemetry/opentelemetry-operator/issues/840, make the selector be a static set of labels; -# https://github.com/open-telemetry/opentelemetry-operator/issues/1117, delete the old collector to let the operator -# create a new one when the selector changed. -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -commands: - - command: kubectl apply -f ./tests/e2e-upgrade/upgrade-test/opentelemetry-operator-v0.86.0.yaml - - command: go run hack/check-operator-ready.go -testDirs: - - ./tests/e2e-upgrade/ -timeout: 300 diff --git a/kuttl-test.yaml b/kuttl-test.yaml deleted file mode 100644 index 99899bb10d..0000000000 --- a/kuttl-test.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestSuite -artifactsDir: ./tests/_build/artifacts/ -testDirs: - - ./tests/e2e/ -timeout: 300 -parallel: 4 diff --git a/main.go b/main.go index 074e3905d2..00fa43240c 100644 --- a/main.go +++ b/main.go @@ -104,6 +104,7 @@ func main() { pprofAddr string enableLeaderElection bool createRBACPermissions bool + enableMultiInstrumentation bool collectorImage string targetAllocatorImage string operatorOpAMPBridgeImage string @@ -126,6 +127,7 @@ func main() { "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") pflag.BoolVar(&createRBACPermissions, "create-rbac-permissions", false, "Automatically create RBAC permissions needed by the processors") + pflag.BoolVar(&enableMultiInstrumentation, "enable-multi-instrumentation", false, "Controls whether the operator supports multi instrumentation") stringFlagOrEnv(&collectorImage, "collector-image", "RELATED_IMAGE_COLLECTOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.") stringFlagOrEnv(&targetAllocatorImage, "target-allocator-image", "RELATED_IMAGE_TARGET_ALLOCATOR", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/target-allocator:%s", v.TargetAllocator), "The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource.") stringFlagOrEnv(&operatorOpAMPBridgeImage, "operator-opamp-bridge-image", "RELATED_IMAGE_OPERATOR_OPAMP_BRIDGE", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-operator/operator-opamp-bridge:%s", v.OperatorOpAMPBridge), "The default OpenTelemetry Operator OpAMP Bridge image. This image is used when no image is specified in the CustomResource.") @@ -163,6 +165,7 @@ func main() { "go-arch", runtime.GOARCH, "go-os", runtime.GOOS, "labels-filter", labelsFilter, + "enable-multi-instrumentation", enableMultiInstrumentation, ) restConfig := ctrl.GetConfigOrDie() @@ -179,6 +182,7 @@ func main() { config.WithVersion(v), config.WithCollectorImage(collectorImage), config.WithCreateRBACPermissions(createRBACPermissions), + config.WithEnableMultiInstrumentation(enableMultiInstrumentation), config.WithTargetAllocatorImage(targetAllocatorImage), config.WithOperatorOpAMPBridgeImage(operatorOpAMPBridgeImage), config.WithAutoInstrumentationJavaImage(autoInstrumentationJava), @@ -292,7 +296,7 @@ func main() { Handler: podmutation.NewWebhookHandler(cfg, ctrl.Log.WithName("pod-webhook"), decoder, mgr.GetClient(), []podmutation.PodMutator{ sidecar.NewMutator(logger, cfg, mgr.GetClient()), - instrumentation.NewMutator(logger, mgr.GetClient(), mgr.GetEventRecorderFor("opentelemetry-operator")), + instrumentation.NewMutator(logger, mgr.GetClient(), mgr.GetEventRecorderFor("opentelemetry-operator"), cfg), }), }) diff --git a/pkg/instrumentation/golang.go b/pkg/instrumentation/golang.go index 2ae2e62379..793d45b3f8 100644 --- a/pkg/instrumentation/golang.go +++ b/pkg/instrumentation/golang.go @@ -21,7 +21,7 @@ import ( corev1 "k8s.io/api/core/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/pkg/featuregate" + "github.com/open-telemetry/opentelemetry-operator/internal/config" ) const ( @@ -31,7 +31,7 @@ const ( kernelDebugVolumePath = "/sys/kernel/debug" ) -func injectGoSDK(goSpec v1alpha1.Go, pod corev1.Pod) (corev1.Pod, error) { +func injectGoSDK(goSpec v1alpha1.Go, pod corev1.Pod, cfg config.Config) (corev1.Pod, error) { // skip instrumentation if share process namespaces is explicitly disabled if pod.Spec.ShareProcessNamespace != nil && !*pod.Spec.ShareProcessNamespace { return pod, fmt.Errorf("shared process namespace has been explicitly disabled") @@ -40,7 +40,7 @@ func injectGoSDK(goSpec v1alpha1.Go, pod corev1.Pod) (corev1.Pod, error) { // skip instrumentation when more than one containers provided containerNames := "" ok := false - if featuregate.EnableMultiInstrumentationSupport.IsEnabled() { + if cfg.EnableMultiInstrumentation() { containerNames, ok = pod.Annotations[annotationInjectGoContainersName] } else { containerNames, ok = pod.Annotations[annotationInjectContainerName] diff --git a/pkg/instrumentation/golang_test.go b/pkg/instrumentation/golang_test.go index 9cade61da9..8f0ba0f237 100644 --- a/pkg/instrumentation/golang_test.go +++ b/pkg/instrumentation/golang_test.go @@ -19,13 +19,11 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - colfeaturegate "go.opentelemetry.io/collector/featuregate" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/pkg/featuregate" + "github.com/open-telemetry/opentelemetry-operator/internal/config" ) func TestInjectGoSDK(t *testing.T) { @@ -36,10 +34,10 @@ func TestInjectGoSDK(t *testing.T) { tests := []struct { name string v1alpha1.Go - pod corev1.Pod - expected corev1.Pod - err error - setFeatureGates func(t *testing.T) + pod corev1.Pod + expected corev1.Pod + err error + config config.Config }{ { name: "shared process namespace disabled", @@ -73,14 +71,8 @@ func TestInjectGoSDK(t *testing.T) { }, }, }, - err: fmt.Errorf("go instrumentation cannot be injected into a pod, multiple containers configured"), - setFeatureGates: func(t *testing.T) { - originalVal := featuregate.EnableMultiInstrumentationSupport.IsEnabled() - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), true)) - t.Cleanup(func() { - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), originalVal)) - }) - }, + err: fmt.Errorf("go instrumentation cannot be injected into a pod, multiple containers configured"), + config: config.New(config.WithEnableMultiInstrumentation(true)), }, { name: "using container-names", @@ -287,10 +279,7 @@ func TestInjectGoSDK(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - if test.setFeatureGates != nil { - test.setFeatureGates(t) - } - pod, err := injectGoSDK(test.Go, test.pod) + pod, err := injectGoSDK(test.Go, test.pod, test.config) assert.Equal(t, test.expected, pod) assert.Equal(t, test.err, err) }) diff --git a/pkg/instrumentation/podmutator.go b/pkg/instrumentation/podmutator.go index 0a7878ae19..529ffaa1c5 100644 --- a/pkg/instrumentation/podmutator.go +++ b/pkg/instrumentation/podmutator.go @@ -27,6 +27,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" + "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/webhook/podmutation" "github.com/open-telemetry/opentelemetry-operator/pkg/featuregate" ) @@ -41,6 +42,7 @@ type instPodMutator struct { sdkInjector *sdkInjector Logger logr.Logger Recorder record.EventRecorder + config config.Config } type instrumentationWithContainers struct { @@ -193,7 +195,7 @@ func (langInsts *languageInstrumentations) setInstrumentationLanguageContainers( var _ podmutation.PodMutator = (*instPodMutator)(nil) -func NewMutator(logger logr.Logger, client client.Client, recorder record.EventRecorder) *instPodMutator { +func NewMutator(logger logr.Logger, client client.Client, recorder record.EventRecorder, cfg config.Config) *instPodMutator { return &instPodMutator{ Logger: logger, Client: client, @@ -202,6 +204,7 @@ func NewMutator(logger logr.Logger, client client.Client, recorder record.EventR client: client, }, Recorder: recorder, + config: cfg, } } @@ -323,7 +326,7 @@ func (pm *instPodMutator) Mutate(ctx context.Context, ns corev1.Namespace, pod c } // We retrieve the annotation for podname - if featuregate.EnableMultiInstrumentationSupport.IsEnabled() { + if pm.config.EnableMultiInstrumentation() { // We use annotations specific for instrumentation language insts.Java.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectJavaContainersName) insts.NodeJS.Containers = annotationValue(ns.ObjectMeta, pod.ObjectMeta, annotationInjectNodeJSContainersName) @@ -357,7 +360,7 @@ func (pm *instPodMutator) Mutate(ctx context.Context, ns corev1.Namespace, pod c // once it's been determined that instrumentation is desired, none exists yet, and we know which instance it should talk to, // we should inject the instrumentation. modifiedPod := pod - modifiedPod = pm.sdkInjector.inject(ctx, insts, ns, modifiedPod) + modifiedPod = pm.sdkInjector.inject(ctx, insts, ns, modifiedPod, pm.config) return modifiedPod, nil } diff --git a/pkg/instrumentation/podmutator_test.go b/pkg/instrumentation/podmutator_test.go index 7e764abf07..3631cbfeb0 100644 --- a/pkg/instrumentation/podmutator_test.go +++ b/pkg/instrumentation/podmutator_test.go @@ -28,12 +28,11 @@ import ( "k8s.io/client-go/tools/record" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" + "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/pkg/featuregate" ) func TestMutatePod(t *testing.T) { - mutator := NewMutator(logr.Discard(), k8sClient, record.NewFakeRecorder(100)) - require.NotNil(t, mutator) true := true zero := int64(0) @@ -46,6 +45,7 @@ func TestMutatePod(t *testing.T) { inst v1alpha1.Instrumentation ns corev1.Namespace setFeatureGates func(t *testing.T) + config config.Config }{ { name: "javaagent injection, true", @@ -2509,16 +2509,13 @@ func TestMutatePod(t *testing.T) { }, }, }, + config: config.New(config.WithEnableMultiInstrumentation(true)), setFeatureGates: func(t *testing.T) { originalVal := featuregate.EnableGoAutoInstrumentationSupport.IsEnabled() - mtVal := featuregate.EnableMultiInstrumentationSupport.IsEnabled() - - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), true)) require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableGoAutoInstrumentationSupport.ID(), true)) t.Cleanup(func() { require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableGoAutoInstrumentationSupport.ID(), originalVal)) - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), mtVal)) }) }, @@ -3860,13 +3857,7 @@ func TestMutatePod(t *testing.T) { }, }, }, - setFeatureGates: func(t *testing.T) { - originalVal := featuregate.EnableMultiInstrumentationSupport.IsEnabled() - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), true)) - t.Cleanup(func() { - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), originalVal)) - }) - }, + config: config.New(config.WithEnableMultiInstrumentation(true)), }, { name: "multi instrumentation for multiple containers feature gate enabled, container-names not used", @@ -4524,13 +4515,7 @@ func TestMutatePod(t *testing.T) { }, }, }, - setFeatureGates: func(t *testing.T) { - originalVal := featuregate.EnableMultiInstrumentationSupport.IsEnabled() - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), true)) - t.Cleanup(func() { - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), originalVal)) - }) - }, + config: config.New(config.WithEnableMultiInstrumentation(true)), }, { name: "multi instrumentation for multiple containers feature gate disabled, multiple instrumentation annotations set", @@ -4684,13 +4669,7 @@ func TestMutatePod(t *testing.T) { }, }, }, - setFeatureGates: func(t *testing.T) { - originalVal := featuregate.EnableMultiInstrumentationSupport.IsEnabled() - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), false)) - t.Cleanup(func() { - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), originalVal)) - }) - }, + config: config.New(config.WithEnableMultiInstrumentation(false)), }, { name: "multi instrumentation feature gate enabled, multiple instrumentation annotations set, no containers", @@ -4834,13 +4813,7 @@ func TestMutatePod(t *testing.T) { }, }, }, - setFeatureGates: func(t *testing.T) { - originalVal := featuregate.EnableMultiInstrumentationSupport.IsEnabled() - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), true)) - t.Cleanup(func() { - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), originalVal)) - }) - }, + config: config.New(config.WithEnableMultiInstrumentation(true)), }, { name: "multi instrumentation feature gate enabled, single instrumentation annotation set, no containers", @@ -5019,13 +4992,7 @@ func TestMutatePod(t *testing.T) { }, }, }, - setFeatureGates: func(t *testing.T) { - originalVal := featuregate.EnableMultiInstrumentationSupport.IsEnabled() - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), true)) - t.Cleanup(func() { - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), originalVal)) - }) - }, + config: config.New(config.WithEnableMultiInstrumentation(true)), }, { name: "multi instrumentation feature gate disabled, instrumentation feature gate disabled and annotation set, multiple specific containers set", @@ -5125,13 +5092,11 @@ func TestMutatePod(t *testing.T) { }, }, }, + config: config.New(config.WithEnableMultiInstrumentation(true)), setFeatureGates: func(t *testing.T) { - originalValMultiInstr := featuregate.EnableMultiInstrumentationSupport.IsEnabled() - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), true)) originalValDotNetInstr := featuregate.EnableDotnetAutoInstrumentationSupport.IsEnabled() require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableDotnetAutoInstrumentationSupport.ID(), false)) t.Cleanup(func() { - require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableMultiInstrumentationSupport.ID(), originalValMultiInstr)) require.NoError(t, colfeaturegate.GlobalRegistry().Set(featuregate.EnableDotnetAutoInstrumentationSupport.ID(), originalValDotNetInstr)) }) }, @@ -5141,6 +5106,8 @@ func TestMutatePod(t *testing.T) { for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { + mutator := NewMutator(logr.Discard(), k8sClient, record.NewFakeRecorder(100), test.config) + require.NotNil(t, mutator) if test.setFeatureGates != nil { test.setFeatureGates(t) } diff --git a/pkg/instrumentation/sdk.go b/pkg/instrumentation/sdk.go index 0f6de945fe..34a383e3e6 100644 --- a/pkg/instrumentation/sdk.go +++ b/pkg/instrumentation/sdk.go @@ -25,6 +25,7 @@ import ( "github.com/go-logr/logr" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" + "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/pkg/constants" "go.opentelemetry.io/otel/attribute" @@ -52,7 +53,7 @@ type sdkInjector struct { logger logr.Logger } -func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations, ns corev1.Namespace, pod corev1.Pod) corev1.Pod { +func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations, ns corev1.Namespace, pod corev1.Pod, cfg config.Config) corev1.Pod { if len(pod.Spec.Containers) < 1 { return pod } @@ -143,7 +144,7 @@ func (i *sdkInjector) inject(ctx context.Context, insts languageInstrumentations // Go instrumentation supports only single container instrumentation. index := getContainerIndex(goContainers, pod) - pod, err = injectGoSDK(otelinst.Spec.Go, pod) + pod, err = injectGoSDK(otelinst.Spec.Go, pod, cfg) if err != nil { i.logger.Info("Skipping Go SDK injection", "reason", err.Error(), "container", pod.Spec.Containers[index].Name) } else { diff --git a/pkg/instrumentation/sdk_test.go b/pkg/instrumentation/sdk_test.go index 013a5ffc37..7851879fe3 100644 --- a/pkg/instrumentation/sdk_test.go +++ b/pkg/instrumentation/sdk_test.go @@ -29,6 +29,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" + "github.com/open-telemetry/opentelemetry-operator/internal/config" ) var defaultVolumeLimitSize = resource.MustParse("200Mi") @@ -506,6 +507,7 @@ func TestInjectJava(t *testing.T) { inj := sdkInjector{ logger: logr.Discard(), } + config := config.New() pod := inj.inject(context.Background(), insts, corev1.Namespace{}, corev1.Pod{ @@ -517,7 +519,7 @@ func TestInjectJava(t *testing.T) { }, }, }, - }) + }, config) assert.Equal(t, corev1.Pod{ Spec: corev1.PodSpec{ Volumes: []corev1.Volume{ @@ -610,6 +612,7 @@ func TestInjectNodeJS(t *testing.T) { inj := sdkInjector{ logger: logr.Discard(), } + config := config.New() pod := inj.inject(context.Background(), insts, corev1.Namespace{}, corev1.Pod{ @@ -621,7 +624,7 @@ func TestInjectNodeJS(t *testing.T) { }, }, }, - }) + }, config) assert.Equal(t, corev1.Pod{ Spec: corev1.PodSpec{ Volumes: []corev1.Volume{ @@ -714,6 +717,7 @@ func TestInjectPython(t *testing.T) { inj := sdkInjector{ logger: logr.Discard(), } + config := config.New() pod := inj.inject(context.Background(), insts, corev1.Namespace{}, corev1.Pod{ @@ -725,7 +729,7 @@ func TestInjectPython(t *testing.T) { }, }, }, - }) + }, config) assert.Equal(t, corev1.Pod{ Spec: corev1.PodSpec{ Volumes: []corev1.Volume{ @@ -832,6 +836,7 @@ func TestInjectDotNet(t *testing.T) { inj := sdkInjector{ logger: logr.Discard(), } + config := config.New() pod := inj.inject(context.Background(), insts, corev1.Namespace{}, corev1.Pod{ @@ -843,7 +848,7 @@ func TestInjectDotNet(t *testing.T) { }, }, }, - }) + }, config) assert.Equal(t, corev1.Pod{ Spec: corev1.PodSpec{ Volumes: []corev1.Volume{ @@ -951,6 +956,7 @@ func TestInjectGo(t *testing.T) { insts languageInstrumentations pod corev1.Pod expected corev1.Pod + config config.Config }{ { name: "shared process namespace disabled", @@ -1219,7 +1225,7 @@ func TestInjectGo(t *testing.T) { inj := sdkInjector{ logger: logr.Discard(), } - pod := inj.inject(context.Background(), test.insts, corev1.Namespace{}, test.pod) + pod := inj.inject(context.Background(), test.insts, corev1.Namespace{}, test.pod, test.config) assert.Equal(t, test.expected, pod) }) } @@ -1232,6 +1238,7 @@ func TestInjectApacheHttpd(t *testing.T) { insts languageInstrumentations pod corev1.Pod expected corev1.Pod + config config.Config }{ { name: "injection enabled, exporter set", @@ -1376,7 +1383,7 @@ func TestInjectApacheHttpd(t *testing.T) { logger: logr.Discard(), } - pod := inj.inject(context.Background(), test.insts, corev1.Namespace{}, test.pod) + pod := inj.inject(context.Background(), test.insts, corev1.Namespace{}, test.pod, test.config) assert.Equal(t, test.expected, pod) }) } @@ -1389,6 +1396,7 @@ func TestInjectNginx(t *testing.T) { insts languageInstrumentations pod corev1.Pod expected corev1.Pod + config config.Config }{ { name: "injection enabled, exporter set", @@ -1538,7 +1546,7 @@ func TestInjectNginx(t *testing.T) { inj := sdkInjector{ logger: logr.Discard(), } - pod := inj.inject(context.Background(), test.insts, corev1.Namespace{}, test.pod) + pod := inj.inject(context.Background(), test.insts, corev1.Namespace{}, test.pod, test.config) assert.Equal(t, test.expected, pod) }) } @@ -1559,6 +1567,7 @@ func TestInjectSdkOnly(t *testing.T) { inj := sdkInjector{ logger: logr.Discard(), } + config := config.New() pod := inj.inject(context.Background(), insts, corev1.Namespace{}, corev1.Pod{ @@ -1570,7 +1579,7 @@ func TestInjectSdkOnly(t *testing.T) { }, }, }, - }) + }, config) assert.Equal(t, corev1.Pod{ Spec: corev1.PodSpec{ Containers: []corev1.Container{ diff --git a/pkg/sidecar/pod.go b/pkg/sidecar/pod.go index faae733236..445af47e47 100644 --- a/pkg/sidecar/pod.go +++ b/pkg/sidecar/pod.go @@ -21,7 +21,7 @@ import ( "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/manifests/collector" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -33,7 +33,7 @@ const ( ) // add a new sidecar container to the given pod, based on the given OpenTelemetryCollector. -func add(cfg config.Config, logger logr.Logger, otelcol v1alpha2.OpenTelemetryCollector, pod corev1.Pod, attributes []corev1.EnvVar) (corev1.Pod, error) { +func add(cfg config.Config, logger logr.Logger, otelcol v1beta1.OpenTelemetryCollector, pod corev1.Pod, attributes []corev1.EnvVar) (corev1.Pod, error) { otelColCfg, err := collector.ReplaceConfig(otelcol) if err != nil { return pod, err diff --git a/pkg/sidecar/pod_test.go b/pkg/sidecar/pod_test.go index d030d370ae..920f3890fe 100644 --- a/pkg/sidecar/pod_test.go +++ b/pkg/sidecar/pod_test.go @@ -24,7 +24,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" - "github.com/open-telemetry/opentelemetry-operator/apis/v1alpha2" + "github.com/open-telemetry/opentelemetry-operator/apis/v1beta1" "github.com/open-telemetry/opentelemetry-operator/internal/api/convert" "github.com/open-telemetry/opentelemetry-operator/internal/config" "github.com/open-telemetry/opentelemetry-operator/internal/naming" @@ -130,7 +130,7 @@ func TestAddSidecarWhenOneExistsAlready(t *testing.T) { }, }, } - otelcol := v1alpha2.OpenTelemetryCollector{} + otelcol := v1beta1.OpenTelemetryCollector{} cfg := config.New(config.WithCollectorImage("some-default-image")) // test @@ -219,7 +219,7 @@ func TestAddSidecarWithAditionalEnv(t *testing.T) { }, }, } - otelcol := v1alpha2.OpenTelemetryCollector{ + otelcol := v1beta1.OpenTelemetryCollector{ ObjectMeta: metav1.ObjectMeta{ Name: "otelcol-sample", Namespace: "some-app", diff --git a/tests/e2e-autoscale/autoscale/03-delete.yaml b/tests/e2e-autoscale/autoscale/03-delete.yaml deleted file mode 100644 index 5e39ab40db..0000000000 --- a/tests/e2e-autoscale/autoscale/03-delete.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -delete: -- apiVersion: batch/v1 - kind: Job - propagationPolicy: Background - metadata: - name: telemetrygen-set-utilization \ No newline at end of file diff --git a/tests/e2e-autoscale/autoscale/chainsaw-test.yaml b/tests/e2e-autoscale/autoscale/chainsaw-test.yaml new file mode 100755 index 0000000000..d61acf4643 --- /dev/null +++ b/tests/e2e-autoscale/autoscale/chainsaw-test.yaml @@ -0,0 +1,35 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: autoscale +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - apply: + file: 01-install.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-install.yaml + - assert: + file: 02-assert.yaml + - name: step-03 + try: + - delete: + ref: + apiVersion: batch/v1 + kind: Job + name: telemetrygen-set-utilization + - assert: + file: 03-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-apache-httpd/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-apache-httpd/00-install-collector.yaml index 5b0d06576c..e42ef04d1c 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-httpd/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-httpd/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -19,13 +18,4 @@ spec: receivers: [otlp] processors: [] exporters: [debug] - ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=3000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml new file mode 100755 index 0000000000..b630a2ddb8 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-apache-httpd/chainsaw-test.yaml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + name: instrumentation-apache-httpd +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 3000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/00-install-collector.yaml index ee92c16567..a532d324e2 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/00-install-collector.yaml @@ -1,22 +1,22 @@ # skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 -#apiVersion: opentelemetry.io/v1alpha1 -#kind: OpenTelemetryCollector -#metadata: -# name: sidecar -#spec: -# mode: sidecar -# config: | -# receivers: -# otlp: -# protocols: -# grpc: -# http: -# processors: -# exporters: -# debug: -# service: -# pipelines: -# traces: -# receivers: [otlp] -# processors: [] -# exporters: [debug] +apiVersion: opentelemetry.io/v1alpha1 +kind: OpenTelemetryCollector +metadata: + name: sidecar +spec: + mode: sidecar + config: | + receivers: + otlp: + protocols: + grpc: + http: + processors: + exporters: + debug: + service: + pipelines: + traces: + receivers: [otlp] + processors: [] + exporters: [debug] diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/00-install-instrumentation.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/00-install-instrumentation.yaml index 4d7a2b22f3..d778d467e5 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/00-install-instrumentation.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/00-install-instrumentation.yaml @@ -1,18 +1,18 @@ # skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 -#apiVersion: opentelemetry.io/v1alpha1 -#kind: Instrumentation -#metadata: -# name: apache -#spec: -# exporter: -# endpoint: http://localhost:4317 -# propagators: -# - jaeger -# - b3 -# sampler: -# type: parentbased_traceidratio -# argument: "0.25" -# apacheHttpd: -# attrs: -# - name: ApacheModuleOtelMaxQueueSize -# value: "4096" +apiVersion: opentelemetry.io/v1alpha1 +kind: Instrumentation +metadata: + name: apache +spec: + exporter: + endpoint: http://localhost:4317 + propagators: + - jaeger + - b3 + sampler: + type: parentbased_traceidratio + argument: "0.25" + apacheHttpd: + attrs: + - name: ApacheModuleOtelMaxQueueSize + value: "4096" diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-assert.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-assert.yaml index c2f7496e9f..5bc80bbfe2 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-assert.yaml @@ -1,71 +1,71 @@ # skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 -#apiVersion: v1 -#kind: Pod -#metadata: -# annotations: -# sidecar.opentelemetry.io/inject: "true" -# instrumentation.opentelemetry.io/inject-apache-httpd: "true" -# instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" -# labels: -# app: my-apache -#spec: -# containers: -# - env: -# - name: OTEL_SERVICE_NAME -# value: my-apache -# - name: OTEL_EXPORTER_OTLP_ENDPOINT -# value: http://localhost:4317 -# - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME -# valueFrom: -# fieldRef: -# apiVersion: v1 -# fieldPath: metadata.name -# - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME -# valueFrom: -# fieldRef: -# apiVersion: v1 -# fieldPath: spec.nodeName -# - name: OTEL_PROPAGATORS -# value: jaeger,b3 -# - name: OTEL_TRACES_SAMPLER -# value: parentbased_traceidratio -# - name: OTEL_TRACES_SAMPLER_ARG -# value: "0.25" -# - name: OTEL_RESOURCE_ATTRIBUTES -# name: myapp -# volumeMounts: -# - mountPath: /var/run/secrets/kubernetes.io/serviceaccount -# - mountPath: /opt/opentelemetry-webserver/agent -# name: otel-apache-agent -# - mountPath: /usr/local/apache2/conf -# name: otel-apache-conf-dir -# - env: -# - name: OTEL_SERVICE_NAME -# value: my-apache -# - name: OTEL_EXPORTER_OTLP_ENDPOINT -# value: http://localhost:4317 -# - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME -# valueFrom: -# fieldRef: -# apiVersion: v1 -# fieldPath: metadata.name -# - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME -# valueFrom: -# fieldRef: -# apiVersion: v1 -# fieldPath: spec.nodeName -# - name: OTEL_PROPAGATORS -# value: jaeger,b3 -# - name: OTEL_TRACES_SAMPLER -# value: parentbased_traceidratio -# - name: OTEL_TRACES_SAMPLER_ARG -# value: "0.25" -# - name: OTEL_RESOURCE_ATTRIBUTES -# name: myrabbit -# volumeMounts: -# - mountPath: /var/run/secrets/kubernetes.io/serviceaccount -# - args: -# - --config=env:OTEL_CONFIG -# name: otc-container -#status: -# phase: Running +apiVersion: v1 +kind: Pod +metadata: + annotations: + sidecar.opentelemetry.io/inject: "true" + instrumentation.opentelemetry.io/inject-apache-httpd: "true" + instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" + labels: + app: my-apache +spec: + containers: + - env: + - name: OTEL_SERVICE_NAME + value: my-apache + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.25" + - name: OTEL_RESOURCE_ATTRIBUTES + name: myapp + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + - mountPath: /opt/opentelemetry-webserver/agent + name: otel-apache-agent + - mountPath: /usr/local/apache2/conf + name: otel-apache-conf-dir + - env: + - name: OTEL_SERVICE_NAME + value: my-apache + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.25" + - name: OTEL_RESOURCE_ATTRIBUTES + name: myrabbit + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + - args: + - --config=env:OTEL_CONFIG + name: otc-container +status: + phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-install-app.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-install-app.yaml index 1d7fbb0251..32500ce21f 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/01-install-app.yaml @@ -1,36 +1,36 @@ # skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 -#apiVersion: apps/v1 -#kind: Deployment -#metadata: -# name: my-apache -#spec: -# selector: -# matchLabels: -# app: my-apache -# replicas: 1 -# template: -# metadata: -# labels: -# app: my-apache -# annotations: -# sidecar.opentelemetry.io/inject: "true" -# instrumentation.opentelemetry.io/inject-apache-httpd: "true" -# instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" -# spec: -# containers: -# - name: myapp -# image: docker.io/chrlic/apache-test@sha256:fad58c6ce7a4f477b455bece2a1980741fa6f81cef1e1093a3b72f9b2ffa7b8e -# # image source at https://github.com/cisco-open/appdynamics-k8s-webhook-instrumentor/tree/main/testWorkloads/apache-httpd -# # licensed under Apache 2.0 -# imagePullPolicy: Always -# ports: -# - containerPort: 8080 -# resources: -# limits: -# cpu: "1" -# memory: 500Mi -# requests: -# cpu: 250m -# memory: 100Mi -# - name: myrabbit -# image: rabbitmq +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-apache +spec: + selector: + matchLabels: + app: my-apache + replicas: 1 + template: + metadata: + labels: + app: my-apache + annotations: + sidecar.opentelemetry.io/inject: "true" + instrumentation.opentelemetry.io/inject-apache-httpd: "true" + instrumentation.opentelemetry.io/container-names: "myapp,myrabbit" + spec: + containers: + - name: myapp + image: docker.io/chrlic/apache-test@sha256:fad58c6ce7a4f477b455bece2a1980741fa6f81cef1e1093a3b72f9b2ffa7b8e + # image source at https://github.com/cisco-open/appdynamics-k8s-webhook-instrumentor/tree/main/testWorkloads/apache-httpd + # licensed under Apache 2.0 + imagePullPolicy: Always + ports: + - containerPort: 8080 + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi + - name: myrabbit + image: rabbitmq diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-assert.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-assert.yaml index dd29818998..b3c7882d7f 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-assert.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-assert.yaml @@ -1,68 +1,68 @@ # skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 -#apiVersion: v1 -#kind: Pod -#metadata: -# annotations: -# instrumentation.opentelemetry.io/inject-apache-httpd: "true" -# sidecar.opentelemetry.io/inject: "true" -# labels: -# app: my-apache -#spec: -# containers: -# - env: -# - name: OTEL_SERVICE_NAME -# value: my-apache -# - name: OTEL_EXPORTER_OTLP_ENDPOINT -# value: http://localhost:4317 -# - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME -# valueFrom: -# fieldRef: -# apiVersion: v1 -# fieldPath: metadata.name -# - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME -# valueFrom: -# fieldRef: -# apiVersion: v1 -# fieldPath: spec.nodeName -# - name: OTEL_PROPAGATORS -# value: jaeger,b3 -# - name: OTEL_TRACES_SAMPLER -# value: parentbased_traceidratio -# - name: OTEL_TRACES_SAMPLER_ARG -# value: "0.25" -# - name: OTEL_RESOURCE_ATTRIBUTES -# name: myapp -# volumeMounts: -# - mountPath: /var/run/secrets/kubernetes.io/serviceaccount -# - mountPath: /opt/opentelemetry-webserver/agent -# name: otel-apache-agent -# - mountPath: /usr/local/apache2/conf -# name: otel-apache-conf-dir -# - env: -# - name: OTEL_SERVICE_NAME -# value: my-apache -# - name: OTEL_EXPORTER_OTLP_ENDPOINT -# value: http://localhost:4317 -# - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME -# valueFrom: -# fieldRef: -# apiVersion: v1 -# fieldPath: metadata.name -# - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME -# valueFrom: -# fieldRef: -# apiVersion: v1 -# fieldPath: spec.nodeName -# - name: OTEL_PROPAGATORS -# value: jaeger,b3 -# - name: OTEL_TRACES_SAMPLER -# value: parentbased_traceidratio -# - name: OTEL_TRACES_SAMPLER_ARG -# value: "0.25" -# - name: OTEL_RESOURCE_ATTRIBUTES -# name: myrabbit -# - args: -# - --config=env:OTEL_CONFIG -# name: otc-container -#status: -# phase: Running +apiVersion: v1 +kind: Pod +metadata: + annotations: + instrumentation.opentelemetry.io/inject-apache-httpd: "true" + sidecar.opentelemetry.io/inject: "true" + labels: + app: my-apache +spec: + containers: + - env: + - name: OTEL_SERVICE_NAME + value: my-apache + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.25" + - name: OTEL_RESOURCE_ATTRIBUTES + name: myapp + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + - mountPath: /opt/opentelemetry-webserver/agent + name: otel-apache-agent + - mountPath: /usr/local/apache2/conf + name: otel-apache-conf-dir + - env: + - name: OTEL_SERVICE_NAME + value: my-apache + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: http://localhost:4317 + - name: OTEL_RESOURCE_ATTRIBUTES_POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: OTEL_RESOURCE_ATTRIBUTES_NODE_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: spec.nodeName + - name: OTEL_PROPAGATORS + value: jaeger,b3 + - name: OTEL_TRACES_SAMPLER + value: parentbased_traceidratio + - name: OTEL_TRACES_SAMPLER_ARG + value: "0.25" + - name: OTEL_RESOURCE_ATTRIBUTES + name: myrabbit + - args: + - --config=env:OTEL_CONFIG + name: otc-container +status: + phase: Running diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-install-app.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-install-app.yaml index 8044cda2f2..3927a33cce 100644 --- a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-install-app.yaml +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/02-install-app.yaml @@ -1,36 +1,36 @@ # skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 -#apiVersion: apps/v1 -#kind: Deployment -#metadata: -# name: my-apache -#spec: -# selector: -# matchLabels: -# app: my-apache -# replicas: 1 -# template: -# metadata: -# labels: -# app: my-apache -# annotations: -# sidecar.opentelemetry.io/inject: "true" -# instrumentation.opentelemetry.io/inject-apache-httpd: "true" -# instrumentation.opentelemetry.io/container-names: "myrabbit" -# spec: -# containers: -# - name: myapp -# image: docker.io/chrlic/apache-test@sha256:fad58c6ce7a4f477b455bece2a1980741fa6f81cef1e1093a3b72f9b2ffa7b8e -# # image source at https://github.com/cisco-open/appdynamics-k8s-webhook-instrumentor/tree/main/testWorkloads/apache-httpd -# # licensed under Apache 2.0 -# imagePullPolicy: Always -# ports: -# - containerPort: 8080 -# resources: -# limits: -# cpu: "1" -# memory: 500Mi -# requests: -# cpu: 250m -# memory: 100Mi -# - name: myrabbit -# image: rabbitmq +apiVersion: apps/v1 +kind: Deployment +metadata: + name: my-apache +spec: + selector: + matchLabels: + app: my-apache + replicas: 1 + template: + metadata: + labels: + app: my-apache + annotations: + sidecar.opentelemetry.io/inject: "true" + instrumentation.opentelemetry.io/inject-apache-httpd: "true" + instrumentation.opentelemetry.io/container-names: "myrabbit" + spec: + containers: + - name: myapp + image: docker.io/chrlic/apache-test@sha256:fad58c6ce7a4f477b455bece2a1980741fa6f81cef1e1093a3b72f9b2ffa7b8e + # image source at https://github.com/cisco-open/appdynamics-k8s-webhook-instrumentor/tree/main/testWorkloads/apache-httpd + # licensed under Apache 2.0 + imagePullPolicy: Always + ports: + - containerPort: 8080 + resources: + limits: + cpu: "1" + memory: 500Mi + requests: + cpu: 250m + memory: 100Mi + - name: myrabbit + image: rabbitmq diff --git a/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml new file mode 100755 index 0000000000..1167bbc5a6 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-apache-multicontainer/chainsaw-test.yaml @@ -0,0 +1,28 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-apache-multicontainer +spec: + # skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 + skip: true + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/chainsaw-test.yaml new file mode 100755 index 0000000000..23d09b619c --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-dotnet-multicontainer/chainsaw-test.yaml @@ -0,0 +1,26 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-dotnet-multicontainer +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-musl/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-musl/00-install-collector.yaml index b03a72e60e..71b4d56052 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet-musl/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet-musl/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -21,12 +20,4 @@ spec: receivers: [otlp] processors: [] exporters: [logging] ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-dotnet-musl/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-dotnet-musl/chainsaw-test.yaml new file mode 100755 index 0000000000..2e66379911 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-dotnet-musl/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-dotnet-musl +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 2000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-dotnet/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-dotnet/00-install-collector.yaml index 2875bde640..fe390c6cae 100644 --- a/tests/e2e-instrumentation/instrumentation-dotnet/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-dotnet/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -21,12 +20,4 @@ spec: receivers: [otlp] processors: [] exporters: [debug] ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-dotnet/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-dotnet/chainsaw-test.yaml new file mode 100755 index 0000000000..9f6752c00c --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-dotnet/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-dotnet +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 2000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-go/01-add-scc.yaml b/tests/e2e-instrumentation/instrumentation-go/01-add-scc.yaml index e8a82d749e..db4b5b8553 100644 --- a/tests/e2e-instrumentation/instrumentation-go/01-add-scc.yaml +++ b/tests/e2e-instrumentation/instrumentation-go/01-add-scc.yaml @@ -1,16 +1,4 @@ -# Create a SA to apply the SCC policy apiVersion: v1 kind: ServiceAccount metadata: name: otel-instrumentation-go ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - script: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=0/0 --overwrite - - script: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000 --overwrite - # Add the SCC - - script: ./add-scc.sh diff --git a/tests/e2e-instrumentation/instrumentation-go/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-go/chainsaw-test.yaml new file mode 100755 index 0000000000..1a44d8007c --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-go/chainsaw-test.yaml @@ -0,0 +1,31 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-go +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 0/0 + openshift.io/sa.scc.supplemental-groups: 2000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - script: + content: ./add-scc.sh + - apply: + file: 01-add-scc.yaml + - name: step-02 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-java-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-java-multicontainer/chainsaw-test.yaml new file mode 100755 index 0000000000..b02ba84276 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-java-multicontainer/chainsaw-test.yaml @@ -0,0 +1,26 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-java-multicontainer +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-java-other-ns/01-cleanup-other-ns.yaml b/tests/e2e-instrumentation/instrumentation-java-other-ns/01-cleanup-other-ns.yaml deleted file mode 100644 index ee6bc7f70e..0000000000 --- a/tests/e2e-instrumentation/instrumentation-java-other-ns/01-cleanup-other-ns.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -delete: -- apiVersion: v1 - kind: Namespace - name: my-other-ns diff --git a/tests/e2e-instrumentation/instrumentation-java-other-ns/02-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-java-other-ns/02-install-collector.yaml index 2875bde640..fe390c6cae 100644 --- a/tests/e2e-instrumentation/instrumentation-java-other-ns/02-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-java-other-ns/02-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -21,12 +20,4 @@ spec: receivers: [otlp] processors: [] exporters: [debug] ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-java-other-ns/04-cleanup-other-ns.yaml b/tests/e2e-instrumentation/instrumentation-java-other-ns/04-cleanup-other-ns.yaml deleted file mode 100644 index ee6bc7f70e..0000000000 --- a/tests/e2e-instrumentation/instrumentation-java-other-ns/04-cleanup-other-ns.yaml +++ /dev/null @@ -1,6 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -delete: -- apiVersion: v1 - kind: Namespace - name: my-other-ns diff --git a/tests/e2e-instrumentation/instrumentation-java-other-ns/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-java-other-ns/chainsaw-test.yaml new file mode 100755 index 0000000000..6ea738787a --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-java-other-ns/chainsaw-test.yaml @@ -0,0 +1,39 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-java-other-ns +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 2000/1000 + steps: + - name: step-01 + try: + - delete: + ref: + apiVersion: v1 + kind: Namespace + name: my-other-ns + - name: step-02 + try: + - apply: + file: 02-install-collector.yaml + - apply: + file: 02-install-instrumentation.yaml + - name: step-03 + try: + - apply: + file: 03-install-app.yaml + - assert: + file: 03-assert.yaml + - name: step-04 + try: + - delete: + ref: + apiVersion: v1 + kind: Namespace + name: my-other-ns diff --git a/tests/e2e-instrumentation/instrumentation-java/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-java/00-install-collector.yaml index 2875bde640..fe390c6cae 100644 --- a/tests/e2e-instrumentation/instrumentation-java/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-java/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -21,12 +20,4 @@ spec: receivers: [otlp] processors: [] exporters: [debug] ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-java/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-java/chainsaw-test.yaml new file mode 100755 index 0000000000..064d020f72 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-java/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-java +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 2000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/00-install-collector.yaml index c18f418bfb..812f4358c0 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -19,13 +18,4 @@ spec: receivers: [otlp] processors: [] exporters: [logging] - ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=3000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml new file mode 100755 index 0000000000..52ca3192b9 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-nginx-contnr-secctx/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-nginx-contnr-secctx +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 3000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/00-install-collector.yaml index cb02aa005d..812f4358c0 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/00-install-collector.yaml @@ -1,32 +1,21 @@ -# skipping test, see https://github.com/open-telemetry/opentelemetry-operator/issues/1936 apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: - name: sidecar + name: sidecar spec: - mode: sidecar - config: | - receivers: - otlp: - protocols: - grpc: - http: - processors: - exporters: - logging: - service: - pipelines: - traces: - receivers: [otlp] - processors: [] - exporters: [logging] - ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=3000/1000 --overwrite + config: | + receivers: + otlp: + protocols: + grpc: + http: + processors: + exporters: + logging: + service: + pipelines: + traces: + receivers: [otlp] + processors: [] + exporters: [logging] + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml new file mode 100755 index 0000000000..cec812a1ea --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-nginx-multicontainer/chainsaw-test.yaml @@ -0,0 +1,31 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-nginx-multicontainer +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 3000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-nginx/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-nginx/00-install-collector.yaml index c18f418bfb..812f4358c0 100644 --- a/tests/e2e-instrumentation/instrumentation-nginx/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-nginx/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -19,13 +18,4 @@ spec: receivers: [otlp] processors: [] exporters: [logging] - ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=3000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml new file mode 100755 index 0000000000..d6f0073f81 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-nginx/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-nginx +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 3000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/chainsaw-test.yaml new file mode 100755 index 0000000000..d4a34896b2 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-nodejs-multicontainer/chainsaw-test.yaml @@ -0,0 +1,26 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-nodejs-multicontainer +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-nodejs/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-nodejs/00-install-collector.yaml index 2875bde640..fe390c6cae 100644 --- a/tests/e2e-instrumentation/instrumentation-nodejs/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-nodejs/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -21,12 +20,4 @@ spec: receivers: [otlp] processors: [] exporters: [debug] ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-nodejs/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-nodejs/chainsaw-test.yaml new file mode 100755 index 0000000000..7595b0c448 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-nodejs/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-nodejs +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 2000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-python-multicontainer/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-python-multicontainer/chainsaw-test.yaml new file mode 100755 index 0000000000..c39ad549b7 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-python-multicontainer/chainsaw-test.yaml @@ -0,0 +1,26 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-python-multicontainer +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-install-app.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-python/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-python/00-install-collector.yaml index 2875bde640..fe390c6cae 100644 --- a/tests/e2e-instrumentation/instrumentation-python/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-python/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -21,12 +20,4 @@ spec: receivers: [otlp] processors: [] exporters: [debug] ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-python/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-python/chainsaw-test.yaml new file mode 100755 index 0000000000..d36d69d224 --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-python/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-python +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 2000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-instrumentation/instrumentation-sdk/00-install-collector.yaml b/tests/e2e-instrumentation/instrumentation-sdk/00-install-collector.yaml index 2875bde640..fe390c6cae 100644 --- a/tests/e2e-instrumentation/instrumentation-sdk/00-install-collector.yaml +++ b/tests/e2e-instrumentation/instrumentation-sdk/00-install-collector.yaml @@ -3,7 +3,6 @@ kind: OpenTelemetryCollector metadata: name: sidecar spec: - mode: sidecar config: | receivers: otlp: @@ -21,12 +20,4 @@ spec: receivers: [otlp] processors: [] exporters: [debug] ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=2000/1000 --overwrite + mode: sidecar diff --git a/tests/e2e-instrumentation/instrumentation-sdk/chainsaw-test.yaml b/tests/e2e-instrumentation/instrumentation-sdk/chainsaw-test.yaml new file mode 100755 index 0000000000..e329a7ff4e --- /dev/null +++ b/tests/e2e-instrumentation/instrumentation-sdk/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-sdk +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 2000/1000 + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/chainsaw-test.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/chainsaw-test.yaml new file mode 100755 index 0000000000..e5303719f6 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-multicontainer/chainsaw-test.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-multi-multicontainer +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-multi-instrumentation/instrumentation-multi-no-containers/chainsaw-test.yaml b/tests/e2e-multi-instrumentation/instrumentation-multi-no-containers/chainsaw-test.yaml new file mode 100755 index 0000000000..c79b2a8815 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-multi-no-containers/chainsaw-test.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-multi-no-containers +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-multi-instrumentation/instrumentation-single-instr-first-container/chainsaw-test.yaml b/tests/e2e-multi-instrumentation/instrumentation-single-instr-first-container/chainsaw-test.yaml new file mode 100755 index 0000000000..e9d5115609 --- /dev/null +++ b/tests/e2e-multi-instrumentation/instrumentation-single-instr-first-container/chainsaw-test.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: instrumentation-single-instr-first-container +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install-collector.yaml + - apply: + file: 00-install-instrumentation.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-opampbridge/opampbridge/00-assert.yaml b/tests/e2e-opampbridge/opampbridge/00-assert.yaml index f4022a72d4..bc576139e3 100644 --- a/tests/e2e-opampbridge/opampbridge/00-assert.yaml +++ b/tests/e2e-opampbridge/opampbridge/00-assert.yaml @@ -6,30 +6,27 @@ spec: template: spec: containers: - - name: opamp-bridge-container - env: - - name: OTELCOL_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - volumeMounts: - - mountPath: /conf - name: opamp-bridge-internal - volumes: - - configMap: - items: - - key: remoteconfiguration.yaml - path: remoteconfiguration.yaml - name: test-opamp-bridge + - env: + - name: OTELCOL_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + name: opamp-bridge-container + volumeMounts: + - mountPath: /conf name: opamp-bridge-internal + volumes: + - configMap: + items: + - key: remoteconfiguration.yaml + path: remoteconfiguration.yaml + name: test-opamp-bridge + name: opamp-bridge-internal status: - replicas: 1 readyReplicas: 1 + replicas: 1 --- apiVersion: v1 -kind: ConfigMap -metadata: - name: test-opamp-bridge data: remoteconfiguration.yaml: | capabilities: @@ -52,6 +49,9 @@ data: receivers: - otlp endpoint: ws://opamp-server:4320/v1/opamp +kind: ConfigMap +metadata: + name: test-opamp-bridge --- apiVersion: v1 kind: Service @@ -63,8 +63,3 @@ spec: port: 80 protocol: TCP targetPort: 8080 ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -opampbridges: - - selector: app.kubernetes.io/component=opentelemetry-opamp-bridge diff --git a/tests/e2e-opampbridge/opampbridge/00-install.yaml b/tests/e2e-opampbridge/opampbridge/00-install.yaml index 3bfbf50e88..f76946e125 100644 --- a/tests/e2e-opampbridge/opampbridge/00-install.yaml +++ b/tests/e2e-opampbridge/opampbridge/00-install.yaml @@ -1,8 +1,8 @@ apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: opamp-bridge -automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role @@ -16,24 +16,18 @@ rules: verbs: - '*' - apiGroups: - - '' + - "" resources: - pods verbs: - - 'list' - - 'get' ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl -n $NAMESPACE create rolebinding default-opamp-bridge-$NAMESPACE --role=opamp-bridge --serviceaccount=$NAMESPACE:opamp-bridge + - list + - get --- apiVersion: opentelemetry.io/v1alpha1 kind: OpAMPBridge metadata: name: test spec: - endpoint: ws://opamp-server:4320/v1/opamp capabilities: AcceptsOpAMPConnectionSettings: true AcceptsOtherConnectionSettings: true @@ -47,9 +41,10 @@ spec: ReportsRemoteConfig: true ReportsStatus: true componentsAllowed: - receivers: - - otlp + exporters: + - logging processors: - memory_limiter - exporters: - - logging \ No newline at end of file + receivers: + - otlp + endpoint: ws://opamp-server:4320/v1/opamp diff --git a/tests/e2e-opampbridge/opampbridge/chainsaw-test.yaml b/tests/e2e-opampbridge/opampbridge/chainsaw-test.yaml new file mode 100755 index 0000000000..a428ab84db --- /dev/null +++ b/tests/e2e-opampbridge/opampbridge/chainsaw-test.yaml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: opampbridge +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml + catch: + - podLogs: + selector: app.kubernetes.io/component=opentelemetry-opamp-bridge + \ No newline at end of file diff --git a/tests/e2e-openshift/kafka/05-assert.yaml b/tests/e2e-openshift/kafka/05-assert.yaml deleted file mode 100644 index 0dfd963f94..0000000000 --- a/tests/e2e-openshift/kafka/05-assert.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 30 -commands: -- script: ./tests/e2e-openshift/kafka/check_traces.sh diff --git a/tests/e2e-openshift/kafka/chainsaw-test.yaml b/tests/e2e-openshift/kafka/chainsaw-test.yaml new file mode 100755 index 0000000000..71932c1823 --- /dev/null +++ b/tests/e2e-openshift/kafka/chainsaw-test.yaml @@ -0,0 +1,42 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: kafka +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-create-kafka-instance.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - apply: + file: 01-create-kafka-topics.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-otel-kakfa-receiver.yaml + - assert: + file: 02-assert.yaml + - name: step-03 + try: + - apply: + file: 03-otel-kakfa-exporter.yaml + - assert: + file: 03-assert.yaml + - name: step-04 + try: + - apply: + file: 04-generate-traces.yaml + - assert: + file: 04-assert.yaml + - name: step-05 + try: + - script: + content: ./tests/e2e-openshift/kafka/check_traces.sh diff --git a/tests/e2e-openshift/monitoring/00-assert.yaml b/tests/e2e-openshift/monitoring/00-assert.yaml deleted file mode 100644 index f9cbcf22cc..0000000000 --- a/tests/e2e-openshift/monitoring/00-assert.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -- script: ./tests/e2e-openshift/monitoring/check_user_workload_monitoring.sh diff --git a/tests/e2e-openshift/monitoring/03-assert.yaml b/tests/e2e-openshift/monitoring/03-assert.yaml index 2f1f82d416..24386d9d70 100644 --- a/tests/e2e-openshift/monitoring/03-assert.yaml +++ b/tests/e2e-openshift/monitoring/03-assert.yaml @@ -11,7 +11,6 @@ rules: - get - list - watch - --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -25,9 +24,3 @@ subjects: - kind: ServiceAccount name: prometheus-user-workload namespace: openshift-user-workload-monitoring - ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -- script: ./tests/e2e-openshift/monitoring/check_metrics.sh diff --git a/tests/e2e-openshift/monitoring/chainsaw-test.yaml b/tests/e2e-openshift/monitoring/chainsaw-test.yaml new file mode 100755 index 0000000000..8c527ec871 --- /dev/null +++ b/tests/e2e-openshift/monitoring/chainsaw-test.yaml @@ -0,0 +1,34 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: monitoring +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-workload-monitoring.yaml + - script: + content: ./tests/e2e-openshift/monitoring/check_user_workload_monitoring.sh + - name: step-01 + try: + - apply: + file: 01-otel-collector.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-generate-traces.yaml + - assert: + file: 02-assert.yaml + - name: step-03 + try: + - apply: + file: 03-create-monitoring-roles.yaml + - assert: + file: 03-assert.yaml + - script: + content: ./tests/e2e-openshift/monitoring/check_metrics.sh diff --git a/tests/e2e-openshift/multi-cluster/02-otlp-receiver.yaml b/tests/e2e-openshift/multi-cluster/02-otlp-receiver.yaml index d300458082..46f39a7b89 100644 --- a/tests/e2e-openshift/multi-cluster/02-otlp-receiver.yaml +++ b/tests/e2e-openshift/multi-cluster/02-otlp-receiver.yaml @@ -1,27 +1,9 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: -- script: ./generate_certs.sh - ---- apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: otlp-receiver namespace: kuttl-multi-cluster-receive spec: - mode: "deployment" - ingress: - type: route - route: - termination: "passthrough" - volumes: - - name: kuttl-certs - configMap: - name: kuttl-certs - volumeMounts: - - name: kuttl-certs - mountPath: /certs config: | receivers: otlp: @@ -47,3 +29,15 @@ spec: receivers: [otlp] processors: [] exporters: [otlp] + ingress: + route: + termination: passthrough + type: route + mode: deployment + volumeMounts: + - mountPath: /certs + name: kuttl-certs + volumes: + - configMap: + name: kuttl-certs + name: kuttl-certs diff --git a/tests/e2e-openshift/multi-cluster/03-otlp-sender.yaml b/tests/e2e-openshift/multi-cluster/03-otlp-sender.yaml index 2c1d45273f..6b561b4875 100644 --- a/tests/e2e-openshift/multi-cluster/03-otlp-sender.yaml +++ b/tests/e2e-openshift/multi-cluster/03-otlp-sender.yaml @@ -1,46 +1,57 @@ ---- apiVersion: v1 kind: ServiceAccount metadata: name: kuttl-multi-cluster namespace: kuttl-multi-cluster-send - --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: kuttl-multi-cluster rules: -- apiGroups: ["config.openshift.io"] - resources: ["infrastructures", "infrastructures/status"] - verbs: ["get", "watch", "list"] -- apiGroups: ["apps"] - resources: ["replicasets"] - verbs: ["get", "watch", "list"] -- apiGroups: [""] - resources: ["pods"] - verbs: ["get", "watch", "list"] -- apiGroups: [""] - resources: ["namespaces"] - verbs: ["get", "watch", "list"] - +- apiGroups: + - config.openshift.io + resources: + - infrastructures + - infrastructures/status + verbs: + - get + - watch + - list +- apiGroups: + - apps + resources: + - replicasets + verbs: + - get + - watch + - list +- apiGroups: + - "" + resources: + - pods + verbs: + - get + - watch + - list +- apiGroups: + - "" + resources: + - namespaces + verbs: + - get + - watch + - list --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: kuttl-multi-cluster +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: kuttl-multi-cluster subjects: - kind: ServiceAccount name: kuttl-multi-cluster namespace: kuttl-multi-cluster-send -roleRef: - kind: ClusterRole - name: kuttl-multi-cluster - apiGroup: rbac.authorization.k8s.io - ---- ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: -- script: ./create_otlp_sender.sh diff --git a/tests/e2e-openshift/multi-cluster/05-assert.yaml b/tests/e2e-openshift/multi-cluster/05-assert.yaml deleted file mode 100644 index 73befbcd29..0000000000 --- a/tests/e2e-openshift/multi-cluster/05-assert.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 30 -commands: -- script: ./tests/e2e-openshift/multi-cluster/check_traces.sh diff --git a/tests/e2e-openshift/multi-cluster/chainsaw-test.yaml b/tests/e2e-openshift/multi-cluster/chainsaw-test.yaml new file mode 100755 index 0000000000..67cc6fc848 --- /dev/null +++ b/tests/e2e-openshift/multi-cluster/chainsaw-test.yaml @@ -0,0 +1,46 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: multi-cluster +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-create-namespaces.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - apply: + file: 01-create-jaeger.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - script: + content: ./generate_certs.sh + - apply: + file: 02-otlp-receiver.yaml + - assert: + file: 02-assert.yaml + - name: step-03 + try: + - script: + content: ./create_otlp_sender.sh + - apply: + file: 03-otlp-sender.yaml + - assert: + file: 03-assert.yaml + - name: step-04 + try: + - apply: + file: 04-generate-traces.yaml + - assert: + file: 04-assert.yaml + - name: step-05 + try: + - script: + content: ./tests/e2e-openshift/multi-cluster/check_traces.sh diff --git a/tests/e2e-openshift/otlp-metrics-traces/01-assert.yaml b/tests/e2e-openshift/otlp-metrics-traces/01-assert.yaml deleted file mode 100644 index b7e3849892..0000000000 --- a/tests/e2e-openshift/otlp-metrics-traces/01-assert.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -- script: ./tests/e2e-openshift/otlp-metrics-traces/check_user_workload_monitoring.sh diff --git a/tests/e2e-openshift/otlp-metrics-traces/04-assert.yaml b/tests/e2e-openshift/otlp-metrics-traces/04-assert.yaml deleted file mode 100644 index 9bec95f449..0000000000 --- a/tests/e2e-openshift/otlp-metrics-traces/04-assert.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 30 -commands: -- script: ./tests/e2e-openshift/otlp-metrics-traces/check_traces.sh diff --git a/tests/e2e-openshift/otlp-metrics-traces/05-assert.yaml b/tests/e2e-openshift/otlp-metrics-traces/05-assert.yaml deleted file mode 100644 index 79570e05a4..0000000000 --- a/tests/e2e-openshift/otlp-metrics-traces/05-assert.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -- script: ./tests/e2e-openshift/otlp-metrics-traces/check_metrics.sh diff --git a/tests/e2e-openshift/otlp-metrics-traces/chainsaw-test.yaml b/tests/e2e-openshift/otlp-metrics-traces/chainsaw-test.yaml new file mode 100755 index 0000000000..0c67bc4c13 --- /dev/null +++ b/tests/e2e-openshift/otlp-metrics-traces/chainsaw-test.yaml @@ -0,0 +1,40 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: otlp-metrics-traces +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install-jaeger.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - apply: + file: 01-workload-monitoring.yaml + - script: + content: ./tests/e2e-openshift/otlp-metrics-traces/check_user_workload_monitoring.sh + - name: step-02 + try: + - apply: + file: 02-otel-metrics-collector.yaml + - assert: + file: 02-assert.yaml + - name: step-03 + try: + - apply: + file: 03-metrics-traces-gen.yaml + - assert: + file: 03-assert.yaml + - name: step-04 + try: + - script: + content: ./tests/e2e-openshift/otlp-metrics-traces/check_traces.sh + - name: step-05 + try: + - script: + content: ./tests/e2e-openshift/otlp-metrics-traces/check_metrics.sh diff --git a/tests/e2e-openshift/route/01-report-empty-otlphttp-spans.yaml b/tests/e2e-openshift/route/01-report-empty-otlphttp-spans.yaml deleted file mode 100644 index 406d66cef2..0000000000 --- a/tests/e2e-openshift/route/01-report-empty-otlphttp-spans.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - #!/bin/bash - set -ex - # Export empty payload and check of collector accepted it with 2xx status code - otlp_http_host=$(kubectl get route otlp-http-simplest-route -n $NAMESPACE -o jsonpath='{.spec.host}') - for i in {1..40}; do curl --fail -ivX POST http://${otlp_http_host}:80/v1/traces -H "Content-Type: application/json" -d '{}' && break || sleep 1; done diff --git a/tests/e2e-openshift/route/chainsaw-test.yaml b/tests/e2e-openshift/route/chainsaw-test.yaml new file mode 100755 index 0000000000..56b00052ae --- /dev/null +++ b/tests/e2e-openshift/route/chainsaw-test.yaml @@ -0,0 +1,23 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: route +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - script: + content: | + #!/bin/bash + set -ex + # Export empty payload and check of collector accepted it with 2xx status code + otlp_http_host=$(kubectl get route otlp-http-simplest-route -n $NAMESPACE -o jsonpath='{.spec.host}') + for i in {1..40}; do curl --fail -ivX POST http://${otlp_http_host}:80/v1/traces -H "Content-Type: application/json" -d '{}' && break || sleep 1; done diff --git a/tests/e2e-pdb/pdb/chainsaw-test.yaml b/tests/e2e-pdb/pdb/chainsaw-test.yaml new file mode 100755 index 0000000000..d5e7025f54 --- /dev/null +++ b/tests/e2e-pdb/pdb/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: pdb +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e-pdb/target-allocator/chainsaw-test.yaml b/tests/e2e-pdb/target-allocator/chainsaw-test.yaml new file mode 100755 index 0000000000..dff97e4129 --- /dev/null +++ b/tests/e2e-pdb/target-allocator/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: target-allocator +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e-prometheuscr/create-pm-prometheus-exporters/chainsaw-test.yaml b/tests/e2e-prometheuscr/create-pm-prometheus-exporters/chainsaw-test.yaml new file mode 100755 index 0000000000..314e498921 --- /dev/null +++ b/tests/e2e-prometheuscr/create-pm-prometheus-exporters/chainsaw-test.yaml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: create-pm-prometheus-exporters +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-prometheuscr/create-sm-prometheus-exporters/07-delete.yaml b/tests/e2e-prometheuscr/create-sm-prometheus-exporters/07-delete.yaml deleted file mode 100644 index 76798588bb..0000000000 --- a/tests/e2e-prometheuscr/create-sm-prometheus-exporters/07-delete.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -delete: - - apiVersion: opentelemetry.io/v1alpha1 - kind: OpenTelemetryCollector - metadata: - name: simplest - namespace: create-sm-prometheus \ No newline at end of file diff --git a/tests/e2e-prometheuscr/create-sm-prometheus-exporters/08-install.yaml b/tests/e2e-prometheuscr/create-sm-prometheus-exporters/08-install.yaml index 7c808af177..97d2b32757 100644 --- a/tests/e2e-prometheuscr/create-sm-prometheus-exporters/08-install.yaml +++ b/tests/e2e-prometheuscr/create-sm-prometheus-exporters/08-install.yaml @@ -1,66 +1,81 @@ apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: ta namespace: create-sm-prometheus -automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: create-sm-prometheus rules: -- apiGroups: [""] +- apiGroups: + - "" resources: - - pods - - nodes - - services - - endpoints - - configmaps - - secrets - - namespaces + - pods + - nodes + - services + - endpoints + - configmaps + - secrets + - namespaces verbs: - - get - - watch - - list -- apiGroups: ["apps"] + - get + - watch + - list +- apiGroups: + - apps resources: - - statefulsets - - services - - endpoints + - statefulsets + - services + - endpoints verbs: - - get - - watch - - list -- apiGroups: ["discovery.k8s.io"] + - get + - watch + - list +- apiGroups: + - discovery.k8s.io resources: - - endpointslices + - endpointslices verbs: - - get - - watch - - list -- apiGroups: ["networking.k8s.io"] + - get + - watch + - list +- apiGroups: + - networking.k8s.io resources: - - ingresses + - ingresses verbs: - - get - - watch - - list -- apiGroups: ["monitoring.coreos.com"] + - get + - watch + - list +- apiGroups: + - monitoring.coreos.com resources: - - servicemonitors - - podmonitors + - servicemonitors + - podmonitors verbs: - - get - - watch - - list -- nonResourceURLs: ["/metrics"] - verbs: ["get"] + - get + - watch + - list +- nonResourceURLs: + - /metrics + verbs: + - get --- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl create clusterrolebinding simplest-targetallocator-create-sm-prometheus --clusterrole=create-sm-prometheus --serviceaccount=create-sm-prometheus:ta +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: simplest-targetallocator-create-sm-prometheus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: create-sm-prometheus +subjects: +- kind: ServiceAccount + name: ta + namespace: create-sm-prometheus --- apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector @@ -68,15 +83,6 @@ metadata: name: simplest namespace: create-sm-prometheus spec: - mode: statefulset - targetAllocator: - serviceAccount: ta - enabled: true - prometheusCR: - enabled: true - observability: - metrics: - enableMetrics: true config: | receivers: prometheus: @@ -94,6 +100,15 @@ spec: receivers: [prometheus] processors: [] exporters: [prometheus] + mode: statefulset + targetAllocator: + enabled: true + observability: + metrics: + enableMetrics: true + prometheusCR: + enabled: true + serviceAccount: ta --- apiVersion: batch/v1 kind: Job @@ -103,11 +118,11 @@ metadata: spec: template: spec: - restartPolicy: OnFailure containers: - - name: check-metrics - image: curlimages/curl - args: - - /bin/sh - - -c - - curl -s http://simplest-targetallocator/jobs | grep "targetallocator" + - args: + - /bin/sh + - -c + - curl -s http://simplest-targetallocator/jobs | grep "targetallocator" + image: curlimages/curl + name: check-metrics + restartPolicy: OnFailure diff --git a/tests/e2e-prometheuscr/create-sm-prometheus-exporters/chainsaw-test.yaml b/tests/e2e-prometheuscr/create-sm-prometheus-exporters/chainsaw-test.yaml new file mode 100755 index 0000000000..affed8f745 --- /dev/null +++ b/tests/e2e-prometheuscr/create-sm-prometheus-exporters/chainsaw-test.yaml @@ -0,0 +1,66 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: create-sm-prometheus-exporters +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - name: step-01 + try: + - apply: + file: 01-install.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-install.yaml + - assert: + file: 02-assert.yaml + - name: step-03 + try: + - apply: + file: 03-install.yaml + - assert: + file: 03-assert.yaml + - name: step-04 + try: + - apply: + file: 04-error.yaml + - apply: + file: 04-install.yaml + - name: step-05 + try: + - apply: + file: 05-error.yaml + - apply: + file: 05-install.yaml + - assert: + file: 05-assert.yaml + - name: step-06 + try: + - apply: + file: 06-install.yaml + - assert: + file: 06-assert.yaml + - name: step-07 + try: + - delete: + ref: + apiVersion: opentelemetry.io/v1alpha1 + kind: OpenTelemetryCollector + name: simplest + namespace: create-sm-prometheus + - apply: + file: 07-error.yaml + - name: step-08 + try: + - apply: + file: 08-install.yaml + - assert: + file: 08-assert.yaml diff --git a/tests/e2e-targetallocator/targetallocator-features/00-assert.yaml b/tests/e2e-targetallocator/targetallocator-features/00-assert.yaml index 8c917edfd5..823f435484 100644 --- a/tests/e2e-targetallocator/targetallocator-features/00-assert.yaml +++ b/tests/e2e-targetallocator/targetallocator-features/00-assert.yaml @@ -6,24 +6,24 @@ spec: podManagementPolicy: Parallel template: spec: - containers: - - args: - - --config=/conf/collector.yaml - name: otc-container - volumeMounts: - - mountPath: /conf - name: otc-internal - - mountPath: /usr/share/testvolume - name: testvolume - volumes: - - configMap: - items: - - key: collector.yaml - path: collector.yaml - name: stateful-collector - name: otc-internal - - emptyDir: {} - name: testvolume + containers: + - args: + - --config=/conf/collector.yaml + name: otc-container + volumeMounts: + - mountPath: /conf + name: otc-internal + - mountPath: /usr/share/testvolume + name: testvolume + volumes: + - configMap: + items: + - key: collector.yaml + path: collector.yaml + name: stateful-collector + name: otc-internal + - emptyDir: {} + name: testvolume volumeClaimTemplates: - apiVersion: v1 kind: PersistentVolumeClaim @@ -37,8 +37,8 @@ spec: storage: 1Gi volumeMode: Filesystem status: - replicas: 1 readyReplicas: 1 + replicas: 1 --- apiVersion: apps/v1 kind: Deployment @@ -51,70 +51,64 @@ spec: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - - matchExpressions: - - key: ingress-ready - operator: In - values: - - "true" + - matchExpressions: + - key: ingress-ready + operator: In + values: + - "true" + containers: + - args: + - --enable-prometheus-cr-watcher + env: + - name: TEST_ENV + value: test + - name: OTELCOL_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + livenessProbe: + failureThreshold: 3 + httpGet: + path: /livez + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + name: ta-container + readinessProbe: + failureThreshold: 3 + httpGet: + path: /readyz + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + securityContext: + capabilities: + add: + - NET_BIND_SERVICE + drop: + - ALL + privileged: false + runAsGroup: 1000 + runAsUser: 1000 + volumeMounts: + - mountPath: /conf + name: ta-internal securityContext: - runAsUser: 1000 - runAsGroup: 3000 fsGroup: 3000 - containers: - - name: ta-container - args: - - --enable-prometheus-cr-watcher - env: - - name: TEST_ENV - value: "test" - - name: OTELCOL_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - volumeMounts: - - mountPath: /conf - name: ta-internal - readinessProbe: - httpGet: - path: /readyz - successThreshold: 1 - failureThreshold: 3 - timeoutSeconds: 1 - periodSeconds: 10 - securityContext: - runAsUser: 1000 - runAsGroup: 1000 - privileged: false - capabilities: - add: - - NET_BIND_SERVICE - drop: - - ALL - livenessProbe: - httpGet: - path: /livez - successThreshold: 1 - failureThreshold: 3 - timeoutSeconds: 1 - periodSeconds: 10 + runAsGroup: 3000 + runAsUser: 1000 volumes: - - configMap: - items: - - key: targetallocator.yaml - path: targetallocator.yaml - name: stateful-targetallocator - name: ta-internal + - configMap: + items: + - key: targetallocator.yaml + path: targetallocator.yaml + name: stateful-targetallocator + name: ta-internal status: - replicas: 1 readyReplicas: 1 + replicas: 1 --- apiVersion: v1 kind: ConfigMap metadata: name: stateful-targetallocator ---- -# Print TA pod logs if test fails -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -collectors: - - selector: app.kubernetes.io/component=opentelemetry-targetallocator diff --git a/tests/e2e-targetallocator/targetallocator-features/00-install.yaml b/tests/e2e-targetallocator/targetallocator-features/00-install.yaml index 735a23f8a0..bf45fa150a 100644 --- a/tests/e2e-targetallocator/targetallocator-features/00-install.yaml +++ b/tests/e2e-targetallocator/targetallocator-features/00-install.yaml @@ -1,112 +1,102 @@ apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: ta -automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: targetallocator-features rules: -- apiGroups: [""] - resources: [ "pods", "namespaces" ] - verbs: [ "get", "list", "watch"] -- apiGroups: ["monitoring.coreos.com"] - resources: ["servicemonitors"] - verbs: ["get", "list", "watch"] +- apiGroups: + - "" + resources: + - pods + - namespaces + verbs: + - get + - list + - watch +- apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - list + - watch --- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl -n $NAMESPACE create clusterrolebinding default-view-$NAMESPACE --clusterrole=targetallocator-features --serviceaccount=$NAMESPACE:ta - # Annotate the namespace to allow the application to run using an specific group and user in OpenShift - # https://docs.openshift.com/dedicated/authentication/managing-security-context-constraints.html - # This annotation has no effect in Kubernetes - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.uid-range=1000/1000 --overwrite - - command: kubectl annotate namespace ${NAMESPACE} openshift.io/sa.scc.supplemental-groups=3000/1000 --overwrite +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: (join('-', ['default-view', $namespace])) +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: targetallocator-features +subjects: +- kind: ServiceAccount + name: ta + namespace: ($namespace) --- apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: stateful spec: + config: "receivers:\n jaeger:\n protocols:\n grpc:\n\n # Collect own + metrics\n prometheus:\n config:\n scrape_configs:\n - job_name: + 'otel-collector'\n scrape_interval: 10s\n static_configs:\n - + targets: [ '0.0.0.0:8888' ]\n relabel_configs:\n - regex: __meta_kubernetes_node_label_(.+)\n + \ action: labelmap\n replacement: $$1\n - regex: test_.*\n + \ action: labeldrop \n - regex: 'metrica_*|metricb.*'\n action: + labelkeep\n replacement: $$1\n\nprocessors:\n\nexporters:\n debug:\nservice:\n + \ pipelines:\n traces:\n receivers: [jaeger]\n processors: []\n exporters: + [debug]\n" mode: statefulset - volumes: - - name: testvolume - volumeMounts: - - name: testvolume - mountPath: /usr/share/testvolume - volumeClaimTemplates: - - metadata: - name: testvolume - spec: - accessModes: [ "ReadWriteOnce" ] - resources: - requests: - storage: 1Gi targetAllocator: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: ingress-ready + operator: In + values: + - "true" enabled: true - serviceAccount: ta - securityContext: + env: + - name: TEST_ENV + value: test + podSecurityContext: + fsGroup: 3000 + runAsGroup: 3000 runAsUser: 1000 - runAsGroup: 1000 - privileged: false + prometheusCR: + enabled: true + filterStrategy: "" + securityContext: capabilities: add: - NET_BIND_SERVICE drop: - ALL - podSecurityContext: + privileged: false + runAsGroup: 1000 runAsUser: 1000 - runAsGroup: 3000 - fsGroup: 3000 - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: ingress-ready - operator: In - values: - - "true" - prometheusCR: - enabled: true - filterStrategy: "" - env: - - name: TEST_ENV - value: "test" - config: | - receivers: - jaeger: - protocols: - grpc: - - # Collect own metrics - prometheus: - config: - scrape_configs: - - job_name: 'otel-collector' - scrape_interval: 10s - static_configs: - - targets: [ '0.0.0.0:8888' ] - relabel_configs: - - regex: __meta_kubernetes_node_label_(.+) - action: labelmap - replacement: $$1 - - regex: test_.* - action: labeldrop - - regex: 'metrica_*|metricb.*' - action: labelkeep - replacement: $$1 - - processors: - - exporters: - debug: - service: - pipelines: - traces: - receivers: [jaeger] - processors: [] - exporters: [debug] + serviceAccount: ta + volumeClaimTemplates: + - metadata: + name: testvolume + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + volumeMounts: + - mountPath: /usr/share/testvolume + name: testvolume + volumes: + - name: testvolume diff --git a/tests/e2e-targetallocator/targetallocator-features/01-assert.yaml b/tests/e2e-targetallocator/targetallocator-features/01-assert.yaml index 7e1a837f98..5e87569820 100644 --- a/tests/e2e-targetallocator/targetallocator-features/01-assert.yaml +++ b/tests/e2e-targetallocator/targetallocator-features/01-assert.yaml @@ -1,8 +1,3 @@ -# waiting for liveness probe to work -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -timeout: 5 ---- apiVersion: v1 kind: Pod metadata: @@ -10,5 +5,5 @@ metadata: app.kubernetes.io/component: opentelemetry-targetallocator status: containerStatuses: - - name: ta-container - restartCount: 0 + - name: ta-container + restartCount: 0 diff --git a/tests/e2e-targetallocator/targetallocator-features/01-liveness.yaml b/tests/e2e-targetallocator/targetallocator-features/01-liveness.yaml deleted file mode 100644 index db15c603f3..0000000000 --- a/tests/e2e-targetallocator/targetallocator-features/01-liveness.yaml +++ /dev/null @@ -1,5 +0,0 @@ -# waiting for liveness probe to work -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: -- command: sleep 35 diff --git a/tests/e2e-targetallocator/targetallocator-features/chainsaw-test.yaml b/tests/e2e-targetallocator/targetallocator-features/chainsaw-test.yaml new file mode 100755 index 0000000000..555326724d --- /dev/null +++ b/tests/e2e-targetallocator/targetallocator-features/chainsaw-test.yaml @@ -0,0 +1,29 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: targetallocator-features +spec: + namespaceTemplate: + metadata: + annotations: + openshift.io/sa.scc.uid-range: 1000/1000 + openshift.io/sa.scc.supplemental-groups: 3000/1000 + steps: + - name: step-00 + try: + - apply: + template: true + file: 00-install.yaml + - assert: + file: 00-assert.yaml + catch: + - podLogs: + selector: app.kubernetes.io/component=opentelemetry-targetallocator + - name: step-01 + try: + - sleep: + duration: 35s + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-targetallocator/targetallocator-kubernetessd/00-assert.yaml b/tests/e2e-targetallocator/targetallocator-kubernetessd/00-assert.yaml index 3875ffb539..88d16ed604 100644 --- a/tests/e2e-targetallocator/targetallocator-kubernetessd/00-assert.yaml +++ b/tests/e2e-targetallocator/targetallocator-kubernetessd/00-assert.yaml @@ -1,18 +1,11 @@ -# This KUTTL assert uses the check-daemonset.sh script to ensure the number of ready pods in a daemonset matches the desired count, retrying until successful or a timeout occurs. The script is needed as the number of Kubernetes cluster nodes can vary and we cannot statically set desiredNumberScheduled and numberReady in the assert for daemonset status. - -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -- script: ./tests/e2e/smoke-daemonset/check-daemonset.sh ---- apiVersion: apps/v1 kind: Deployment metadata: name: prometheus-kubernetessd-targetallocator status: - replicas: 1 - readyReplicas: 1 observedGeneration: 1 + readyReplicas: 1 + replicas: 1 --- apiVersion: v1 kind: ConfigMap @@ -44,8 +37,10 @@ data: receivers: - prometheus --- -# Print TA pod logs if test fails -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -collectors: - - selector: app.kubernetes.io/managed-by=opentelemetry-operator +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: prometheus-kubernetessd-collector +status: + numberMisscheduled: 0 + (desiredNumberScheduled == numberReady): true diff --git a/tests/e2e-targetallocator/targetallocator-kubernetessd/00-install.yaml b/tests/e2e-targetallocator/targetallocator-kubernetessd/00-install.yaml index 6b4b2f1c18..893712184d 100644 --- a/tests/e2e-targetallocator/targetallocator-kubernetessd/00-install.yaml +++ b/tests/e2e-targetallocator/targetallocator-kubernetessd/00-install.yaml @@ -1,105 +1,128 @@ apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: ta -automountServiceAccountToken: true --- apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: collector -automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: targetallocator-kubernetessd rules: -- apiGroups: [""] +- apiGroups: + - "" resources: - - pods - - nodes - - services - - endpoints - - configmaps - - secrets - - namespaces + - pods + - nodes + - services + - endpoints + - configmaps + - secrets + - namespaces verbs: - - get - - watch - - list -- apiGroups: ["apps"] + - get + - watch + - list +- apiGroups: + - apps resources: - - statefulsets - - daemonsets - - services - - endpoints + - statefulsets + - daemonsets + - services + - endpoints verbs: - - get - - watch - - list -- apiGroups: ["discovery.k8s.io"] + - get + - watch + - list +- apiGroups: + - discovery.k8s.io resources: - - endpointslices + - endpointslices verbs: - - get - - watch - - list -- apiGroups: ["networking.k8s.io"] + - get + - watch + - list +- apiGroups: + - networking.k8s.io resources: - - ingresses + - ingresses verbs: - - get - - watch - - list -- nonResourceURLs: ["/metrics"] - verbs: ["get"] + - get + - watch + - list +- nonResourceURLs: + - /metrics + verbs: + - get --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: collector-kubernetessd rules: -- apiGroups: [""] +- apiGroups: + - "" resources: - - pods - - nodes - - nodes/metrics - - services - - endpoints + - pods + - nodes + - nodes/metrics + - services + - endpoints verbs: - - get - - watch - - list -- apiGroups: ["networking.k8s.io"] + - get + - watch + - list +- apiGroups: + - networking.k8s.io resources: - - ingresses + - ingresses + verbs: + - get + - watch + - list +- nonResourceURLs: + - /metrics + - /metrics/cadvisor verbs: - - get - - watch - - list -- nonResourceURLs: ["/metrics", "/metrics/cadvisor"] - verbs: ["get"] + - get --- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl create clusterrolebinding ta-$NAMESPACE --clusterrole=targetallocator-kubernetessd --serviceaccount=$NAMESPACE:ta - - command: kubectl create clusterrolebinding collector-$NAMESPACE --clusterrole=collector-kubernetessd --serviceaccount=$NAMESPACE:collector +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: (join('-', ['ta', $namespace])) +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: targetallocator-kubernetessd +subjects: +- kind: ServiceAccount + name: ta + namespace: ($namespace) +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: (join('-', ['collector', $namespace])) +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: collector-kubernetessd +subjects: +- kind: ServiceAccount + name: collector + namespace: ($namespace) --- apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: prometheus-kubernetessd spec: - mode: daemonset - serviceAccount: collector - targetAllocator: - enabled: true - allocationStrategy: "per-node" - serviceAccount: ta - prometheusCR: - enabled: false config: | receivers: prometheus: @@ -131,3 +154,11 @@ spec: receivers: [prometheus] processors: [] exporters: [prometheus] + mode: daemonset + serviceAccount: collector + targetAllocator: + allocationStrategy: per-node + enabled: true + prometheusCR: + enabled: false + serviceAccount: ta diff --git a/tests/e2e-targetallocator/targetallocator-kubernetessd/chainsaw-test.yaml b/tests/e2e-targetallocator/targetallocator-kubernetessd/chainsaw-test.yaml new file mode 100755 index 0000000000..8e5aae1b58 --- /dev/null +++ b/tests/e2e-targetallocator/targetallocator-kubernetessd/chainsaw-test.yaml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: targetallocator-kubernetessd +spec: + steps: + - name: step-00 + try: + - apply: + template: true + file: 00-install.yaml + - assert: + file: 00-assert.yaml + catch: + - podLogs: + selector: app.kubernetes.io/managed-by=opentelemetry-operator + - name: step-01 + try: + - apply: + file: 01-install.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-targetallocator/targetallocator-kubernetessd/check-daemonset.sh b/tests/e2e-targetallocator/targetallocator-kubernetessd/check-daemonset.sh deleted file mode 100755 index ae9c64b8d9..0000000000 --- a/tests/e2e-targetallocator/targetallocator-kubernetessd/check-daemonset.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# Name of the daemonset to check -DAEMONSET_NAME="prometheus-kubernetessd-collector" - -# Get the desired and ready pod counts for the daemonset -read DESIRED READY <<< $(kubectl get daemonset -n $NAMESPACE $DAEMONSET_NAME -o custom-columns=:status.desiredNumberScheduled,:status.numberReady --no-headers) - -# Check if the desired count matches the ready count -if [ "$DESIRED" -eq "$READY" ]; then - echo "Desired count ($DESIRED) matches the ready count ($READY) for $DAEMONSET_NAME." -else - echo "Desired count ($DESIRED) does not match the ready count ($READY) for $DAEMONSET_NAME." - exit 1 -fi diff --git a/tests/e2e-targetallocator/targetallocator-prometheuscr/00-assert.yaml b/tests/e2e-targetallocator/targetallocator-prometheuscr/00-assert.yaml index 98b57419d4..66a10f2f1d 100644 --- a/tests/e2e-targetallocator/targetallocator-prometheuscr/00-assert.yaml +++ b/tests/e2e-targetallocator/targetallocator-prometheuscr/00-assert.yaml @@ -3,17 +3,17 @@ kind: StatefulSet metadata: name: prometheus-cr-collector status: - replicas: 1 readyReplicas: 1 + replicas: 1 --- apiVersion: apps/v1 kind: Deployment metadata: name: prometheus-cr-targetallocator status: - replicas: 1 - readyReplicas: 1 observedGeneration: 1 + readyReplicas: 1 + replicas: 1 --- apiVersion: v1 kind: ConfigMap @@ -21,9 +21,6 @@ metadata: name: prometheus-cr-targetallocator --- apiVersion: v1 -kind: ConfigMap -metadata: - name: prometheus-cr-collector data: collector.yaml: | exporters: @@ -44,9 +41,6 @@ data: processors: [] receivers: - prometheus ---- -# Print TA pod logs if test fails -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -collectors: - - selector: app.kubernetes.io/managed-by=opentelemetry-operator +kind: ConfigMap +metadata: + name: prometheus-cr-collector diff --git a/tests/e2e-targetallocator/targetallocator-prometheuscr/00-install.yaml b/tests/e2e-targetallocator/targetallocator-prometheuscr/00-install.yaml index ea2bc1ed86..8a693e0213 100644 --- a/tests/e2e-targetallocator/targetallocator-prometheuscr/00-install.yaml +++ b/tests/e2e-targetallocator/targetallocator-prometheuscr/00-install.yaml @@ -1,113 +1,137 @@ apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: ta -automountServiceAccountToken: true --- apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: collector -automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: targetallocator-prometheuscr rules: -- apiGroups: [""] +- apiGroups: + - "" resources: - - pods - - nodes - - services - - endpoints - - configmaps - - secrets - - namespaces + - pods + - nodes + - services + - endpoints + - configmaps + - secrets + - namespaces verbs: - - get - - watch - - list -- apiGroups: ["apps"] + - get + - watch + - list +- apiGroups: + - apps resources: - - statefulsets - - services - - endpoints + - statefulsets + - services + - endpoints verbs: - - get - - watch - - list -- apiGroups: ["discovery.k8s.io"] + - get + - watch + - list +- apiGroups: + - discovery.k8s.io resources: - - endpointslices + - endpointslices verbs: - - get - - watch - - list -- apiGroups: ["networking.k8s.io"] + - get + - watch + - list +- apiGroups: + - networking.k8s.io resources: - - ingresses + - ingresses verbs: - - get - - watch - - list -- apiGroups: ["monitoring.coreos.com"] + - get + - watch + - list +- apiGroups: + - monitoring.coreos.com resources: - - servicemonitors - - podmonitors + - servicemonitors + - podmonitors verbs: - - get - - watch - - list -- nonResourceURLs: ["/metrics"] - verbs: ["get"] + - get + - watch + - list +- nonResourceURLs: + - /metrics + verbs: + - get --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: collector-prometheuscr rules: -- apiGroups: [""] +- apiGroups: + - "" resources: - - pods - - nodes - - nodes/metrics - - services - - endpoints - - namespaces + - pods + - nodes + - nodes/metrics + - services + - endpoints + - namespaces verbs: - - get - - watch - - list -- apiGroups: ["networking.k8s.io"] + - get + - watch + - list +- apiGroups: + - networking.k8s.io resources: - - ingresses + - ingresses + verbs: + - get + - watch + - list +- nonResourceURLs: + - /metrics + - /metrics/cadvisor verbs: - - get - - watch - - list -- nonResourceURLs: ["/metrics", "/metrics/cadvisor"] - verbs: ["get"] + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: (join('-', ['ta', $namespace])) +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: targetallocator-prometheuscr +subjects: +- kind: ServiceAccount + name: ta + namespace: ($namespace) --- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl create clusterrolebinding ta-$NAMESPACE --clusterrole=targetallocator-prometheuscr --serviceaccount=$NAMESPACE:ta - - command: kubectl create clusterrolebinding collector-$NAMESPACE --clusterrole=collector-prometheuscr --serviceaccount=$NAMESPACE:collector +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: (join('-', ['collector', $namespace])) +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: collector-prometheuscr +subjects: +- kind: ServiceAccount + name: collector + namespace: ($namespace) --- apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: prometheus-cr spec: - mode: statefulset - serviceAccount: collector - targetAllocator: - enabled: true - serviceAccount: ta - scrapeInterval: 1s - prometheusCR: - enabled: true config: | receivers: prometheus: @@ -125,6 +149,14 @@ spec: receivers: [prometheus] processors: [] exporters: [prometheus] + mode: statefulset + serviceAccount: collector + targetAllocator: + enabled: true + prometheusCR: + enabled: true + scrapeInterval: 1s + serviceAccount: ta --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor diff --git a/tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml b/tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml new file mode 100755 index 0000000000..c361477488 --- /dev/null +++ b/tests/e2e-targetallocator/targetallocator-prometheuscr/chainsaw-test.yaml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: targetallocator-prometheuscr +spec: + steps: + - name: step-00 + try: + - apply: + template: true + file: 00-install.yaml + - assert: + file: 00-assert.yaml + catch: + - podLogs: + selector: app.kubernetes.io/managed-by=opentelemetry-operator + - name: step-01 + try: + - apply: + file: 01-install.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e-upgrade/upgrade-test/01-upgrade-operator.yaml b/tests/e2e-upgrade/upgrade-test/01-upgrade-operator.yaml deleted file mode 100644 index 248ffb6a9a..0000000000 --- a/tests/e2e-upgrade/upgrade-test/01-upgrade-operator.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: cd ../../../ && make deploy VERSION=e2e diff --git a/tests/e2e-upgrade/upgrade-test/chainsaw-test.yaml b/tests/e2e-upgrade/upgrade-test/chainsaw-test.yaml new file mode 100755 index 0000000000..ee9ce0d75b --- /dev/null +++ b/tests/e2e-upgrade/upgrade-test/chainsaw-test.yaml @@ -0,0 +1,25 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: upgrade-test +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - script: + timeout: 5m + content: cd ../../../ && make deploy VERSION=e2e + - name: step-02 + try: + - apply: + file: 02-upgrade-collector.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e/daemonset-features/00-add-scc.yaml b/tests/e2e/daemonset-features/00-add-scc.yaml deleted file mode 100644 index 63d417ea96..0000000000 --- a/tests/e2e/daemonset-features/00-add-scc.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: ./add-scc-openshift.sh diff --git a/tests/e2e/daemonset-features/03-add-sa-collector.yaml b/tests/e2e/daemonset-features/03-add-sa-collector.yaml deleted file mode 100644 index 1da56ca212..0000000000 --- a/tests/e2e/daemonset-features/03-add-sa-collector.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: ./add-sa-collector.sh diff --git a/tests/e2e/daemonset-features/chainsaw-test.yaml b/tests/e2e/daemonset-features/chainsaw-test.yaml new file mode 100755 index 0000000000..10802fc758 --- /dev/null +++ b/tests/e2e/daemonset-features/chainsaw-test.yaml @@ -0,0 +1,26 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: daemonset-features +spec: + steps: + - name: step-00 + try: + - script: + content: ./add-scc-openshift.sh + - name: step-01 + try: + - apply: + file: 01-install.yaml + - name: step-02 + try: + - assert: + file: 02-assert.yaml + - name: step-03 + try: + - script: + content: ./add-sa-collector.sh + - assert: + file: 03-assert.yaml diff --git a/tests/e2e/ingress-subdomains/01-report-empty-otlphttp-spans.yaml b/tests/e2e/ingress-subdomains/01-report-empty-otlphttp-spans.yaml deleted file mode 100644 index b20290f8a7..0000000000 --- a/tests/e2e/ingress-subdomains/01-report-empty-otlphttp-spans.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - script: | - #!/bin/bash - set -ex - # Export empty payload and check of collector accepted it with 2xx status code - for i in {1..40}; do curl --fail -ivX POST --resolve 'otlp-http.test.otel:80:127.0.0.1' http://otlp-http.test.otel:80/v1/traces -H "Content-Type: application/json" -d '{}' && break || sleep 1; done diff --git a/tests/e2e/ingress-subdomains/chainsaw-test.yaml b/tests/e2e/ingress-subdomains/chainsaw-test.yaml new file mode 100755 index 0000000000..32b38ccec6 --- /dev/null +++ b/tests/e2e/ingress-subdomains/chainsaw-test.yaml @@ -0,0 +1,22 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: ingress-subdomains +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - script: + content: | + #!/bin/bash + set -ex + # Export empty payload and check of collector accepted it with 2xx status code + for i in {1..40}; do curl --fail -ivX POST --resolve 'otlp-http.test.otel:80:127.0.0.1' http://otlp-http.test.otel:80/v1/traces -H "Content-Type: application/json" -d '{}' && break || sleep 1; done diff --git a/tests/e2e/ingress/chainsaw-test.yaml b/tests/e2e/ingress/chainsaw-test.yaml new file mode 100755 index 0000000000..72a7fa61e6 --- /dev/null +++ b/tests/e2e/ingress/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: ingress +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/managed-reconcile/chainsaw-test.yaml b/tests/e2e/managed-reconcile/chainsaw-test.yaml new file mode 100755 index 0000000000..85d09e17c7 --- /dev/null +++ b/tests/e2e/managed-reconcile/chainsaw-test.yaml @@ -0,0 +1,26 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: managed-reconcile +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - apply: + file: 01-disable-reconciliation.yaml + - assert: + file: 01-assert.yaml + - name: step-02 + try: + - apply: + file: 02-enable-reconciliation.yaml + - assert: + file: 02-assert.yaml diff --git a/tests/e2e/multiple-configmaps/chainsaw-test.yaml b/tests/e2e/multiple-configmaps/chainsaw-test.yaml new file mode 100755 index 0000000000..889c80424b --- /dev/null +++ b/tests/e2e/multiple-configmaps/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: multiple-configmaps +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/prometheus-config-validation/00-assert.yaml b/tests/e2e/prometheus-config-validation/00-assert.yaml index 3f4f177968..db1ec4004a 100644 --- a/tests/e2e/prometheus-config-validation/00-assert.yaml +++ b/tests/e2e/prometheus-config-validation/00-assert.yaml @@ -3,23 +3,13 @@ kind: StatefulSet metadata: name: promreceiver-allocatorconfig-collector status: - replicas: 1 readyReplicas: 1 + replicas: 1 --- apiVersion: apps/v1 kind: Deployment metadata: name: promreceiver-allocatorconfig-targetallocator status: - replicas: 1 readyReplicas: 1 ---- -# Print TA and operator logs if test fails -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -collectors: - - selector: app.kubernetes.io/component=opentelemetry-targetallocator - - selector: app.kubernetes.io/component=opentelemetry-collector - - selector: app.kubernetes.io/name=opentelemetry-operator - namespace: opentelemetry-operator-system - container: manager + replicas: 1 diff --git a/tests/e2e/prometheus-config-validation/00-promreceiver-allocatorconfig.yaml b/tests/e2e/prometheus-config-validation/00-promreceiver-allocatorconfig.yaml index c57c26f167..17e7d4ec0c 100644 --- a/tests/e2e/prometheus-config-validation/00-promreceiver-allocatorconfig.yaml +++ b/tests/e2e/prometheus-config-validation/00-promreceiver-allocatorconfig.yaml @@ -1,33 +1,42 @@ apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: ta -automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: promreceiver-allocatorconfig rules: -- apiGroups: [""] - resources: [ "pods", "namespaces" ] - verbs: [ "get", "list", "watch"] +- apiGroups: + - "" + resources: + - pods + - namespaces + verbs: + - get + - list + - watch --- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl -n $NAMESPACE create clusterrolebinding default-view-$NAMESPACE --clusterrole=promreceiver-allocatorconfig --serviceaccount=$NAMESPACE:ta +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: (join('-', ['default-view', $namespace])) +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: promreceiver-allocatorconfig +subjects: +- kind: ServiceAccount + name: ta + namespace: ($namespace) --- apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: promreceiver-allocatorconfig spec: - mode: statefulset - targetAllocator: - enabled: true - serviceAccount: ta - config: | receivers: jaeger: @@ -64,3 +73,7 @@ spec: receivers: [jaeger] processors: [] exporters: [debug] + mode: statefulset + targetAllocator: + enabled: true + serviceAccount: ta diff --git a/tests/e2e/prometheus-config-validation/02-assert.yaml b/tests/e2e/prometheus-config-validation/02-assert.yaml index 33727878de..c60931bb18 100644 --- a/tests/e2e/prometheus-config-validation/02-assert.yaml +++ b/tests/e2e/prometheus-config-validation/02-assert.yaml @@ -3,23 +3,13 @@ kind: StatefulSet metadata: name: promreceiver-allocatorconfig-extra-collector status: - replicas: 1 readyReplicas: 1 + replicas: 1 --- apiVersion: apps/v1 kind: Deployment metadata: name: promreceiver-allocatorconfig-extra-targetallocator status: - replicas: 1 readyReplicas: 1 ---- -# Print TA and operator logs if test fails -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -collectors: - - selector: app.kubernetes.io/component=opentelemetry-targetallocator - - selector: app.kubernetes.io/component=opentelemetry-collector - - selector: app.kubernetes.io/name=opentelemetry-operator - namespace: opentelemetry-operator-system - container: manager + replicas: 1 diff --git a/tests/e2e/prometheus-config-validation/03-assert.yaml b/tests/e2e/prometheus-config-validation/03-assert.yaml index b9c6d5d5eb..7edc6dd893 100644 --- a/tests/e2e/prometheus-config-validation/03-assert.yaml +++ b/tests/e2e/prometheus-config-validation/03-assert.yaml @@ -3,23 +3,13 @@ kind: StatefulSet metadata: name: promreceiver-nopromconfig-collector status: - replicas: 1 readyReplicas: 1 + replicas: 1 --- apiVersion: apps/v1 kind: Deployment metadata: name: promreceiver-nopromconfig-targetallocator status: - replicas: 1 readyReplicas: 1 ---- -# Print TA and operator logs if test fails -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -collectors: - - selector: app.kubernetes.io/component=opentelemetry-targetallocator - - selector: app.kubernetes.io/component=opentelemetry-collector - - selector: app.kubernetes.io/name=opentelemetry-operator - namespace: opentelemetry-operator-system - container: manager + replicas: 1 diff --git a/tests/e2e/prometheus-config-validation/chainsaw-test.yaml b/tests/e2e/prometheus-config-validation/chainsaw-test.yaml new file mode 100755 index 0000000000..3e5473d696 --- /dev/null +++ b/tests/e2e/prometheus-config-validation/chainsaw-test.yaml @@ -0,0 +1,50 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: prometheus-config-validation +spec: + steps: + - name: step-00 + try: + - apply: + template: true + file: 00-promreceiver-allocatorconfig.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - apply: + file: 01-promreceiver-labeldrop.yaml + - name: step-02 + try: + - apply: + file: 02-promreceiver-allocatorconfig-extra.yaml + - assert: + file: 02-assert.yaml + catch: + - podLogs: + selector: app.kubernetes.io/component=opentelemetry-targetallocator + - podLogs: + selector: app.kubernetes.io/component=opentelemetry-collector + - podLogs: + container: manager + namespace: opentelemetry-operator-system + selector: app.kubernetes.io/name=opentelemetry-operator + - name: step-03 + try: + - apply: + file: 03-promreceiver-nopromconfig.yaml + - assert: + file: 03-assert.yaml + catch: + - podLogs: + selector: app.kubernetes.io/component=opentelemetry-targetallocator + - podLogs: + selector: app.kubernetes.io/component=opentelemetry-collector + - podLogs: + container: manager + namespace: opentelemetry-operator-system + selector: app.kubernetes.io/name=opentelemetry-operator + \ No newline at end of file diff --git a/tests/e2e/smoke-daemonset/00-assert.yaml b/tests/e2e/smoke-daemonset/00-assert.yaml index 7dff619578..d2090f3e2e 100644 --- a/tests/e2e/smoke-daemonset/00-assert.yaml +++ b/tests/e2e/smoke-daemonset/00-assert.yaml @@ -4,17 +4,10 @@ metadata: name: daemonset-test-collector spec: updateStrategy: - type: RollingUpdate rollingUpdate: maxSurge: 0 maxUnavailable: 1 + type: RollingUpdate status: numberMisscheduled: 0 - ---- -# This KUTTL assert uses the check-daemonset.sh script to ensure the number of ready pods in a daemonset matches the desired count, retrying until successful or a timeout occurs. The script is needed as the number of Kubernetes cluster nodes can vary and we cannot statically set desiredNumberScheduled and numberReady in the assert for daemonset status. - -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -commands: -- script: ./tests/e2e/smoke-daemonset/check-daemonset.sh + (desiredNumberScheduled == numberReady): true diff --git a/tests/e2e/smoke-daemonset/chainsaw-test.yaml b/tests/e2e/smoke-daemonset/chainsaw-test.yaml new file mode 100644 index 0000000000..fd1fc16417 --- /dev/null +++ b/tests/e2e/smoke-daemonset/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-daemonset +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/smoke-daemonset/check-daemonset.sh b/tests/e2e/smoke-daemonset/check-daemonset.sh deleted file mode 100755 index 4e6c2d8062..0000000000 --- a/tests/e2e/smoke-daemonset/check-daemonset.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# Name of the daemonset to check -DAEMONSET_NAME="daemonset-test-collector" - -# Get the desired and ready pod counts for the daemonset -read DESIRED READY <<< $(kubectl get daemonset -n $NAMESPACE $DAEMONSET_NAME -o custom-columns=:status.desiredNumberScheduled,:status.numberReady --no-headers) - -# Check if the desired count matches the ready count -if [ "$DESIRED" -eq "$READY" ]; then - echo "Desired count ($DESIRED) matches the ready count ($READY) for $DAEMONSET_NAME." -else - echo "Desired count ($DESIRED) does not match the ready count ($READY) for $DAEMONSET_NAME." - exit 1 -fi diff --git a/tests/e2e/smoke-init-containers/chainsaw-test.yaml b/tests/e2e/smoke-init-containers/chainsaw-test.yaml new file mode 100755 index 0000000000..1bd1eecc0b --- /dev/null +++ b/tests/e2e/smoke-init-containers/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-init-containers +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/smoke-pod-annotations/chainsaw-test.yaml b/tests/e2e/smoke-pod-annotations/chainsaw-test.yaml new file mode 100755 index 0000000000..671d28ace3 --- /dev/null +++ b/tests/e2e/smoke-pod-annotations/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-pod-annotations +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/smoke-pod-labels/chainsaw-test.yaml b/tests/e2e/smoke-pod-labels/chainsaw-test.yaml new file mode 100755 index 0000000000..6f57a92dc5 --- /dev/null +++ b/tests/e2e/smoke-pod-labels/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-pod-labels +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/smoke-restarting-deployment/chainsaw-test.yaml b/tests/e2e/smoke-restarting-deployment/chainsaw-test.yaml new file mode 100755 index 0000000000..7f6904365b --- /dev/null +++ b/tests/e2e/smoke-restarting-deployment/chainsaw-test.yaml @@ -0,0 +1,22 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-restarting-deployment +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml + - error: + file: 00-errors.yaml + - name: step-01 + try: + - apply: + file: 01-install-second-config.yaml + - assert: + file: 01-assert-second-config.yaml diff --git a/tests/e2e/smoke-shareprocessnamespace/chainsaw-test.yaml b/tests/e2e/smoke-shareprocessnamespace/chainsaw-test.yaml new file mode 100755 index 0000000000..a1097bfac4 --- /dev/null +++ b/tests/e2e/smoke-shareprocessnamespace/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-shareprocessnamespace +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/smoke-sidecar-other-namespace/chainsaw-test.yaml b/tests/e2e/smoke-sidecar-other-namespace/chainsaw-test.yaml new file mode 100755 index 0000000000..3003608d9e --- /dev/null +++ b/tests/e2e/smoke-sidecar-other-namespace/chainsaw-test.yaml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-sidecar-other-namespace +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e/smoke-sidecar/chainsaw-test.yaml b/tests/e2e/smoke-sidecar/chainsaw-test.yaml new file mode 100755 index 0000000000..654385eef6 --- /dev/null +++ b/tests/e2e/smoke-sidecar/chainsaw-test.yaml @@ -0,0 +1,18 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-sidecar +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - name: step-01 + try: + - apply: + file: 01-install-app.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e/smoke-simplest/chainsaw-test.yaml b/tests/e2e/smoke-simplest/chainsaw-test.yaml new file mode 100755 index 0000000000..988d0cd7e3 --- /dev/null +++ b/tests/e2e/smoke-simplest/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-simplest +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/smoke-statefulset/chainsaw-test.yaml b/tests/e2e/smoke-statefulset/chainsaw-test.yaml new file mode 100755 index 0000000000..79ae83450d --- /dev/null +++ b/tests/e2e/smoke-statefulset/chainsaw-test.yaml @@ -0,0 +1,14 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-statefulset +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml diff --git a/tests/e2e/smoke-targetallocator/00-assert.yaml b/tests/e2e/smoke-targetallocator/00-assert.yaml index 12d69b49ea..35a1d6356f 100644 --- a/tests/e2e/smoke-targetallocator/00-assert.yaml +++ b/tests/e2e/smoke-targetallocator/00-assert.yaml @@ -3,17 +3,17 @@ kind: StatefulSet metadata: name: stateful-collector status: - replicas: 1 readyReplicas: 1 + replicas: 1 --- apiVersion: apps/v1 kind: Deployment metadata: name: stateful-targetallocator status: - replicas: 1 - readyReplicas: 1 observedGeneration: 1 + readyReplicas: 1 + replicas: 1 --- apiVersion: v1 kind: ConfigMap @@ -21,9 +21,6 @@ metadata: name: stateful-targetallocator --- apiVersion: v1 -kind: ConfigMap -metadata: - name: stateful-collector data: collector.yaml: | exporters: @@ -46,9 +43,6 @@ data: processors: [] receivers: - jaeger ---- -# Print TA pod logs if test fails -apiVersion: kuttl.dev/v1beta1 -kind: TestAssert -collectors: - - selector: app.kubernetes.io/component=opentelemetry-targetallocator +kind: ConfigMap +metadata: + name: stateful-collector diff --git a/tests/e2e/smoke-targetallocator/00-install.yaml b/tests/e2e/smoke-targetallocator/00-install.yaml index 1e87777118..585a293aa0 100644 --- a/tests/e2e/smoke-targetallocator/00-install.yaml +++ b/tests/e2e/smoke-targetallocator/00-install.yaml @@ -1,32 +1,42 @@ apiVersion: v1 +automountServiceAccountToken: true kind: ServiceAccount metadata: name: ta -automountServiceAccountToken: true --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: smoke-targetallocator rules: -- apiGroups: [""] - resources: [ "pods", "namespaces" ] - verbs: [ "get", "list", "watch"] +- apiGroups: + - "" + resources: + - pods + - namespaces + verbs: + - get + - list + - watch --- -apiVersion: kuttl.dev/v1beta1 -kind: TestStep -commands: - - command: kubectl -n $NAMESPACE create clusterrolebinding default-view-$NAMESPACE --clusterrole=smoke-targetallocator --serviceaccount=$NAMESPACE:ta +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: (join('-', ['default-view', $namespace])) +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: smoke-targetallocator +subjects: +- kind: ServiceAccount + name: ta + namespace: ($namespace) --- apiVersion: opentelemetry.io/v1alpha1 kind: OpenTelemetryCollector metadata: name: stateful spec: - mode: statefulset - targetAllocator: - enabled: true - serviceAccount: ta config: | receivers: jaeger: @@ -52,3 +62,7 @@ spec: receivers: [jaeger] processors: [] exporters: [debug] + mode: statefulset + targetAllocator: + enabled: true + serviceAccount: ta diff --git a/tests/e2e/smoke-targetallocator/chainsaw-test.yaml b/tests/e2e/smoke-targetallocator/chainsaw-test.yaml new file mode 100755 index 0000000000..242d3ef257 --- /dev/null +++ b/tests/e2e/smoke-targetallocator/chainsaw-test.yaml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: smoke-targetallocator +spec: + steps: + - name: step-00 + try: + - apply: + template: true + file: 00-install.yaml + - assert: + file: 00-assert.yaml + catch: + - podLogs: + selector: app.kubernetes.io/component=opentelemetry-targetallocator + - name: step-01 + try: + - apply: + file: 01-change-ta-config.yaml + - assert: + file: 01-assert.yaml diff --git a/tests/e2e/statefulset-features/chainsaw-test.yaml b/tests/e2e/statefulset-features/chainsaw-test.yaml new file mode 100755 index 0000000000..c73d8ae7d2 --- /dev/null +++ b/tests/e2e/statefulset-features/chainsaw-test.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json +apiVersion: chainsaw.kyverno.io/v1alpha1 +kind: Test +metadata: + creationTimestamp: null + name: statefulset-features +spec: + steps: + - name: step-00 + try: + - apply: + file: 00-install.yaml + - assert: + file: 00-assert.yaml + - name: step-01 + try: + - apply: + file: 01-update-volume-claim-templates.yaml + - assert: + file: 01-assert.yaml diff --git a/versions.txt b/versions.txt index 7f05eb8c53..1682c360d8 100644 --- a/versions.txt +++ b/versions.txt @@ -2,20 +2,20 @@ # by default with the OpenTelemetry Operator. This would usually be the latest # stable OpenTelemetry version. When you update this file, make sure to update the # the docs as well. -opentelemetry-collector=0.93.0 +opentelemetry-collector=0.94.0 # Represents the current release of the OpenTelemetry Operator. -operator=0.93.0 +operator=0.94.0 # Represents the current release of the Target Allocator. -targetallocator=0.93.0 +targetallocator=0.94.0 # Represents the current release of the Operator OpAMP Bridge. -operator-opamp-bridge=0.93.0 +operator-opamp-bridge=0.94.0 # Represents the current release of Java instrumentation. # Should match autoinstrumentation/java/version.txt -autoinstrumentation-java=1.32.0 +autoinstrumentation-java=1.32.1 # Represents the current release of NodeJS instrumentation. # Should match value in autoinstrumentation/nodejs/package.json