Skip to content

make: re-add kube make targets#132

Merged
arkodg merged 1 commit into
envoyproxy:mainfrom
arkodg:kube-makefile
Jun 30, 2022
Merged

make: re-add kube make targets#132
arkodg merged 1 commit into
envoyproxy:mainfrom
arkodg:kube-makefile

Conversation

@arkodg
Copy link
Copy Markdown
Contributor

@arkodg arkodg commented Jun 30, 2022

  • re add the kube make targets that were accidently
    removed as part of chore: add more commands and refactor makefiles #113

  • rm implementation for image.multiarch, which needs work

  • rm Makefile.targets.mk and reuse tools/make/common.mk

  • move top level targets to the right makefiles

  • move make help strings closer to the target

Envoy Gateway is an open source project for managing Envoy Proxy as a standalone or Kubernetes-based application gateway

Usage: make <Targets> <Options> ...

Targets:

Usage:
  make <target>

Golang
  build            Build envoy-gateway for host platform. See Option PLATFORM and BINS.
  test             Run all Go test of code sources.
  format           Format codes style with mod tidy, gofmt and goimports.
  clean            Remove all files that are created during builds.

Image
  image            Build docker images for host platform. See Option PLATFORM and BINS.
  push             Push docker images to registry.

Lint
  lint             Run all linter of code sources, including golint, yamllint and codespell.

Kubernetes Development
  manifests        Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
  generate         Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
  kube-test        Run Kubernetes provider tests.

Kubernetes Deployment
  kube-install     Install CRDs into the Kubernetes cluster specified in ~/.kube/config.
  kube-uninstall   Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

Kubernetes Build Dependencies
  kustomize        Download kustomize locally if necessary.
  controller-gen   Download controller-gen locally if necessary.
  envtest          Download envtest-setup locally if necessary.

Options:
  BINS         The binaries to build. Default is all of cmd.
               This option is available when using: make build/build.multiarch
               Example: make build BINS="envoy-gateway"
  IMAGES       Backend images to make. Default is all of cmds.
               This option is available when using: make image/image.multiarch/push/push.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway"
  PLATFORM     The specified platform to build.
               This option is available when using: make build/image
               Example: make build BINS="envoy-gateway" PLATFORM="linux_amd64"
               Supported Platforms: linux_amd64 linux_arm64 darwin_amd64 darwin_arm64
  PLATFORMS    The multiple platforms to build.
               This option is available when using: make build.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway" PLATFORMS="linux_amd64 linux_arm64"
               Default is "linux_amd64 linux_arm64 darwin_amd64 darwin_arm64".

Signed-off-by: Arko Dasgupta arko@tetrate.io

* re add the kube make targets that were accidently
removed as part of envoyproxy#113

* rm implementation for image.multiarch, which needs work

* rm Makefile.targets.mk and reuse tools/make/common.mk

* move top level targets to the right makefiles

* move `make help` strings closer to the target

```
Envoy Gateway is an open source project for managing Envoy Proxy as a standalone or Kubernetes-based application gateway

Usage: make <Targets> <Options> ...

Targets:

Usage:
  make <target>

Golang
  build            Build envoy-gateway for host platform. See Option PLATFORM and BINS.
  test             Run all Go test of code sources.
  format           Format codes style with mod tidy, gofmt and goimports.
  clean            Remove all files that are created during builds.

Image
  image            Build docker images for host platform. See Option PLATFORM and BINS.
  push             Push docker images to registry.

Lint
  lint             Run all linter of code sources, including golint, yamllint and codespell.

Kubernetes Development
  manifests        Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
  generate         Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
  kube-test        Run Kubernetes provider tests.

Kubernetes Deployment
  kube-install     Install CRDs into the Kubernetes cluster specified in ~/.kube/config.
  kube-uninstall   Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

Kubernetes Build Dependencies
  kustomize        Download kustomize locally if necessary.
  controller-gen   Download controller-gen locally if necessary.
  envtest          Download envtest-setup locally if necessary.

Options:
  BINS         The binaries to build. Default is all of cmd.
               This option is available when using: make build/build.multiarch
               Example: make build BINS="envoy-gateway"
  IMAGES       Backend images to make. Default is all of cmds.
               This option is available when using: make image/image.multiarch/push/push.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway"
  PLATFORM     The specified platform to build.
               This option is available when using: make build/image
               Example: make build BINS="envoy-gateway" PLATFORM="linux_amd64"
               Supported Platforms: linux_amd64 linux_arm64 darwin_amd64 darwin_arm64
  PLATFORMS    The multiple platforms to build.
               This option is available when using: make build.multiarch
               Example: make image.multiarch IMAGES="envoy-gateway" PLATFORMS="linux_amd64 linux_arm64"
               Default is "linux_amd64 linux_arm64 darwin_amd64 darwin_arm64".
```

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
@arkodg arkodg requested a review from a team as a code owner June 30, 2022 19:58
Comment thread tools/make/golang.mk
.PHONY: go.build
go.build: $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS)))
go.build:
@$(MAKE) $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS)))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the point of this change? In the other places that do $(MAKE) like this, I'd have made the reverse change.

(See also: Peter Miller's famous "Recursive Make Considered Harmful" article)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@LukeShu thanks for the review, I added that extra make because I was unable to work around it, here's the error

diff --git a/tools/make/golang.mk b/tools/make/golang.mk
index 7600d0a..9c7f1c3 100644
--- a/tools/make/golang.mk
+++ b/tools/make/golang.mk
@@ -22,8 +22,7 @@ go.build.%:
 
 # Build the envoy-gateway binaries in the hosted platforms.
 .PHONY: go.build
-go.build:
-       @$(MAKE) $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS)))
+go.build: $(addprefix go.build., $(addprefix $(PLATFORM)., $(BINS)))
 
 # Build the envoy-gateway binaries in multi platforms
 # It will build the linux/amd64, linux/arm64, darwin/amd64, darwin/arm64 binaries out.
🐳 ~/go-workspace/src/github.com/envoyproxy/gateway$ make build
make[3]: Nothing to be done for `go.build'.

hopefully some make magician can help iron this out, but for the time being shouldnt affect correctness

Copy link
Copy Markdown
Contributor

@LukeShu LukeShu left a comment

Choose a reason for hiding this comment

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

I don't like that this is leaning even harder in to recursive Make rather than just using dependencies.

But to the degree that this is copy/pasting the code around (either within the repo, or out of the old Makefile.targets.mk), lgtm.

@arkodg arkodg merged commit def1c20 into envoyproxy:main Jun 30, 2022
@arkodg arkodg deleted the kube-makefile branch June 30, 2022 22:44
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