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

Refactor profiles to decouple them from stack resources #1140

Merged
merged 10 commits into from
Apr 4, 2023

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Feb 9, 2023

Introduce several refactors to decouple profiles from stack resources, with the target of allowing the implementation of multiple stack providers and to try to establish better foundations for isolated and persistent profiles.

Note to reviewers: Sorry for the big change, but once files are moved and templatized it is difficult to keep this small. Let me know if you want a walk-through over zoom.

Changes here:

  • New elastic-package profile use command to select profile to use.
  • Configuration files are not rewritten on upgrade.
  • Stack and test runner files are managed by their own providers.
  • Stack and test runner files are only written when the services are started, and only if they are different.
  • Stack files are templates now. Same files are used for multiple versions. Runtime configuration can be passed now as data to templates instead of requiring environment variables.
  • Support for multiple stack providers.

Related issues:

* New `elastic-package profile use` command to select profile to use.
* Configuration files are not rewritten on upgrade.
* Stack and test runner files are managed by their own providers.
* Stack and test runner files are only written when the services are
  started, and only if they are different.
* Stack files are templates now. Same files are used for multiple
  versions. Runtime configuration can be passed now as data to
  templates instead of requiring environment variables.
* Support for multiple stack providers.
@jsoriano jsoriano requested a review from a team February 9, 2023 20:00
@jsoriano jsoriano self-assigned this Feb 9, 2023
@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 9, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-02-20T09:08:44.922+0000

  • Duration: 33 min 56 sec

Test stats 🧪

Test Results
Failed 0
Passed 890
Skipped 0
Total 890

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link
Collaborator

elasticmachine commented Feb 9, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (35/35) 💚
Files 63.636% (84/132)
Classes 58.947% (112/190)
Methods 47.198% (379/803)
Lines 30.933% (3411/11027)
Conditionals 100.0% (0/0) 💚

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

Great refactor! go-resource lib is quite helpful for this use case 👍

Comment on lines 31 to 39
{{ if not (semverLessThan $version "8.7.0") }}
xpack.fleet.enableExperimental: ["experimentalDataStreamSettings"] # Enable experimental toggles in Fleet UI
{{ end }}

xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012"

{{ if not (semverLessThan $version "8.1.0") }}
xpack.cloudSecurityPosture.enabled: true
{{ end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! Having these templates is going to be easier to add new features depending on the version, thanks!!

internal/install/application_configuration.go Show resolved Hide resolved
internal/stack/boot.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
internal/stack/boot.go Show resolved Hide resolved
Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

👍

@jsoriano
Copy link
Member Author

Testing with integrations in elastic/integrations#5252.

@jsoriano
Copy link
Member Author

/test

@jsoriano jsoriano requested a review from mrodm March 14, 2023 13:40
Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

LGTM!
Conflicts will be high likely because of updating of the package-registry version used by default in Elastic stack to v1.19.0.

internal/stack/resources.go Outdated Show resolved Hide resolved
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @jsoriano

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants