From 960c0ca16dce044e6b98f95d4e61c9b3f147904b Mon Sep 17 00:00:00 2001 From: Matt Christiansen Date: Tue, 8 Aug 2023 14:23:38 -0700 Subject: [PATCH] Adding in an assertion that the additional container equals input --- .../opentelemetry-operator.clusterserviceversion.yaml | 2 +- .../manifests/opentelemetry.io_opentelemetrycollectors.yaml | 4 ++-- .../crd/bases/opentelemetry.io_opentelemetrycollectors.yaml | 4 ++-- docs/api.md | 2 +- internal/manifests/collector/daemonset_test.go | 1 + internal/manifests/collector/deployment_test.go | 1 + internal/manifests/collector/statefulset_test.go | 1 + 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml b/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml index db547b7a81..1bc34259f1 100644 --- a/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml +++ b/bundle/manifests/opentelemetry-operator.clusterserviceversion.yaml @@ -31,7 +31,7 @@ metadata: categories: Logging & Tracing certified: "false" containerImage: ghcr.io/open-telemetry/opentelemetry-operator/opentelemetry-operator - createdAt: "2023-08-04T20:52:54Z" + createdAt: "2023-08-08T21:23:14Z" 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 diff --git a/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml b/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml index 22a2ffef46..776a0f8a75 100644 --- a/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml +++ b/bundle/manifests/opentelemetry.io_opentelemetrycollectors.yaml @@ -66,8 +66,8 @@ spec: additionalContainers: description: "AdditionalContainers allows injecting additional containers into the Collector's pod definition. These sidecar containers can - be used to authentication proxies, logging shipping sidecars, agents - for shipping to metrics to their cloud, or in general sidecars that + be used for authentication proxies, logging shipping sidecars, agents + for shipping metrics to their cloud, or in general sidecars that do not support automatic injection. This option only applies to Deployment, DaemonSet, and StatefulSet deployments of the collector. It does not apply to the sidecar method. More info: https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ diff --git a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml index c57a08cc3b..5fe32768b3 100644 --- a/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml +++ b/config/crd/bases/opentelemetry.io_opentelemetrycollectors.yaml @@ -63,8 +63,8 @@ spec: additionalContainers: description: "AdditionalContainers allows injecting additional containers into the Collector's pod definition. These sidecar containers can - be used to authentication proxies, logging shipping sidecars, agents - for shipping to metrics to their cloud, or in general sidecars that + be used for authentication proxies, logging shipping sidecars, agents + for shipping metrics to their cloud, or in general sidecars that do not support automatic injection. This option only applies to Deployment, DaemonSet, and StatefulSet deployments of the collector. It does not apply to the sidecar method. More info: https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ diff --git a/docs/api.md b/docs/api.md index f265242104..3556dd31d4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -3615,7 +3615,7 @@ OpenTelemetryCollectorSpec defines the desired state of OpenTelemetryCollector. additionalContainers []object - AdditionalContainers allows injecting additional containers into the Collector's pod definition. These sidecar containers can be used to authentication proxies, logging shipping sidecars, agents for shipping to metrics to their cloud, or in general sidecars that do not support automatic injection. This option only applies to Deployment, DaemonSet, and StatefulSet deployments of the collector. It does not apply to the sidecar method. More info: https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ + AdditionalContainers allows injecting additional containers into the Collector's pod definition. These sidecar containers can be used for authentication proxies, logging shipping sidecars, agents for shipping metrics to their cloud, or in general sidecars that do not support automatic injection. This option only applies to Deployment, DaemonSet, and StatefulSet deployments of the collector. It does not apply to the sidecar method. More info: https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ Container names managed by the operator: * `otc-container` Overriding containers managed by the operator is outside the scope of what the maintainers will support and by doing so, you wil accept the risk of it breaking things.
diff --git a/internal/manifests/collector/daemonset_test.go b/internal/manifests/collector/daemonset_test.go index 51b08c42d1..92f50326ed 100644 --- a/internal/manifests/collector/daemonset_test.go +++ b/internal/manifests/collector/daemonset_test.go @@ -329,4 +329,5 @@ func TestDaemonSetAdditionalContainer(t *testing.T) { assert.Equal(t, "8888", d.Annotations["prometheus.io/port"]) assert.Equal(t, "/metrics", d.Annotations["prometheus.io/path"]) assert.Len(t, d.Spec.Template.Spec.Containers, 2) + assert.Equal(t, v1.Container{Name: "test"}, d.Spec.Template.Spec.Containers[0]) } diff --git a/internal/manifests/collector/deployment_test.go b/internal/manifests/collector/deployment_test.go index 1f82f944b2..40c7acacc5 100644 --- a/internal/manifests/collector/deployment_test.go +++ b/internal/manifests/collector/deployment_test.go @@ -443,4 +443,5 @@ func TestDeploymentAdditionalContainers(t *testing.T) { assert.Equal(t, "8888", d.Annotations["prometheus.io/port"]) assert.Equal(t, "/metrics", d.Annotations["prometheus.io/path"]) assert.Len(t, d.Spec.Template.Spec.Containers, 2) + assert.Equal(t, v1.Container{Name: "test"}, d.Spec.Template.Spec.Containers[0]) } diff --git a/internal/manifests/collector/statefulset_test.go b/internal/manifests/collector/statefulset_test.go index 47b1a040fd..e2e016da5e 100644 --- a/internal/manifests/collector/statefulset_test.go +++ b/internal/manifests/collector/statefulset_test.go @@ -440,4 +440,5 @@ func TestStatefulSetAdditionalContainers(t *testing.T) { assert.Equal(t, "8888", s.Annotations["prometheus.io/port"]) assert.Equal(t, "/metrics", s.Annotations["prometheus.io/path"]) assert.Len(t, s.Spec.Template.Spec.Containers, 2) + assert.Equal(t, v1.Container{Name: "test"}, s.Spec.Template.Spec.Containers[0]) }