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

[Fleet] Present users with a Kubernetes manifest for deploying agent in fleet managed mode for Kubernetes #127703

Merged

Conversation

MichaelKatsoulis
Copy link
Contributor

@MichaelKatsoulis MichaelKatsoulis commented Mar 15, 2022

Summary

This PR updates agent addition instructions in case a policy contains Kubernetes integration.

It closes #92113

Checklist

Delete any items that are not applicable to this PR.

For maintainers

k8s integration 1

k8s integration 2

default policy 1

@MichaelKatsoulis MichaelKatsoulis requested a review from a team as a code owner March 15, 2022 08:16
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Mar 15, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@MichaelKatsoulis MichaelKatsoulis marked this pull request as draft March 15, 2022 08:17
@kpollich
Copy link
Member

Just a heads up, the Fleet team has some in-progress work in this area that may result in conflicts: #80841

@MichaelKatsoulis
Copy link
Contributor Author

Just a heads up, the Fleet team has some in-progress work in this area that may result in conflicts: #80841

Thanks for the heads up!

@MichaelKatsoulis MichaelKatsoulis marked this pull request as ready for review March 15, 2022 12:04
@jen-huang jen-huang changed the title Update agent addition instructions in fleet managed mode [Fleet] Update add agent instructions in fleet managed mode for Kubernetes Mar 15, 2022

import { AdvancedAgentAuthenticationSettings } from './advanced_agent_authentication_settings';
import { SelectCreateAgentPolicy } from './agent_policy_select_create';

