Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions packages/manager/src/dev-tools/FeatureFlagTool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const options: { flag: keyof Flags; label: string }[] = [
{ flag: 'apl', label: 'Akamai App Platform' },
{ flag: 'aplGeneralAvailability', label: 'Akamai App Platform GA' },
{ flag: 'aplLkeE', label: 'Akamai App Platform LKE-E' },
{
flag: 'aclpNbMetricsIntegration',
label: 'ACLP NodeBalancer Metrics Integration',
},
{ flag: 'blockStorageEncryption', label: 'Block Storage Encryption (BSE)' },
{ flag: 'blockStorageVolumeLimit', label: 'Block Storage Volume Limit' },
{ flag: 'cloudNat', label: 'Cloud NAT' },
Expand Down
1 change: 1 addition & 0 deletions packages/manager/src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export interface Flags {
aclpAlerting: AclpAlerting;
aclpAlertServiceTypeConfig: AclpAlertServiceTypeConfig[];
aclpLogs: AclpLogsFlag;
aclpNbMetricsIntegration: boolean;
aclpReadEndpoint: string;
aclpResourceTypeMap: CloudPulseResourceTypeMapFlag[];
aclpServices: Partial<AclpServices>;
Expand Down
33 changes: 33 additions & 0 deletions packages/manager/src/features/NodeBalancers/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { renderHook, waitFor } from '@testing-library/react';
import { wrapWithTheme } from 'src/utilities/testHelpers';

import {
useIsAclpNbMetricsIntegrationEnabled,
useIsNodebalancerIpv6Enabled,
useIsNodebalancerVPCEnabled,
} from './utils';
Expand Down Expand Up @@ -58,3 +59,35 @@ describe('useIsNodebalancerIpv6Enabled', () => {
});
});
});

describe('useIsAclpNbMetricsIntegrationEnabled', () => {
it('returns true if the feature is enabled', async () => {
const options = { flags: { aclpNbMetricsIntegration: true } };

const { result } = renderHook(
() => useIsAclpNbMetricsIntegrationEnabled(),
{
wrapper: (ui) => wrapWithTheme(ui, options),
}
);

await waitFor(() => {
expect(result.current.isAclpNbMetricsIntegrationEnabled).toBe(true);
});
});

it('returns false if the feature is NOT enabled', async () => {
const options = { flags: { aclpNbMetricsIntegration: false } };

const { result } = renderHook(
() => useIsAclpNbMetricsIntegrationEnabled(),
{
wrapper: (ui) => wrapWithTheme(ui, options),
}
);

await waitFor(() => {
expect(result.current.isAclpNbMetricsIntegrationEnabled).toBe(false);
});
});
});
20 changes: 19 additions & 1 deletion packages/manager/src/features/NodeBalancers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
};

/**
* Returns whether or not features related to the NodeBalancer Dual Stack project
* Returns whether or not features related to the NodeBalancer IPv6 project
* should be enabled.
*
* Currently, this just uses the `nodebalancerIPv6` feature flag as a source of truth,
Expand All @@ -250,3 +250,21 @@

return { isNodebalancerIpv6Enabled: flags.nodebalancerIpv6 ?? false };
};

/**
* Returns whether or not features related to the ACLP NB Metrics Integration
* should be enabled.
*
* Currently, this just uses the `aclpNbMetricsIntegration` feature flag as a source of truth,
* but will eventually also look at account capabilities.
*/

export const useIsAclpNbMetricsIntegrationEnabled = () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to create a new hook here since there won't be any customer tag/account capability for this project. To avoid redundant hooks, we can simply use const { aclpNbMetricsIntegration } = useFlags(); wherever this check is needed for this integration work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the util πŸ‘

const flags = useFlags();

// @TODO ACLP NB Metrics Integration: check for customer tag/account capability when it exists

Check warning on line 265 in packages/manager/src/features/NodeBalancers/utils.ts

View workflow job for this annotation

GitHub Actions / ESLint Review (manager)

[eslint] reported by reviewdog 🐢 Complete the task associated to this "TODO" comment. Raw Output: {"ruleId":"sonarjs/todo-tag","severity":1,"message":"Complete the task associated to this \"TODO\" comment.","line":265,"column":7,"nodeType":null,"messageId":"completeTODO","endLine":265,"endColumn":11}

return {
isAclpNbMetricsIntegrationEnabled: flags.aclpNbMetricsIntegration ?? false,
};
};
Loading