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

feat(risedev): use jsonnet for profiles and templates #16659

Closed
wants to merge 11 commits into from

Conversation

BugenZhao
Copy link
Member

@BugenZhao BugenZhao commented May 9, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Jsonnet is a powerful tool to write reusable and extensible configurations.

In this PR, we introduced jsonnet-based RiseDev profiles and templates. Benefits are:

  • Get rid of the Rust "expanders" for manipulating profiles. All transformations are done in jsonnet.
  • Be able to reuse the service list between different profiles.
  • Code-completion and hints when writing new profiles or service templates.

The compatibility for old risedev.yml format is still kept through compat.libsonnet. We can migrate them in the future.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

BugenZhao added 9 commits May 8, 2024 17:04
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
Signed-off-by: Bugen Zhao <[email protected]>
@BugenZhao BugenZhao marked this pull request as ready for review May 9, 2024 10:22
@BugenZhao BugenZhao requested a review from a team as a code owner May 9, 2024 10:22
@BugenZhao BugenZhao requested review from TennyZhuang and xxchan May 9, 2024 10:22
Copy link
Member Author

Choose a reason for hiding this comment

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

This is where future risedev profiles will reside.

Copy link
Member Author

Choose a reason for hiding this comment

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

Migrated from the template section in risedev.yml.

// Advertise port of MinIO s3 endpoint
port: 9301,
// Listen address of MinIO endpoint
listenAddress: self.address,
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to use DollarExpander anymore.


etcd: {
// Id of this instance
id: 'etcd-' + self.port,
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to use IdExpander anymore.

Comment on lines +21 to +25
// Expand the provided steps.
// The nested `provide-xx` fields will not be used. Prune them.
pruneProvide(otherStep)
for otherStep in steps
if std.startsWith(otherStep.id, std.rstripChars(step[name], '*'))
Copy link
Member Author

Choose a reason for hiding this comment

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

No need for ProvideExpander anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the entrypoint of the jsonnet program to evaluate.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is to convert risedev.yml to the format of risedev-profiles.libsonnet.

Comment on lines +340 to +345
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
struct Input {
config_path: Option<String>,
steps: Vec<ServiceConfig>,
}
Copy link
Member Author

Choose a reason for hiding this comment

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

The generated JSON will be directly deserialized into this struct, then executed by risedev-dev.

Signed-off-by: Bugen Zhao <[email protected]>
Copy link
Member

@xxchan xxchan left a comment

Choose a reason for hiding this comment

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

Generally LGTM (not delved into the details), although I don't see there's any compelling reasons to do the refactoring (risedev config expander works good enough).

Besides, please update src/risedevtool/README.md. src/risedevtool/risedev-schema.json may also need update.

Copy link
Member

@stdrc stdrc left a comment

Choose a reason for hiding this comment

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

LGTM since it seems to do no harm to current dev experience and at the same time delete so many LoC

Copy link
Contributor

This PR has been open for 60 days with no activity.

If it's blocked by code review, feel free to ping a reviewer or ask someone else to review it.

If you think it is still relevant today, and have time to work on it in the near future, you can comment to update the status, or just manually remove the no-pr-activity label.

You can also confidently close this PR to keep our backlog clean. (If no further action taken, the PR will be automatically closed after 7 days. Sorry! 🙏)
Don't worry if you think the PR is still valuable to continue in the future.
It's searchable and can be reopened when it's time. 😄

Copy link
Contributor

github-actions bot commented Aug 4, 2024

Close this PR as there's no further actions taken after it is marked as stale for 7 days. Sorry! 🙏

You can reopen it when you have time to continue working on it.

@github-actions github-actions bot closed this Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants