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

[Cloud Security] Azure - AMR Template form #166910

Merged
merged 27 commits into from
Sep 27, 2023

Conversation

JordanSh
Copy link
Contributor

@JordanSh JordanSh commented Sep 21, 2023

Summary

Resolves #165580

Screen.Recording.2023-09-26.at.15.01.17.mov

@JordanSh JordanSh added release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related labels Sep 21, 2023
@JordanSh JordanSh self-assigned this Sep 21, 2023
@JordanSh JordanSh marked this pull request as ready for review September 26, 2023 16:13
@JordanSh JordanSh requested review from a team as code owners September 26, 2023 16:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-cloud-security-posture (Team:Cloud Security)

import type { CloudSecurityIntegrationAzureAccountType } from './agent_enrollment_flyout/types';

const AzureResourceManagerLink =
'https://azure.microsoft.com/en-us/get-started/azure-portal/resource-manager/?OCID=AIDcmm5edswduu_SEM__k_CjwKCAjwxOymBhAFEiwAnodBLBHx_IB6zMNtNiK3A6rPLhhUPeftXrN3px5mwTO739pWUndPzt27aRoCMKIQAvD_BwE_k_&gad=1';
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove those additional URL params?

and keep the URL like this:

https://azure.microsoft.com/en-us/get-started/azure-portal/resource-manager

@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Sep 26, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@@ -7,21 +7,19 @@

import type { AgentPolicy } from '../types';

Copy link
Contributor

Choose a reason for hiding this comment

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

Great idea on reusing this function, I think we can export from this file an object with the supported templateUrlFieldName:

export const SUPPORTED_TEMPLATES = {
      CLOUD_FORMATION: 'cloud_formation_template_url',
      ARM: 'arm_template_url'
}

this way later we can reuse it like this and avoid typos:

import { getTemplateUrlFromAgentPolicy, SUPPORTED_TEMPLATES } from '../../services';

const cloudFormationTemplateFromAgentPolicy = getTemplateUrlFromAgentPolicy(
      SUPPORTED_TEMPLATES.CLOUD_FORMATION,
      agentPolicy
    );

*/
export const getCloudFormationTemplateUrlFromAgentPolicy = (selectedPolicy?: AgentPolicy) => {
export const getTemplateUrlFromAgentPolicy = (
templateUrlFieldName: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

we can also export the supported templateUrlFieldName in this function similar as mentioned in the previous comment

<li>
<FormattedMessage
id="xpack.csp.azureIntegration.armTemplateSetupStep.save"
defaultMessage="Click the Save tand continue button on the bottom right of this page."
Copy link
Contributor

Choose a reason for hiding this comment

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

typo here: "Save tand continue"

@@ -62,7 +62,7 @@ describe('getCloudFormationTemplateUrlFromAgentPolicy', () => {
],
};
// @ts-expect-error
const result = getCloudFormationTemplateUrlFromAgentPolicy(selectedPolicy);
const result = getTemplateUrlFromAgentPolicy(selectedPolicy);
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it's missing one param, also can you add a test for ARM?

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

Fleet changes LGTM

@JordanSh
Copy link
Contributor Author

Thanks @opauloh and @juliaElastic for the reviews.

@opauloh all comments were addressed, thanks for the great suggestions :)

@JordanSh JordanSh requested a review from opauloh September 27, 2023 09:48
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Defend Workflows Cypress Tests #1 / Endpoint generated alerts "before all" hook for "should create a Detection Engine alert from an endpoint alert" "before all" hook for "should create a Detection Engine alert from an endpoint alert"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
cloudSecurityPosture 234 237 +3
fleet 945 951 +6
total +9

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cloudSecurityPosture 266.3KB 274.9KB +8.5KB
fleet 1.2MB 1.2MB +6.8KB
total +15.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
cloudSecurityPosture 15.5KB 15.5KB +66.0B
fleet 143.2KB 143.5KB +329.0B
total +395.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
cloudSecurityPosture 19 23 +4

Total ESLint disabled count

id before after diff
cloudSecurityPosture 20 24 +4

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @JordanSh

Copy link
Contributor

@opauloh opauloh left a comment

Choose a reason for hiding this comment

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

Just out of curiosity, can we pass the params such as FleetUrl, enrollment token and elastic agent version over the URL to the ARM template?

image (4)

Copy link
Contributor

@opauloh opauloh left a comment

Choose a reason for hiding this comment

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

Tested Locally LGTM!

@JordanSh JordanSh merged commit 594cb14 into elastic:main Sep 27, 2023
@kibanamachine kibanamachine added v8.11.0 backport:skip This commit does not require backporting labels Sep 27, 2023
@JordanSh
Copy link
Contributor Author

Just out of curiosity, can we pass the params such as FleetUrl, enrollment token and elastic agent version over the URL to the ARM template?

We discussed this at private but i'll update in this thread as well. This option is under investigation lead by @orestisfl , we might add it in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Cloud Security Cloud Security team related Team:Fleet Team label for Observability Data Collection Fleet team v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cloud Security][CIS Azure] Azure integration form - ARM Template flow
6 participants