-
Notifications
You must be signed in to change notification settings - Fork 468
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
Add EP-10498: Deflate repository into idiomatic Go layout #10566
Add EP-10498: Deflate repository into idiomatic Go layout #10566
Conversation
Signed-off-by: timflannagan <[email protected]>
docs/content/enhancements/10498.md
Outdated
- Separate the project's Go applications by extracting existing CLI entry points (currently nested in `projects/*/cmd` subdirectories) into a top-level `cmd/` directory, in order to follow standard Go patterns. | ||
- Standardize tooling placement by ensuring all project-specific tooling, miscellaneous scripts, and other automation-related files reside in a `hack/` directory. | ||
|
||
## Non-Goals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Add non-goal for separate kgateway/api repository to make it easier for consumers to import that module without the rest of the kgateway module dependencies. This can be done over time if strictly necessary.
docs/content/enhancements/10498.md
Outdated
$ tree -L 1 | ||
├── api/ # Migrated from `projects/gateway2/api/...` initially. Any future API types will be added here. | ||
├── cmd/ # Top-level directory containing main entry points (e.g., cmd/sds, cmd/controller, cmd/envoy-init, etc.). | ||
├── internal/ # Private application and library code that is not meant to be imported by external consumers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, i think it makes sense that most code would live here. that way we know we can change it without breaking downstream clients
docs/content/enhancements/10498.md
Outdated
|
||
```bash | ||
$ tree -L 1 | ||
├── api/ # Migrated from `projects/gateway2/api/...` initially. Any future API types will be added here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've seen projects use the plural form apis
because often you have more than one (i.e. v1alpha1
, v1beta1
, etc..)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I've seen a combination of api, apis, and pkg/api(s) throughout the ecosystem. I tend to prefer the first two unless the project adopted the pkg/apis organization as k8s tooling matured.
TODO: what to do about projects/distroless going forward. |
docs/content/enhancements/10498.md
Outdated
├── internal/ # Private application and library code that is not meant to be imported by external consumers. | ||
├── pkg/ # Reusable library code that external consumers could import in the future. | ||
├── test/ # Test helpers, e2e tests, integration test assets, etc. | ||
├── hack/ # Houses project-specific tooling, miscellaneous scripts, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to keep hack? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other potential names: tools
, scripts
?
docs/content/enhancements/10498.md
Outdated
├── ci/ # Open question: Should CI-specific scripts remain here or be moved to hack/? | ||
└── ... | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is https://github.com/kgateway-dev/kgateway/tree/main/install/helm going to live?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's missing from the current tree layout. I was trying to refactor/rip out/cleanup/etc. the other non-code directories outside of this proposal before enumerating on the final directory structure here. IMO, install/ is fine unless we have better options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Added the install directory to the tree output in the latest round of commits.)
This commit temporarily removes the CODEOWNERS file now that the docs/ directory has largely been migrated to the kateway.dev repository. Previously, this file contained minimal code owner paths and tagged the docs team whenever any non-osa_*.md file(s) were changed in the docs/ directory. Related to kgateway-dev#10566 which overhauls the repository structure. We can re-evaluate the right CODEOWNERS approach once that EP has been approved and implemented. Related to kgateway-dev#10431 which tracks better CODEOWNER adoption throughout the repository. Signed-off-by: timflannagan <[email protected]>
Signed-off-by: timflannagan <[email protected]>
Signed-off-by: timflannagan <[email protected]>
├── api/ # Migrated from `projects/gateway2/api/...` initially. Any future API types will be added here. | ||
├── cmd/ # Top-level directory containing main entry points (e.g., cmd/sds, cmd/controller, cmd/envoy-init, etc.). | ||
├── design/ # Enhancements, templates, etc. | ||
├── examples/ # Example usage, etc. Open question on whether we want to keep this. The README.md would reference this directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaning towards removing this directory. See #10579 (review) for more context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From ^ PR ref:
does it make sense to just remove the examples directory and rely on the unit / e2e tests as examples? in theory the tests should cover (most of) the use cases we support
Consider using examples
for quickstart guide assets (xref).
### Proposed Directory Layout | ||
|
||
```bash | ||
$ tree -L 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs/ directory is missing from this proposed directory layout. See #10576 which overhauled the docs/ directory and replaced the contents with a docs/README.md file that references the dedicated kgateway.dev documentation repository. I think we're leaning towards removing that directory as a follow-up after this EP is implemented.
|
||
- `internal/` usage: Which packages are truly internal-only vs. possibly importable by external consumers? | ||
- Versioning: Should there be a dedicated `internal/version` package, or is placing version info in `cmd/` acceptable? | ||
- CI directory: Should CI-specific scripts remain in `ci/` or be moved into `hack/`? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like most scripts under ci
can also be used for local debugging so i wouldn't be opposed to moving it into hack. what is the convention for this in other projects? we can also leave them separate for now and iterate on it later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think hack
is pretty widely adopted throughout the k8s ecosystem, so I'm leaning towards consolidating the ci/*
contents into the hack directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 You're spot on @timflannagan with using hack
and we can create add'l sub dirs from there as needed.
- Versioning: Should there be a dedicated `internal/version` package, or is placing version info in `cmd/` acceptable? | ||
- CI directory: Should CI-specific scripts remain in `ci/` or be moved into `hack/`? | ||
- projects/distroless: Should we keep this directory? If so, where should it live? | ||
- projects/gateway2: Do we need to keep the non-code files, e.g. istio.sh, Makefile, etc.? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik istio.sh is for local testing, can probably be moved into the hack directory
we should probably combine this Makefile into the top-level Makefile
Description
Add an enhancement for deflating the current repository structure (notable the projects/ directory) into a flatter organization. Implementation will follow if accepted.
Related to #10496.
Related to #10498.
Checklist: