forked from open-telemetry/opentelemetry-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Pod NodeSelector changes from OpenTelemetryCollector (open-teleme…
…try#2941) * Add node-selector test case Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com> * Change to use merge WithOverwriteWithEmptyValue Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com> * Add changelog Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com> * Add changelog Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com> * Change to merge-override-empty only the nodeSelector Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com> * Invert order of nodeSelector override Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com> --------- Signed-off-by: Janario Oliveira <janario.oliveira@gmail.com>
- Loading branch information
Showing
11 changed files
with
321 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 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. collector, target allocator, auto-instrumentation, opamp, github action) | ||
component: collector | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Fix to reflect changes of OpenTelemetryCollector.spec.nodeSelector in the collector Pods | ||
|
||
# One or more tracking issues related to the change | ||
issues: [2940] | ||
|
||
# (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: | | ||
When updating `OpenTelemetryCollector.spec.nodeSelector` it was not removing previous selector from the final collector pod (Deployment/Daemonset/Statefulset). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/e2e/node-selector-collector/00-assert-daemonset-without-node-selector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: opentelemetry-collector | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
app.kubernetes.io/name: daemonset-collector | ||
app.kubernetes.io/part-of: opentelemetry | ||
node-selector-mode: without | ||
spec: | ||
(nodeSelector == null): true |
11 changes: 11 additions & 0 deletions
11
tests/e2e/node-selector-collector/00-assert-deployment-without-node-selector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: opentelemetry-collector | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
app.kubernetes.io/name: deployment-collector | ||
app.kubernetes.io/part-of: opentelemetry | ||
node-selector-mode: without | ||
spec: | ||
(nodeSelector == null): true |
11 changes: 11 additions & 0 deletions
11
tests/e2e/node-selector-collector/00-assert-statefulset-without-node-selector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: opentelemetry-collector | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
app.kubernetes.io/name: statefulset-collector | ||
app.kubernetes.io/part-of: opentelemetry | ||
node-selector-mode: without | ||
spec: | ||
(nodeSelector == null): true |
79 changes: 79 additions & 0 deletions
79
tests/e2e/node-selector-collector/00-install-collectors-without-node-selector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: deployment | ||
labels: | ||
node-selector-mode: without | ||
spec: | ||
mode: deployment | ||
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: daemonset | ||
labels: | ||
node-selector-mode: without | ||
spec: | ||
mode: daemonset | ||
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: statefulset | ||
labels: | ||
node-selector-mode: without | ||
spec: | ||
mode: statefulset | ||
config: | | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
processors: | ||
exporters: | ||
debug: | ||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [] | ||
exporters: [debug] |
12 changes: 12 additions & 0 deletions
12
tests/e2e/node-selector-collector/01-assert-daemonset-with-node-selector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: opentelemetry-collector | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
app.kubernetes.io/name: daemonset-collector | ||
app.kubernetes.io/part-of: opentelemetry | ||
node-selector-mode: with | ||
spec: | ||
nodeSelector: | ||
kubernetes.io/os: linux |
12 changes: 12 additions & 0 deletions
12
tests/e2e/node-selector-collector/01-assert-deployment-with-node-selector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: opentelemetry-collector | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
app.kubernetes.io/name: deployment-collector | ||
app.kubernetes.io/part-of: opentelemetry | ||
node-selector-mode: with | ||
spec: | ||
nodeSelector: | ||
kubernetes.io/os: linux |
12 changes: 12 additions & 0 deletions
12
tests/e2e/node-selector-collector/01-assert-statefulset-with-node-selector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app.kubernetes.io/component: opentelemetry-collector | ||
app.kubernetes.io/managed-by: opentelemetry-operator | ||
app.kubernetes.io/name: statefulset-collector | ||
app.kubernetes.io/part-of: opentelemetry | ||
node-selector-mode: with | ||
spec: | ||
nodeSelector: | ||
kubernetes.io/os: linux |
85 changes: 85 additions & 0 deletions
85
tests/e2e/node-selector-collector/01-install-collectors-with-node-selector.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: deployment | ||
labels: | ||
node-selector-mode: with | ||
spec: | ||
mode: deployment | ||
nodeSelector: | ||
kubernetes.io/os: linux | ||
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: daemonset | ||
labels: | ||
node-selector-mode: with | ||
spec: | ||
mode: daemonset | ||
nodeSelector: | ||
kubernetes.io/os: linux | ||
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: statefulset | ||
labels: | ||
node-selector-mode: with | ||
spec: | ||
mode: statefulset | ||
nodeSelector: | ||
kubernetes.io/os: linux | ||
config: | | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
processors: | ||
exporters: | ||
debug: | ||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [] | ||
exporters: [debug] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# 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: node-selector-collector | ||
spec: | ||
steps: | ||
- name: step-00 | ||
description: collectors without nodeSelector | ||
try: | ||
- apply: | ||
file: 00-install-collectors-without-node-selector.yaml | ||
# deployment | ||
- assert: | ||
file: 00-assert-deployment-without-node-selector.yaml | ||
# daemonset | ||
- assert: | ||
file: 00-assert-daemonset-without-node-selector.yaml | ||
# statefulset | ||
- assert: | ||
file: 00-assert-statefulset-without-node-selector.yaml | ||
|
||
- name: step-01 | ||
description: collectors with nodeSelector | ||
try: | ||
- apply: | ||
file: 01-install-collectors-with-node-selector.yaml | ||
# deployment | ||
- assert: | ||
file: 01-assert-deployment-with-node-selector.yaml | ||
# daemonset | ||
- assert: | ||
file: 01-assert-daemonset-with-node-selector.yaml | ||
# statefulset | ||
- assert: | ||
file: 01-assert-statefulset-with-node-selector.yaml | ||
|
||
- name: step-02 | ||
description: back to no nodeSelector | ||
try: | ||
- command: # while update is not supported on 0.1.7, but 0.1.9 https://kyverno.github.io/chainsaw/0.1.9/operations/update/ | ||
entrypoint: kubectl | ||
args: | ||
- -n | ||
- ${NAMESPACE} | ||
- replace | ||
- -f | ||
- 00-install-collectors-without-node-selector.yaml | ||
# deployment | ||
- assert: | ||
file: 00-assert-deployment-without-node-selector.yaml | ||
# daemonset | ||
- assert: | ||
file: 00-assert-daemonset-without-node-selector.yaml | ||
# statefulset | ||
- assert: | ||
file: 00-assert-statefulset-without-node-selector.yaml |