Skip to content

Use configuration file to select Elastic stack version#275

Merged
mtojek merged 21 commits intoelastic:masterfrom
mtojek:271-select-images
Mar 9, 2021
Merged

Use configuration file to select Elastic stack version#275
mtojek merged 21 commits intoelastic:masterfrom
mtojek:271-select-images

Conversation

@mtojek
Copy link
Copy Markdown
Contributor

@mtojek mtojek commented Mar 4, 2021

Issue: #271

This PR modifies the behavior of Elastic stack orchestrator (Docker Compose) and Kubernetes agent's deployer to consider selected versions.

TODO:

  • Select right image references for docker-compose up
  • Select right image references for docker-compose pull
  • Select right image references for Kubernetes agent deployer

@mtojek mtojek self-assigned this Mar 4, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

elasticmachine commented Mar 4, 2021

💚 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

Expand to view the summary

Build stats

  • Build Cause: Pull request #275 updated

  • Start Time: 2021-03-09T17:50:03.590+0000

  • Duration: 19 min 12 sec

  • Commit: 1fd7e9f

Test stats 🧪

Test Results
Failed 0
Passed 311
Skipped 1
Total 312

Trends 🧪

Image of Build Times

Image of Tests

@mtojek mtojek marked this pull request as ready for review March 4, 2021 15:14
@mtojek mtojek requested a review from ycombinator March 4, 2021 15:14
@mtojek
Copy link
Copy Markdown
Contributor Author

mtojek commented Mar 4, 2021

One note: I didn't write the override for 8.0.0-SNAPSHOT because simply I don't know which sha256 will work here :(

@mtojek
Copy link
Copy Markdown
Contributor Author

mtojek commented Mar 5, 2021

One note: I didn't write the override for 8.0.0-SNAPSHOT because simply I don't know which sha256 will work here :(

Thanks @ruflin for pointing to the working snapshot for elastic-agent. I suppose that with this change we have a good workaround for emergency situations.


const applicationConfigurationYml = `stack:
imageRefOverrides:
7.13.0-SNAPSHOT:
Copy link
Copy Markdown
Contributor

@ycombinator ycombinator Mar 5, 2021

Choose a reason for hiding this comment

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

I understand what you are trying to do over here but I'm wondering if we need this level in the setting hierarchy.

I was thinking the config that is shipped with elastic-package would look something like this:

stack:
  images:
    "elastic-agent": "docker.elastic.co/beats/elastic-agent:7.13.0-SNAPSHOT"
    elasticsearch: "docker.elastic.co/elasticsearch/elasticsearch:7.13.0-SNAPSHOT"
    kibana: "docker.elastic.co/kibana/kibana:7.13.0-SNAPSHOT"

This would replace the DefaultStackVersion hardcoded version we have in the code today. Instead, the code would read the config and get the image names (including versions) from there.

Individual images could then be overridden by repo-level or local-level configurations that have the same structure (as mentioned in this comment).

Copy link
Copy Markdown
Contributor Author

@mtojek mtojek Mar 5, 2021

Choose a reason for hiding this comment

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

The reason why I implement it like this is because we need a place to fixtures for various stack version. Use cases:

  • elastic-agent in 7.13.0 doesn't work with latest snapshot - we need to use a stable image
  • kibana in 8.0.0-SNAPSHOT is broken, we know about this, we need to set a specific version

I'm afraid we need a support matrix somewhere (per version stack), not sure where should we keep it. I'm happy to discuss it further!

EDIT:

Please consider also install tests against older versions: https://github.com/elastic/integrations/blob/master/.ci/Jenkinsfile#L89-L92

Copy link
Copy Markdown
Contributor

@ycombinator ycombinator Mar 5, 2021

Choose a reason for hiding this comment

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

Okay, I see your point now, especially considering install tests again older versions.

I'm good with this structure but I'd keep the values in this file (the one supplied by elastic-package) clean — no specific SHAs, etc. IMO, overrides should be specified either at the repo level or the local development level, in similarly structured files as this one. elastic-package can discover these files by walking up the folder tree until it finds .elastic-package/config.yml and .elastic-package/config.dev.yml.

Nit: maybe we should remove the DefaultVersion const from the code and move it into this file, under the setting stack.default_version or similar? That way all information related to stack versions is in the same file and we only need to update this one file after every stack release.

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.

Let me challenge it, I believe we're close to the final form.

It's a common use case to start the start wherever you want with: elastic-package stack up, which should pick up latest snapshots. If there is a problem with latest SNAPSHOTS, without fixtures in ~/.elastic-package/config.yml it will fail.

I think this is the only concern I have. It would be great if we can make elastic-package stack up working just anywhere.

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.

Discussed this with @mtojek off-PR. We're on the same page now. Current model is good as-is. Reasons:

  • It is the same amount of work for package authors to update elastic-package to get the override image IDs and then back to latest ones as it would be if we created a .elastic-package/config.yml in the integrations repo.
  • Creating a .elastic-package/config.yml in the integrations repo would benefit developers who develop packages in that repo, but not other package developers using elastic-package.
  • By providing the overrides via the elastic-package tool we also get an opportunity to get package developers to update their version of elastic-package from time to time.

@mtojek
Copy link
Copy Markdown
Contributor Author

mtojek commented Mar 9, 2021

/test

Copy link
Copy Markdown
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

LGTM. WFG.

const applicationConfigurationYmlFile = "config.yml"

const applicationConfigurationYml = `stack:
image_ref_overrides:
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.

Maybe put some commented out structure here so it's easy to know how to change it when we need to make overrides? Also maybe include a comment about informing package developers whenever overrides are defined or removed here?

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.

Good idea, added!

Copy link
Copy Markdown
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

Oops, gave my LGTM a bit pre-maturely. I just made another comment.

Copy link
Copy Markdown
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

LGTM.

@mtojek
Copy link
Copy Markdown
Contributor Author

mtojek commented Mar 9, 2021

I think we may need the #280 first to make this PR passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants