You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

development.md 2.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Development Guide
  2. This document is intended to provide contributors with an introduction to developing the control plane of the Sedna project.
  3. There are two components in our control plane: [GM(Global Manager) and LC(Local Controller)][framework].
  4. ## Overview
  5. Sedna provides various utilities for development wrapped in `make`.
  6. Most scripts require more or less only `make` + `bash` on the host, and generally
  7. stick to POSIX utilities. Some scripts use `docker` e.g. for image building or
  8. to use docker images containing special tools.
  9. ## Read Conventions Before Coding
  10. - [k8s coding convention]
  11. - [k8s api convention] if you want to add or update api.
  12. ## Building
  13. Before continuing, you need to follow the [prerequisites installation guide] if you haven't done it yet.
  14. ### Building Code
  15. ```shell
  16. # build GM
  17. make WHAT=gm
  18. # build LC
  19. make WHAT=lc
  20. # build GM/LC both
  21. make
  22. ```
  23. `_output/bin` will contain the freshly built binaries `sedna-gm` and `sedna-lc` upon a successful build.
  24. ### Add or Update API
  25. If you add or update APIs in `pkg/apis/`, you need to run:
  26. 1. run `bash hack/update-codegen.sh` to update client-go code in `pkg/client`.
  27. > **Note**: you need to checkout the code to `$GOPATH/src/github.com/kubeedge/sedna`.
  28. 1. run `make crds` to update the api definition.
  29. 1. run `kubectl replace -f build/crds/` to update your kubernetes environment.
  30. ### Add or Update Dependencies
  31. Run the following commands to update [Go Modules]:
  32. ```
  33. go mod tidy
  34. go mod vendor
  35. # Or: hack/update-vendor.sh
  36. ```
  37. Run `hack/update-vendor-licenses.sh` to update [vendor licenses](/LICENSES).
  38. ### Running Sedna
  39. - [See here to run GM](debug-gm.md)
  40. - [See here to run LC](debug-lc.md)
  41. ### Building Images
  42. To build the GM/LC base images:
  43. ```shell
  44. # build GM
  45. make gmimage
  46. # build LC
  47. make lcimage
  48. ```
  49. ## Run verification
  50. You need to run the verification tests locally to give your pull request the best chance of being accepted.
  51. To run all verification tests, use this command:
  52. ```shell
  53. make verify
  54. ```
  55. ## Debugging
  56. TBD
  57. ## Testing
  58. TBD
  59. ### E2E Testing
  60. TBD
  61. ## Linting
  62. You can run all of our lints at once with `make lint`.
  63. Lints include:
  64. - [golangci-lint] with [a custom config](/.golangci.yml) to lint Go sources.
  65. ## CI
  66. We use [GitHub Actions] which are configured in [.github/workflows](/.github/workflows) in the Sedna repo.
  67. [golangci-lint]: https://github.com/golangci/golangci-lint
  68. [GitHub Actions]: https://github.com/features/actions
  69. [go modules]: https://github.com/golang/go/wiki/Modules
  70. [k8s coding convention]: https://github.com/kubernetes/community/blob/master/contributors/guide/coding-conventions.md
  71. [k8s api convention]: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md
  72. [prerequisites installation guide]: /docs/contributing/prepare-environment.md
  73. [framework]: /docs/proposals/architecture.md#architecture