Skip to content

Commit

Permalink
custom labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayachand committed Oct 31, 2023
1 parent ed32683 commit 1cbe8ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/util/customTransformer-faas.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 7 additions & 4 deletions src/util/openfaas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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)

Check warning on line 155 in src/util/openfaas/index.js

View check run for this annotation

Codecov / codecov/patch

src/util/openfaas/index.js#L155

Added line #L155 was not covered by tests
) {
labels['custom-network-policy'] = 'true';

Check warning on line 157 in src/util/openfaas/index.js

View check run for this annotation

Codecov / codecov/patch

src/util/openfaas/index.js#L157

Added line #L157 was not covered by tests
}

// TODO: investigate and add more required labels and annotations
Expand Down

0 comments on commit 1cbe8ea

Please sign in to comment.