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

Fix the method for converting Docker Compose to K8 Manifest. #623

Merged
merged 3 commits into from
Jan 16, 2025

Conversation

shanukun
Copy link
Contributor

@shanukun shanukun commented Dec 14, 2024

Description

Kind: List was discarded by kompose in kubernetes/kompose#1541. That's why Meshkit is unable to format the output and is returning an empty K8 manifest string.

kompose (> 1.31.1) can support Docker Compose 3.9, although not the version (v1.26.2) used in meshery/meshery.
We can simplify the implementation of the Convert method by updating kompose and using the new client/interface (kubernetes/kompose#1593). We will need to bump the kompose version in meshery too.

Also, it seems there is no support for Profiles in meshery. Right now it is simply ignored. Meshery's API and UI will need to be updated to accommodate it.

This PR fixes:
meshery/meshery#12495
Part of meshery/meshery#10450

Notes for Reviewers
Removing the format function and returning the output without formatting can be a straightforward fix. (quick fix).

Signed commits

  • Yes, I signed my commits.

Copy link

welcome bot commented Dec 14, 2024

Yay, your first pull request! 👍 A contributor will be by to give feedback soon. In the meantime, please review the Layer5 Community Welcome Guide and sure to join the community Slack.
Be sure to double-check that you have signed your commits. Here are instructions for making signing an implicit activity while peforming a commit.

@shanukun shanukun marked this pull request as ready for review December 14, 2024 01:39
@shanukun
Copy link
Contributor Author

@leecalcote can you please review it?

@leecalcote
Copy link
Member

@nebula-aac, help, help

@leecalcote leecalcote requested a review from a team December 20, 2024 22:03
@shanukun shanukun force-pushed the update_kompose_convert branch from 483f5b9 to 32bb666 Compare December 25, 2024 12:50
Copy link

@sangramrath sangramrath left a comment

Choose a reason for hiding this comment

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

My limited knowledge of this says it's good to go.

@shanukun shanukun force-pushed the update_kompose_convert branch from 32bb666 to 53a791e Compare January 9, 2025 17:49
@winkletinkle
Copy link
Contributor

Conflicts resolved

@winkletinkle
Copy link
Contributor

@nebula-aac, help, help

👀, @leecalcote, I don't see a response here. I can help on my path to becoming a maintainer. I know there is active contribution requirement. I have time.

Copy link
Member

@leecalcote leecalcote left a comment

Choose a reason for hiding this comment

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

@shanukun, this is great. Thank you for working on this. Related to Kind: List, will you please contrast your effort here in context of this meshery/meshery PR - meshery/meshery#13233? These are similar topics. Are we simpatico here and headed in the same direction? // @souvikinator

@leecalcote leecalcote added kind/chore Necessary task language/go Golang related labels Jan 14, 2025
@shanukun
Copy link
Contributor Author

Assumed:
kompose => [manifest with kind:List] => [meshkit converts it to manifest with '---' separated items (which meshery can handle)] => meshery

It was the case with prior versions of kompose, but not with the one now in use in meshkit. Now kompose returns a --- separated list instead of a manifest with kind:List.

Current:
kompose => ['---' separated list] => [meshkit attempts to convert it to '---' separated list, but fails] => meshery

Expected (after this PR):
kompose => [ '---' separated list] => meshery

The PR meshery/meshery#13233 is attempting to expand the capabilities of meshery/meshery for processing manifests with kind:list.

err = convert(ConvertOpt)
if err != nil {
return "", err
ConvertOpt := client.ConvertOptions{
Copy link
Contributor

@souvikinator souvikinator Jan 14, 2025

Choose a reason for hiding this comment

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

You might want to add the WithKomposeAnnotations option, as it was previously being passed.
However, I’m not sure if the annotations are being put to any use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is true by default.
I’ve kept the configuration exactly the same. The manifests generated by the client or by a previous implementation shouldn't differ in any way.

@souvikinator souvikinator self-requested a review January 14, 2025 13:01
@souvikinator
Copy link
Contributor

souvikinator commented Jan 14, 2025

@shanukun @leecalcote This looks good.

To summarize: This is a meshkit issue that arises when formatting the converted manifest to align with the format supported by the Meshery server, due to changes in the Kompose manifest format.

The PR addresses two main points:

  1. Fixing the issue by eliminating the formatting (needed)
  2. Simplifying the conversion using the kompose client (this requires a version upgrade in Meshery; I checked, and it shouldn't break anything).

@leecalcote
Copy link
Member

@shanukun, does it work? 😉 This is an obvious "yes", but it would be helpful if you included results of your tests and example Compose files.

@leecalcote
Copy link
Member

Does this work end-to-end when Meshery Server uses this revised function?

@leecalcote
Copy link
Member

This is some quality work, @shanukun. Is there a corresponding PR in meshery/meshery that upgrades to the new version of the kompose package?

@leecalcote
Copy link
Member

@shanukun would you like to raise an issue calling for the support of Compose Profiles?

@leecalcote leecalcote merged commit 0e53761 into meshery:master Jan 16, 2025
3 of 4 checks passed
Copy link

welcome bot commented Jan 16, 2025

Thanks for your contribution to Meshery! 🎉

Shows a black logo in light color mode and a white one in dark color mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/chore Necessary task language/go Golang related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants