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

Add EP-10498: Deflate repository into idiomatic Go layout #10566

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timflannagan
Copy link
Member

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:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

- 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
Copy link
Member Author

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.

$ 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.
Copy link
Contributor

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


```bash
$ tree -L 1
├── api/ # Migrated from `projects/gateway2/api/...` initially. Any future API types will be added here.
Copy link
Contributor

@yuval-k yuval-k Jan 31, 2025

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..)

Copy link
Member Author

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.


To minimize disruption, we will perform this restructuring in a single or minimal number of pull requests. The process will include updating import paths, adjusting CI and build scripts, and ensuring that all automated tests pass. Documentation will be updated to reflect the new structure, and contributors will be provided with migration guidance for adapting to the changes.

### Proposed Directory Layout
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: design/ & examples/ directories too? For the latter, we'd move the projects/gateway2/examples to the root.

@timflannagan
Copy link
Member Author

TODO: what to do about projects/distroless going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants