Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

standardize make tooling with top level Makefile #93

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

BlaineEXE
Copy link
Contributor

Standardize make tooling. Remove unnecessary duplication where possible, including with common copies of go fmt/vet/test targets.

Slighty shift around controller and sidecar 'cmd/' directories to allow specifying a template Dockerfile that can be used to generate Dockerfiles for each image easily.

Where it makes sense, this work adopts the make target naming and Dockerfile usage of the kubebuilder project. The biggest divergence from that template is because we build 2 images from one repo, and because we have a 'proto/' dir for gRPC code.

Significant testing was done to ensure that the tooling works with Unix make on MacOS as well as GNU-Make (gmake). Testing was also done to ensure the make all target works well with make -j's parallel execution flag, allowing dev speedup where possible.

Some proto targets were adjusted to allow make to do a better job detecting when file/code generation is not necessary, saving time in the common case where there are no proto changes.

A future goal, which this helps lay groundwork for, will be to make sure that there are top-level make targets that are usable by Prow CI. For example, 'test' can be used to run all unit tests. Any unit tests added to any component can be included in 'make test' to ensure we don't need to make frequent changes to Prow CI definitions. Similarly 'make build' should build all binaries and images to ensure builds work. 'make generate' and 'make codegen' should include targets that generate files in any way, which will allow Prow CI to ensure developers are running all generators. In the future, we have room to add intall and/or e2e tests as make targets.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 15, 2024
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 15, 2024
@BlaineEXE
Copy link
Contributor Author

FWIW, the help target is the boilerplate one suggested by kubebuilder. The output, after my work today, looks like this:

image

Standardize make tooling. Remove unnecessary duplication where possible,
including with common copies of go fmt/vet/test targets.

Slighty shift around controller and sidecar 'cmd/' directories to allow
specifying a template Dockerfile that can be used to generate
Dockerfiles for each image easily.

Where it makes sense, this work adopts the make target naming and
Dockerfile usage of the kubebuilder project. The biggest divergence from
that template is because we build 2 images from one repo, and because we
have a 'proto/' dir for gRPC code.

Significant testing was done to ensure that the tooling works with Unix
make on MacOS as well as GNU-Make (gmake). Testing was also done to
ensure the `make all` target works well with `make -j`'s parallel
execution flag, allowing dev speedup where possible.

Some proto targets were adjusted to allow make to do a better job
detecting when file/code generation is not necessary, saving time in the
common case where there are no proto changes.

A future goal, which this helps lay groundwork for, will be to make sure
that there are top-level make targets that are usable by Prow CI. For
example, 'test' can be used to run all unit tests. Any unit tests added
to any component can be included in 'make test' to ensure we don't need
to make frequent changes to Prow CI definitions. Similarly 'make build'
should build all binaries and images to ensure builds work. 'make
generate' and 'make codegen' should include targets that generate files
in any way, which will allow Prow CI to ensure developers are running
all generators. In the future, we have room to add intall and/or e2e
tests as make targets.

Signed-off-by: Blaine Gardner <[email protected]>
@BlaineEXE
Copy link
Contributor Author

BlaineEXE commented Aug 16, 2024

This test-infra PR should unblock the make test unit test: kubernetes/test-infra#33332

@BlaineEXE
Copy link
Contributor Author

/retest

@xing-yang
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 28, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BlaineEXE, xing-yang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [BlaineEXE,xing-yang]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit e9d5dfb into kubernetes-retired:monorepo Aug 28, 2024
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants