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:template develop dryrun deploy #3778

Merged
merged 1 commit into from Aug 29, 2023
Merged

Conversation

zjy365
Copy link
Contributor

@zjy365 zjy365 commented Aug 28, 2023

πŸ€– Generated by Copilot at 69b732a

Summary

πŸš€πŸ› οΈπŸŒ

This pull request adds a new feature to the frontend of the sealos template provider, which allows users to perform dry run deployments of their templates. It modifies the applyApp API endpoint, the postDeployApp function, the kubernetes.ts service, and the Develop and BreadCrumbHeader components to support this feature. It also adds the corresponding button text to the common.json files for the English and Chinese locales. Additionally, it fixes some minor formatting and UI issues in the Form and EditApp components.

If you want to deploy an app with YAML
But you're not sure if it will go well
You can use dryRun mode
To test the code
And avoid any cluster mishap or hell

Walkthrough

  • Add a new feature to allow users to test the deployment of a template without applying it to the cluster (dryrun deploy) (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Add a new type parameter to the postDeployApp function in frontend/providers/template/src/api/app.ts to indicate the mode of deployment ('create', 'replace', or 'dryrun') (link)
  • Add a new type property to the request body of the handler function in frontend/providers/template/public/locales/en/common.json to pass the mode of deployment to the backend service (link)
  • Pass the type property from the request body to the applyYamlList function in frontend/providers/template/src/services/backend/kubernetes.ts, which handles the actual deployment logic (link)
  • Add a new possible value 'dryrun' to the type parameter of the applyYamlList function in frontend/providers/template/src/services/backend/kubernetes.ts, which calls the CreateYaml function with the 'All' value for the dryRun parameter if the type is 'dryrun' (link, link)
  • Add a new optional parameter dryRun to the CreateYaml function in frontend/providers/template/src/services/backend/kubernetes.ts, which can be either 'All' or undefined, and pass it to the client.create method, which handles the actual API call to the cluster (link, link)
  • Add a new key-value pair to the common.json files for the English and Chinese locales, with the key "Dryrun Deploy" and the corresponding values, to display a button text for the dryrun deploy feature (link, link)
  • Add a new import for the editModeMap constant from the constants/editApp file, and a new applyCb prop to the BreadCrumbHeader component in frontend/providers/template/src/pages/develop/components/BreadCrumbHeader.tsx, which is a callback function for the dryrun deploy feature (link)
  • Add a new Button component to the BreadCrumbHeader component in frontend/providers/template/src/pages/develop/components/BreadCrumbHeader.tsx, with the text "Dryrun Deploy" and the applyCb prop function as the onClick handler (link)
  • Add new state variables for the loading, errorMessage, title, applyBtnText, applyMessage, applySuccess, and applyError to the Develop component in frontend/providers/template/src/pages/develop/index.tsx, which are used for the dryrun deploy feature and the error handling logic (link)
  • Add a new submitSuccess function that calls the postDeployApp function with the 'dryrun' mode and displays a toast message with the result, and a new submitError function that displays a toast message with the error message from the form validation, to the Develop component in frontend/providers/template/src/pages/develop/index.tsx, and pass them to the formHook.handleSubmit method as callbacks (link)
  • Add the applyCb prop to the BreadCrumbHeader component and pass the formHook.handleSubmit method with the submitSuccess and submitError callbacks, to the Develop component in frontend/providers/template/src/pages/develop/index.tsx, to trigger the dryrun deploy feature when the button is clicked (link)
  • Add the Loading component and the ErrorModal component to the render output of the Develop component in frontend/providers/template/src/pages/develop/index.tsx, to show the loading state and the error message when the dryrun deploy feature is executed (link)
  • Remove some extra spaces at the end of some properties of some components in various files, which are minor formatting changes that do not affect the functionality (link, link, link, link, link, link, link, link, link, link)
  • Remove the autoFocus property of the Input component in the Form component of frontend/providers/template/src/pages/develop/components/Form.tsx, which is a minor UI change that prevents the input from automatically getting focus when the form is rendered (link)
  • Remove the explicit export of the Develop component from frontend/providers/template/src/pages/develop/index.tsx, which is a minor code simplification as the component is already the default export function (link)
  • Remove the unused import for the t function from i18next and the Header component from various files, which are minor code cleanups that reduce the unnecessary dependencies (link, link)

Signed-off-by: jingyang <3161362058@qq.com>
@sealos-ci-robot
Copy link
Member

πŸ€– Generated by lychee action

Summary

Status Count
πŸ” Total 909
βœ… Successful 372
⏳ Timeouts 0
πŸ”€ Redirected 0
πŸ‘» Excluded 536
❓ Unknown 0
🚫 Errors 0

Full action output

Full Github Actions output

@codecov
Copy link

codecov bot commented Aug 28, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (7780d42) 66.71% compared to head (69b732a) 66.71%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3778   +/-   ##
=======================================
  Coverage   66.71%   66.71%           
=======================================
  Files           8        8           
  Lines         661      661           
=======================================
  Hits          441      441           
  Misses        173      173           
  Partials       47       47           

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

@c121914yu c121914yu merged commit 5f6c39b into labring:main Aug 29, 2023
27 of 28 checks passed
lingdie added a commit to lingdie/sealos that referenced this pull request Aug 29, 2023
* Fix/debt webhook config (labring#3777)

* fix webhook policy cause api-server busy

* fix account status via webhook

* style: rename some functions and constants related with runtime implementation (labring#3763)

* style: rename constants.Data to PathResolver

* style: move non-generic constants to respective module directories

* style: rename functions

* fix: path of remote config dir

* fix: path of kubeadm init and upate file in e2e test

* fix: avoid reusing the private ConvertedKubeadmConfig

* style: rename ConfigsPath

* feat:cronjob deploy & desktop background (labring#3776)

* feat:cronjob deploy

Signed-off-by: jingyang <3161362058@qq.com>

* desktop background

Signed-off-by: jingyang <3161362058@qq.com>

* delete serviceAccount

* backgrond svg

---------

Signed-off-by: jingyang <3161362058@qq.com>

* feat:template develop dryrun deploy (labring#3778)

Signed-off-by: jingyang <3161362058@qq.com>

* Count pods that not in succeeded & watch gpu changes on nodes (labring#3754)

* fix: count pods that not in succeeded

* feat: watch gpu changes on nodes

* fix golangci-lint

* fix

* abstract methods

* fix golangci-lint

* launchpad imagePullPolicy (labring#3775)

* add sealos cloud arm64 cluster image

---------

Signed-off-by: jingyang <3161362058@qq.com>
Co-authored-by: Jiahui <4543bxy@gmail.com>
Co-authored-by: fengxsong <fengxsong@outlook.com>
Co-authored-by: zhujingyang <72259332+zjy365@users.noreply.github.com>
Co-authored-by: xuziyi <nowinkey@tom.com>
Co-authored-by: Archer <545436317@qq.com>
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.

None yet

3 participants