From 1cbe8eabc3cd2c8cf19ed616bcfaa1d837f38a07 Mon Sep 17 00:00:00 2001 From: Jayc Date: Tue, 31 Oct 2023 20:48:11 +0530 Subject: [PATCH] custom labels --- src/util/customTransformer-faas.js | 2 +- src/util/openfaas/index.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/util/customTransformer-faas.js b/src/util/customTransformer-faas.js index f4b19be0ac..0a1c9f0ef6 100644 --- a/src/util/customTransformer-faas.js +++ b/src/util/customTransformer-faas.js @@ -82,13 +82,13 @@ async function setOpenFaasUserTransform( libraryVersionIds, pregeneratedFnName, testMode = false, + trMetadata = {}, ) { const tags = { transformerVersionId: userTransformation.versionId, identifier: 'openfaas', testMode, }; - const trMetadata = events[0].metadata ? getTransformationMetadata(userTransformation) : {}; const functionName = pregeneratedFnName || generateFunctionName(userTransformation, libraryVersionIds, testMode); const setupTime = new Date(); diff --git a/src/util/openfaas/index.js b/src/util/openfaas/index.js index 81d70d94fa..9817ce56fa 100644 --- a/src/util/openfaas/index.js +++ b/src/util/openfaas/index.js @@ -23,8 +23,8 @@ const CONFIG_BACKEND_URL = process.env.CONFIG_BACKEND_URL || 'https://api.rudder const GEOLOCATION_URL = process.env.GEOLOCATION_URL || ''; const FAAS_AST_VID = 'ast'; const FAAS_AST_FN_NAME = 'fn-ast'; -const LABEL_WORKSPACE_IDS = process.env.LABEL_WORKSPACES_IDS || ''; -const labelWorkspaceIds = LABEL_WORKSPACE_IDS.split(','); +const CUSTOM_NETWORK_POLICY_WORKSPACE_IDS = process.env.CUSTOM_NETWORK_POLICY_WORKSPACE_IDS || ''; +const customNetworkPolicyWorkspaceIds = CUSTOM_NETWORK_POLICY_WORKSPACE_IDS.split(','); // Initialise node cache const functionListCache = new NodeCache(); @@ -150,8 +150,11 @@ const deployFaasFunction = async ( transformationId: trMetadata.transformationId, workspaceId: trMetadata.workspaceId, }; - if (trMetadata.workspaceId && labelWorkspaceIds.includes(trMetadata.workspaceId)) { - labels.customPolicy = 'true'; + if ( + trMetadata.workspaceId && + customNetworkPolicyWorkspaceIds.includes(trMetadata.workspaceId) + ) { + labels['custom-network-policy'] = 'true'; } // TODO: investigate and add more required labels and annotations