Skip to content

Commit f210fbd

Browse files
authored
Merge pull request #534 from snyk/feat/node_selector
[RUN-1107] feat: Allow to specify the nodeSelector fields in the Helm chart
2 parents f8cf16c + 0094099 commit f210fbd

File tree

6 files changed

+24
-3
lines changed

6 files changed

+24
-3
lines changed

snyk-monitor/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,7 @@ spec:
9191
configMap:
9292
name: {{ .Values.registriesConfConfigMap }}
9393
optional: true
94+
{{- with .Values.nodeSelector }}
95+
nodeSelector:
96+
{{- toYaml . | nindent 8 }}
97+
{{- end }}

snyk-monitor/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ limits:
4343
http_proxy:
4444
https_proxy:
4545
no_proxy:
46+
47+
nodeSelector: {}

test/integration/kubernetes.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,20 @@ tap.test(`snyk-monitor has resource limits`, async (t) => {
349349
t.ok(monitorResources.requests.memory !== undefined, 'snyk-monitor has memory resource request');
350350
});
351351

352+
tap.test('snyk-monitor has nodeSelector', async (t) => {
353+
t.plan(1);
354+
355+
if (process.env['DEPLOYMENT_TYPE'] !== 'Helm') {
356+
t.pass('Not testing nodeSelector because we\'re not installing with Helm');
357+
return;
358+
}
359+
360+
const snykMonitorDeployment = await kubectl.getDeploymentJson('snyk-monitor', 'snyk-monitor');
361+
const spec = snykMonitorDeployment.spec.template.spec;
362+
363+
t.ok('nodeSelector' in spec, 'snyk-monitor has nodeSelector');
364+
});
365+
352366
tap.test('snyk-monitor secure configuration is as expected', async (t) => {
353367
const kubeConfig = new KubeConfig();
354368
kubeConfig.loadFromDefault();

test/setup/deployers/helm-with-proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function deployKubernetesMonitor(
3535
`--set image.tag=${imageTag} ` +
3636
`--set image.pullPolicy=${imagePullPolicy} ` +
3737
'--set integrationApi=https://kubernetes-upstream.dev.snyk.io ' +
38-
'--set https_proxy=http://forwarding-proxy:8080',
38+
'--set https_proxy=http://forwarding-proxy:8080'
3939
);
4040
console.log(`Deployed ${imageOptions.nameAndTag} with pull policy ${imageOptions.pullPolicy}`);
4141
}

test/setup/deployers/helm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ async function deployKubernetesMonitor(
2929
`--set image.repository=${imageName} ` +
3030
`--set image.tag=${imageTag} ` +
3131
`--set image.pullPolicy=${imagePullPolicy} ` +
32-
'--set integrationApi=https://kubernetes-upstream.dev.snyk.io',
32+
'--set integrationApi=https://kubernetes-upstream.dev.snyk.io ' +
33+
'--set nodeSelector."kubernetes\\.io/os"=linux'
3334
);
3435
console.log(`Deployed ${imageOptions.nameAndTag} with pull policy ${imageOptions.pullPolicy}`);
3536
}

test/unit/deployment-files.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
tap.test('ensure the security properties of the deployment files are unchanged', async (t) => {
1717
t.same(snykConfig.IMAGE_STORAGE_ROOT, '/var/tmp', 'the snyk-monitor points to the correct mounted path');
1818

19-
const deploymentFiles = ['./snyk-monitor/templates/deployment.yaml', './snyk-monitor-deployment.yaml'];
19+
const deploymentFiles = ['./snyk-monitor-deployment.yaml'];
2020

2121
for (const filePath of deploymentFiles) {
2222
const fileContent = readFileSync(filePath, 'utf8');

0 commit comments

Comments
 (0)