Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add linux node selector #418

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
### enhancement
- Add linux node selector @dbudziwojskiNR [#418](https://github.com/newrelic/newrelic-infra-operator/pull/418)

## v0.17.0 - 2024-02-05

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ spec:
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
{{- with include "newrelic.common.nodeSelector" . }}
nodeSelector:
{{- . | nindent 8 -}}
{{- end }}
kubernetes.io/os: linux
{{ include "newrelic.common.nodeSelector" . | nindent 8 }}
{{- with include "newrelic.common.tolerations" . }}
tolerations:
{{- . | nindent 8 -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ spec:
runAsGroup: 2000
runAsNonRoot: true
runAsUser: 2000
{{- with include "newrelic.common.nodeSelector" . }}
nodeSelector:
{{- . | nindent 8 -}}
{{- end }}
kubernetes.io/os: linux
{{ include "newrelic.common.nodeSelector" . | nindent 8 }}
{{- with include "newrelic.common.tolerations" . }}
tolerations:
{{- . | nindent 8 -}}
Expand Down
5 changes: 2 additions & 3 deletions charts/newrelic-infra-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ spec:
{{- with include "newrelic.common.priorityClassName" . }}
priorityClassName: {{ . }}
{{- end }}
{{- with include "newrelic.common.nodeSelector" . }}
nodeSelector:
{{- . | nindent 8 -}}
{{- end }}
kubernetes.io/os: linux
{{ include "newrelic.common.nodeSelector" . | nindent 8 }}
{{- with include "newrelic.common.tolerations" . }}
tolerations:
{{- . | nindent 8 -}}
Expand Down
32 changes: 32 additions & 0 deletions charts/newrelic-infra-operator/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
suite: test cluster environment variable setup
templates:
- templates/deployment.yaml
- templates/configmap.yaml
- templates/secret.yaml
release:
name: my-release
namespace: my-namespac
tests:
- it: has a linux node selector by default
set:
cluster: my-cluster
licenseKey: use-whatever
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
kubernetes.io/os: linux
template: templates/deployment.yaml
- it: has a linux node selector and additional selectors
set:
cluster: my-cluster
licenseKey: use-whatever
nodeSelector:
aCoolTestLabel: aCoolTestValue
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
kubernetes.io/os: linux
aCoolTestLabel: aCoolTestValue
template: templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,26 @@ tests:
- equal:
path: spec.template.spec.serviceAccountName
value: default

- it: has a linux node selector by default
set:
cluster: my-cluster
licenseKey: use-whatever
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
kubernetes.io/os: linux

- it: has a linux node selector and additional selectors
set:
cluster: my-cluster
licenseKey: use-whatever
nodeSelector:
aCoolTestLabel: aCoolTestValue
asserts:
- equal:
path: spec.template.spec.nodeSelector
value:
kubernetes.io/os: linux
aCoolTestLabel: aCoolTestValue
Loading