Skip to content

Commit e32c336

Browse files
authored
Merge pull request #1055 from snyk/feat/configurable_keepalive
[RUN-2187] Make keepalive configurable
2 parents 2f49e4e + 872e8cb commit e32c336

File tree

19 files changed

+79
-50
lines changed

19 files changed

+79
-50
lines changed

config.default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
"QUEUE_LENGTH_LOG_FREQUENCY_MINUTES": 1,
1717
"INTEGRATION_ID": "",
1818
"DEFAULT_KUBERNETES_UPSTREAM_URL": "https://kubernetes-upstream.snyk.io",
19-
"MAX_RETRY_BACKOFF_DURATION_SECONDS": 300
19+
"MAX_RETRY_BACKOFF_DURATION_SECONDS": 300,
20+
"USE_KEEPALIVE": true
2021
}

snyk-monitor/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ spec:
127127
value: {{ .Values.https_proxy }}
128128
- name: NO_PROXY
129129
value: {{ .Values.no_proxy }}
130+
- name: USE_KEEPALIVE
131+
value: {{ quote .Values.use_keepalive }}
130132
- name: LOG_LEVEL
131133
value: {{ .Values.log_level }}
132134
- name: SKIP_K8S_JOBS

snyk-monitor/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ limits:
9191
http_proxy:
9292
https_proxy:
9393
no_proxy:
94+
use_keepalive: true
9495
skip_k8s_jobs:
9596

9697
# Override default (INFO) log level if less verbosity needed

snyk-operator-certified/helm-charts/snyk-monitor/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ spec:
111111
value: {{ .Values.https_proxy }}
112112
- name: NO_PROXY
113113
value: {{ .Values.no_proxy }}
114+
- name: USE_KEEPALIVE
115+
value: {{ quote .Values.use_keepalive }}
114116
- name: LOG_LEVEL
115117
value: {{ .Values.log_level }}
116118
- name: SKIP_K8S_JOBS

snyk-operator-certified/helm-charts/snyk-monitor/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ limits:
8383
http_proxy:
8484
https_proxy:
8585
no_proxy:
86+
use_keepalive: true
8687
skip_k8s_jobs:
8788

8889
# Override default (INFO) log level if less verbosity needed

src/common/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ if (config.SYSDIG_ENDPOINT && config.SYSDIG_TOKEN) {
5959
config.HTTPS_PROXY = process.env['HTTPS_PROXY'];
6060
config.HTTP_PROXY = process.env['HTTP_PROXY'];
6161
config.NO_PROXY = process.env['NO_PROXY'];
62+
config.USE_KEEPALIVE = process.env.USE_KEEPALIVE === 'true';
6263
delete process.env['HTTPS_PROXY'];
6364
delete process.env['HTTP_PROXY'];
6465
delete process.env['NO_PROXY'];

src/common/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface Config {
3131
HTTPS_PROXY: string | undefined;
3232
HTTP_PROXY: string | undefined;
3333
NO_PROXY: string | undefined;
34+
USE_KEEPALIVE: boolean;
3435
SKIP_K8S_JOBS: boolean;
3536
DEPLOYMENT_NAME: string;
3637
DEPLOYMENT_NAMESPACE: string;

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import { setSnykMonitorAgentId } from './supervisor/agent';
1313
import { scrapeData } from './data-scraper';
1414
import { setupHealthCheck } from './healthcheck';
1515

16-
process.on('uncaughtException', (err) => {
16+
process.on('uncaughtException', (error) => {
1717
if (state.shutdownInProgress) {
1818
return;
1919
}
2020

2121
try {
22-
logger.error({ err }, 'UNCAUGHT EXCEPTION!');
22+
logger.error({ error }, 'UNCAUGHT EXCEPTION!');
2323
} catch (ignore) {
24-
console.log('UNCAUGHT EXCEPTION!', err);
24+
console.log('UNCAUGHT EXCEPTION!', error);
2525
} finally {
2626
process.exit(1);
2727
}

src/scanner/images/credentials.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ export function ecrRegionFromFullImageName(imageFullName: string): string {
7777
throw new Error('ECR image full name in unexpected format');
7878
}
7979
return parts[3];
80-
} catch (err) {
80+
} catch (error) {
8181
logger.error(
82-
{ err, imageFullName },
82+
{ error, imageFullName },
8383
'failed extracting ECR region from image full name',
8484
);
85-
throw err;
85+
throw error;
8686
}
8787
}

src/scanner/images/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ export async function scanImages(
138138
telemetry.imageSizeBytes = 0;
139139
}
140140
telemetry.imageSizeBytes += fileStats.size;
141-
} catch (err) {
141+
} catch (error) {
142142
logger.warn(
143-
{ error: err, imageName, imageWithDigest, fileSystemPath },
143+
{ error, imageName, imageWithDigest, fileSystemPath },
144144
'could not determine archive size',
145145
);
146146
}

0 commit comments

Comments
 (0)