Skip to content

Commit

Permalink
Support nodeSelector field for non-sidecar collectors
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Utley <[email protected]>
  • Loading branch information
jutley committed Mar 18, 2022
1 parent 553d2ec commit 49f6cff
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apis/v1alpha1/opentelemetrycollector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ type OpenTelemetryCollectorSpec struct {
// +optional
Tolerations []v1.Toleration `json:"tolerations,omitempty"`

// NodeSelector to schedule OpenTelemetry Collector pods.
// This is only relevant to daemonsets, statefulsets and deployments
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`

// PodAnnotations is the set of annotations that will be attached to
// Collector and Target Allocator pods.
// +optional
Expand Down
7 changes: 7 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ spec:
- sidecar
- statefulset
type: string
nodeSelector:
additionalProperties:
type: string
description: NodeSelector to schedule OpenTelemetry Collector pods.
This is only relevant to daemonsets, statefulsets and deployments
type: object
podAnnotations:
additionalProperties:
type: string
Expand Down
1 change: 1 addition & 0 deletions pkg/collector/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func DaemonSet(cfg config.Config, logger logr.Logger, otelcol v1alpha1.OpenTelem
Containers: []corev1.Container{Container(cfg, logger, otelcol)},
Volumes: Volumes(cfg, otelcol),
Tolerations: otelcol.Spec.Tolerations,
NodeSelector: otelcol.Spec.NodeSelector,
HostNetwork: otelcol.Spec.HostNetwork,
DNSPolicy: getDnsPolicy(otelcol),
SecurityContext: otelcol.Spec.PodSecurityContext,
Expand Down
1 change: 1 addition & 0 deletions pkg/collector/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func Deployment(cfg config.Config, logger logr.Logger, otelcol v1alpha1.OpenTele
DNSPolicy: getDnsPolicy(otelcol),
HostNetwork: otelcol.Spec.HostNetwork,
Tolerations: otelcol.Spec.Tolerations,
NodeSelector: otelcol.Spec.NodeSelector,
SecurityContext: otelcol.Spec.PodSecurityContext,
},
},
Expand Down
1 change: 1 addition & 0 deletions pkg/collector/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func StatefulSet(cfg config.Config, logger logr.Logger, otelcol v1alpha1.OpenTel
DNSPolicy: getDnsPolicy(otelcol),
HostNetwork: otelcol.Spec.HostNetwork,
Tolerations: otelcol.Spec.Tolerations,
NodeSelector: otelcol.Spec.NodeSelector,
SecurityContext: otelcol.Spec.PodSecurityContext,
},
},
Expand Down

0 comments on commit 49f6cff

Please sign in to comment.