export const DownloadStep = (hasFleetServer: boolean) => {
export const DownloadStep = (hasFleetServer: boolean, isK8s: string, enrollmentAPIKey: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

you could make isK8s and enrollmentAPIKey optional parameters, to avoid passing '' when not needed

@juliaElastic
Copy link
Contributor

It would be nice if you could add some unit test coverage on the changes.

isK8s === 'IS_KUBERNETES' ? (
<FormattedMessage
id="xpack.fleet.agentEnrollment.downloadDescriptionForK8s"
defaultMessage="Copy or download the Kubernetes manifest inside the Kubernetes cluster. Check {FleetUrlVariable} and {FleetTokenVariable} in the Daemonset environment variables and apply the manifest."
Copy link

Choose a reason for hiding this comment

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

I'm wondering if it could be misleading if user deployed Agent using ECK? I'm not sure what the "Kubernetes manifest" would be in that case ? (not sure I have the full picture, so my comment might not be relevant).
CC @Kushmaro

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a point in what you are saying. ECK process is different and uses different manifests https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-eck.html. But this could be an extra addition in the instructions. With this PR I am just implementing #92113

Choose a reason for hiding this comment

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

IMHO we should promote both "regular" k8s manifests, however, we may want to promote ECK manifests (or related messaging) prior.
What I mean here - is that when a customer would like to "run something elastic with k8s" we should first let them know that ECK is the best way of doing so. regardless of where such a message exists.

Choose a reason for hiding this comment

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

@Kushmaro Can you clarify what you meant by - > "both "regular" k8s manifests" and
"run something elastic with k8s"

If I understood @barkbay correctly, then the add->agent flyout should also generate agent configuration yaml and set of instructions to be followed in ECK user journey. The current solution assumes vanilla K8s setup, not associated with how the stack components are deployed.

@barkbay @Kushmaro are you able to create another issue in this repo for accounting for ECK user requirement?

CC @mlunadia

@criamico
Copy link
Contributor

@MichaelKatsoulis we're working on a complete redesign of this flyout for 8.2. We'll have to change the steps and remove some of them. Can we find a way to coordinate on these PRs to make these changes easier?

@jen-huang jen-huang removed their request for review March 17, 2022 18:00
@MichaelKatsoulis
Copy link
Contributor Author

@MichaelKatsoulis we're working on a complete redesign of this flyout for 8.2. We'll have to change the steps and remove some of them. Can we find a way to coordinate on these PRs to make these changes easier?

@criamico if the changes you are working on will affect that much the add agent instructions in fleet managed then of course we should coordinate. We could schedule a call if you like.

@criamico
Copy link
Contributor

@MichaelKatsoulis we're working on a complete redesign of this flyout for 8.2. We'll have to change the steps and remove some of them. Can we find a way to coordinate on these PRs to make these changes easier?

@criamico if the changes you are working on will affect that much the add agent instructions in fleet managed then of course we should coordinate. We could schedule a call if you like.

Yes I think it would be better as the redesign is going to modify the flyout in a substantial way. Let me find a time to schedule a call.

@MichaelKatsoulis
Copy link
Contributor Author

After a discussion with @criamico, we have decided to freeze this until the restructuring of the flyout is finished. Then I will do my changes on top.

@@ -93,6 +95,32 @@ export const AgentEnrollmentFlyout: React.FunctionComponent<Props> = ({
checkPolicyIsFleetServer();
}, [policyId]);

const [isK8s, setIsK8s] = useState<'IS_LOADING' | 'IS_KUBERNETES' | 'IS_NOT_KUBERNETES'>(
Copy link
Member

Choose a reason for hiding this comment

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

I think we can move this to it's own hook and use the same hook for standalone instructions

Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Refactored hooks LGTM 🚀

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

UI work as expected 🚀

@nchaulet nchaulet enabled auto-merge (squash) March 29, 2022 19:15
@nchaulet nchaulet merged commit b160853 into elastic:main Mar 29, 2022
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 575 577 +2

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1254 1262 +8

Async chunks

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

id before after diff
fleet 679.4KB 682.5KB +3.1KB

Page load bundle

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

id before after diff
fleet 110.4KB 110.7KB +353.0B
Unknown metric groups

API count

id before after diff
fleet 1371 1379 +8

ESLint disabled in files

id before after diff
apm 15 14 -1
osquery 5 4 -1
securitySolution 69 68 -1
uptime 7 6 -1
total -4

ESLint disabled line counts

id before after diff
apm 88 85 -3
enterpriseSearch 9 7 -2
fleet 47 46 -1
osquery 122 119 -3
uptime 49 43 -6
total -15

References to deprecated APIs

id before after diff
canvas 70 64 -6
dashboard 78 72 -6
data 475 465 -10
dataEnhanced 55 49 -6
discover 26 20 -6
fleet 20 19 -1
lens 18 14 -4
management 2 1 -1
maps 456 330 -126
monitoring 40 28 -12
upgradeAssistant 12 7 -5
visDefaultEditor 205 155 -50
visTypeVega 4 3 -1
visualizations 17 13 -4
total -238

Total ESLint disabled count

id before after diff
apm 103 99 -4
enterpriseSearch 9 7 -2
fleet 55 54 -1
osquery 127 123 -4
securitySolution 509 508 -1
uptime 56 49 -7
total -19

History

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

cc @nchaulet

@jen-huang jen-huang added the QA:Ready for Testing Code is merged and ready for QA to validate label Mar 29, 2022
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 30, 2022
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 127703 or prevent reminders by adding the backport:skip label.

1 similar comment
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 127703 or prevent reminders by adding the backport:skip label.

@jen-huang jen-huang added backport:skip This commit does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Mar 31, 2022
@amolnater-qasource
Copy link

Hi Team
We have revalidated this PR on latest 8.2 Snapshot Kibana cloud environment.

  • We have observed detailed instructions under Add agent flyout when Kubernetes integration is added.

Build details:
BUILD: 51835
COMMIT: 6fcd2d0
Screenshot:
11

12

Hence marking this as QA:Validated.
Thanks

@amolnater-qasource amolnater-qasource added QA:Validated Issue has been validated by QA and removed QA:Ready for Testing Code is merged and ready for QA to validate labels Apr 12, 2022
@mlunadia mlunadia changed the title [Fleet] Update add agent instructions in fleet managed mode for Kubernetes [Fleet] Present users with a Kubernetes manifest for deploying agent in fleet managed mode for Kubernetes Jun 30, 2022
This pull request was closed.
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 QA:Validated Issue has been validated by QA release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Display k8 deployment instructions in fleet mode