|
| 1 | +# kOps Project Overview |
| 2 | + |
| 3 | +kOps is a command-line tool for creating, destroying, upgrading, and maintaining production-grade, highly available Kubernetes clusters. It is written in Go and supports multiple cloud providers, including AWS, GCP, DigitalOcean, Hetzner, OpenStack, and Azure. |
| 4 | + |
| 5 | +The project is well-structured, with a clear separation of concerns between the different packages. The `cmd` directory contains the main entry points for the `kops` CLI and other related commands. The `pkg` directory contains the core logic for managing clusters, and the `upup` directory contains the code for provisioning cloud infrastructure. |
| 6 | + |
| 7 | +The project has a comprehensive test suite, including unit tests, integration tests, and end-to-end tests. It also has a robust CI/CD pipeline that runs these tests on every pull request. |
| 8 | + |
| 9 | +## Building and Running |
| 10 | + |
| 11 | +### Prerequisites |
| 12 | + |
| 13 | +* `make` |
| 14 | + |
| 15 | +### Building |
| 16 | + |
| 17 | +To build the `kops` binary, run the following command: |
| 18 | + |
| 19 | +```bash |
| 20 | +make kops |
| 21 | +``` |
| 22 | + |
| 23 | +This will create the `kops` binary in the `.build/dist/<os>/<arch>` directory. |
| 24 | + |
| 25 | +To build all the binaries, including `kops`, `protokube`, `nodeup`, and `channels`, run the following command: |
| 26 | + |
| 27 | +```bash |
| 28 | +make all |
| 29 | +``` |
| 30 | + |
| 31 | +### Running |
| 32 | + |
| 33 | +To run the `kops` binary, you can either run it directly from the `dist` directory or install it to your `$GOPATH/bin` directory by running the following command: |
| 34 | + |
| 35 | +```bash |
| 36 | +make install |
| 37 | +``` |
| 38 | + |
| 39 | +### Testing |
| 40 | + |
| 41 | +To run the unit tests, run the following command: |
| 42 | + |
| 43 | +```bash |
| 44 | +make test |
| 45 | +``` |
| 46 | + |
| 47 | +To run the verification scripts, run the following command: |
| 48 | + |
| 49 | +```bash |
| 50 | +make verify |
| 51 | +``` |
| 52 | + |
| 53 | +To run the full suite of CI checks, run the following command: |
| 54 | + |
| 55 | +```bash |
| 56 | +make ci |
| 57 | +``` |
| 58 | + |
| 59 | +## Development Conventions |
| 60 | + |
| 61 | +### Guidelines for Programming Assistance |
| 62 | + |
| 63 | +When assisting with programming tasks, you will adhere to the following principles: |
| 64 | + |
| 65 | +* **Follow Requirements**: Carefully follow the user's requirements to the letter. |
| 66 | +* **Plan First**: For any non-trivial change, first describe a detailed, step-by-step plan, including the files you intend to modify and the tests you will add or update. |
| 67 | +* **Test Thoroughly**: Implement comprehensive tests to ensure correctness and prevent regressions. |
| 68 | +* **Comment Intelligently**: Add comments to explain the "why" behind complex or non-obvious code, keeping in mind that the reader may not be a Kubernetes expert. |
| 69 | +* **No TODOs**: Leave no `TODO` comments, placeholders, or incomplete implementations. |
| 70 | +* **Prioritize Correctness**: Always prioritize security, scalability, and maintainability in your implementations. |
| 71 | + |
| 72 | +### Code Style |
| 73 | + |
| 74 | +The project follows the standard Go code style and the official [Kubernetes coding conventions](https://www.k8s.dev/docs/guide/coding-convention/). All code should be formatted with `gofmt` and `goimports`. You can format the code by running the following commands: |
| 75 | + |
| 76 | +```bash |
| 77 | +make gofmt |
| 78 | +make goimports |
| 79 | +``` |
| 80 | + |
| 81 | +### Linting |
| 82 | + |
| 83 | +The project uses `golangci-lint` to lint the code. You can run the linter by running the following command: |
| 84 | + |
| 85 | +```bash |
| 86 | +make verify-golangci-lint |
| 87 | +``` |
| 88 | + |
| 89 | +### Dependencies |
| 90 | + |
| 91 | +The project uses Go modules to manage dependencies. To add a new dependency, add it to the `go.mod` file and then run the following command: |
| 92 | + |
| 93 | +```bash |
| 94 | +make gomod |
| 95 | +``` |
| 96 | + |
| 97 | +### Commits |
| 98 | + |
| 99 | +The project follows the conventional commit message format. |
| 100 | + |
| 101 | +### Contributions |
| 102 | + |
| 103 | +Contributions are welcome! Before submitting a pull request, please open an issue to discuss your proposed changes. All pull requests must be reviewed and approved by a maintainer before they can be merged. |
| 104 | + |
0 commit comments