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

fix: cars with dns resolver fix over 1-78-0 #3742

Closed
wants to merge 4 commits into from
Closed
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: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"lint:fix:json": "eslint --ext .json --fix .",
"lint": "npm run format && npm run lint:fix",
"check:merge": "npm run verify || exit 1; codecov",
"start": "cd dist;node ./src/index.js;cd ..",
"start": "cd dist;exec node ./src/index.js;cd ..",
"build:start": "npm run build && npm run start",
"build:ci": "tsc -p tsconfig.json",
"build:swagger": "npm run build && npm run setup:swagger",
Expand Down
11 changes: 9 additions & 2 deletions src/util/openfaas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const FAAS_SCALE_TARGET = process.env.FAAS_SCALE_TARGET || '4';
const FAAS_SCALE_TARGET_PROPORTION = process.env.FAAS_SCALE_TARGET_PROPORTION || '0.70';
const FAAS_SCALE_ZERO = process.env.FAAS_SCALE_ZERO || 'false';
const FAAS_SCALE_ZERO_DURATION = process.env.FAAS_SCALE_ZERO_DURATION || '15m';
const FAAS_GUNICORN_WORKERS = process.env.FAAS_GUNICORN_WORKERS || '1';
const FAAS_GUNICORN_THREADS = process.env.FAAS_GUNICORN_THREADS || '1';
const FAAS_BASE_IMG = process.env.FAAS_BASE_IMG || 'rudderlabs/openfaas-flask:main';
const FAAS_MAX_PODS_IN_TEXT = process.env.FAAS_MAX_PODS_IN_TEXT || '40';
const FAAS_MIN_PODS_IN_TEXT = process.env.FAAS_MIN_PODS_IN_TEXT || '1';
Expand Down Expand Up @@ -49,6 +51,7 @@ const CUSTOM_NETWORK_POLICY_WORKSPACE_IDS = process.env.CUSTOM_NETWORK_POLICY_WO
const customNetworkPolicyWorkspaceIds = CUSTOM_NETWORK_POLICY_WORKSPACE_IDS.split(',');
const CUSTOMER_TIER = process.env.CUSTOMER_TIER || 'shared';
const FAAS_SCALE_DOWN_WINDOW = process.env.FAAS_SCALE_DOWN_WINDOW || ''; // Go time values are supported ( max 5m or 300s )
const FAAS_DNS_RESOLVER = process.env.FAAS_DNS_RESOLVER || 'false';

// Initialise node cache
const functionListCache = new NodeCache();
Expand Down Expand Up @@ -209,6 +212,7 @@ const updateFaasFunction = async (
await updateFunction(functionName, payload);
// wait for function to be ready and then set it in cache
await awaitFunctionReadiness(functionName);
// set the function in cache
setFunctionInCache(functionName);
} catch (error) {
// 404 is statuscode returned from openfaas community edition
Expand Down Expand Up @@ -303,7 +307,11 @@ function buildOpenfaasFn(name, code, versionId, libraryVersionIDs, testMode, trM
envProcess = `${envProcess} --code "${code}" --config-backend-url ${CONFIG_BACKEND_URL} --lvids "${lvidsString}"`;
}

const envVars = {};
const envVars = {
GUNICORN_WORKER_COUNT: FAAS_GUNICORN_WORKERS,
GUNICORN_THREAD_COUNT: FAAS_GUNICORN_THREADS,
dns_resolver: FAAS_DNS_RESOLVER,
};

if (FAAS_ENABLE_WATCHDOG_ENV_VARS.trim().toLowerCase() === 'true') {
envVars.max_inflight = FAAS_MAX_INFLIGHT;
Expand Down Expand Up @@ -392,7 +400,6 @@ const executeFaasFunction = async (

if (error.statusCode === 404 && error.message.includes(`error finding function ${name}`)) {
removeFunctionFromCache(name);

await setupFaasFunction(name, null, versionId, libraryVersionIDs, testMode, trMetadata);
throw new RetryRequestError(`${name} not found`);
}
Expand Down
Loading