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

Building FortuneBuilder app #7301

Closed
darkn3rd opened this issue Jun 29, 2021 · 11 comments · Fixed by #7360
Closed

Building FortuneBuilder app #7301

darkn3rd opened this issue Jun 29, 2021 · 11 comments · Fixed by #7360
Assignees

Comments

@darkn3rd
Copy link

darkn3rd commented Jun 29, 2021

I need to test GRPC with ingress-nginx, as I will support mixed HTTP/1.1 and GRPC (HTTP/2) traffic through the ingress. The instructions document using this application to test the solution, but it requires Bazel build tools, which adds a layer of complexity and dependencies that are currently broken (as this area has not been refreshed). I understand that Bazel is the new shiny, but it would also be nice to have at least as an alternative, simple Makefile, and/or instructions to compile this go tools. Currently, going through a maze of dependencies as a first time Bazel user.

NGINX Ingress controller version: master branch, commit sha 4bdb5538a480552ef89472059cf357eaf17c362f
Kubernetes version (use kubectl version): 1.18
Environment:

  • Cloud provider or hardware configuration: Macbook Air
  • OS (e.g. from /etc/os-release):
    $ sw_vers
    ProductName:	Mac OS X
    ProductVersion:	10.15.2
    BuildVersion:	19C57
    
  • Kernel (e.g. uname -a):
    Darwin someuser-mba-laptop.local 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64
    
  • Install tools: Bazel 4.1.0-homebrew
  • Others:
    $ git rev-parse HEAD
    4bdb5538a480552ef89472059cf357eaf17c362f
    

What happened:

ERROR: /Users/someuser/area51/pub/ingress-nginx/images/grpc-fortune-teller/WORKSPACE:7:1: name 'git_repository' is not defined
ERROR: /Users/someuser/area51/pub/ingress-nginx/images/grpc-fortune-teller/WORKSPACE:13:1: name 'http_archive' is not defined
ERROR: error loading package '': Encountered error while reading extension file 'go/def.bzl': no such package '@io_bazel_rules_go//go': error loading package 'external': Could not load //external package
INFO: Elapsed time: 3.493s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

Bazel build fails in current master.

What you expected to happen:

That this would build per instructions.

How to reproduce it:

git clone [email protected]:kubernetes/ingress-nginx.git
cd ingress-nginx/images/grpc-fortune-teller
brew install  bazel
bazel build //app:fortune

/kind bug

@darkn3rd darkn3rd added the kind/bug Categorizes issue or PR as related to a bug. label Jun 29, 2021
@darkn3rd
Copy link
Author

I found that I need to add the following to WORKSPACE go forward with the

# NOTE: git_repository is no longer a native rule
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# NOTE: Starting with version 0.20.0, http_archive native rule has been deprecated
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

Now I am seeing other build errors:

DEBUG: Rule 'io_bazel_rules_go' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1522871513 -0400"
DEBUG: Repository io_bazel_rules_go instantiated at:
  /Users/someuser/area51/pub/ingress-nginx/images/grpc-fortune-teller/WORKSPACE:12:15: in <toplevel>
Repository rule git_repository defined at:
  /private/var/tmp/_bazel_joaquin/3ebc6728b9bdbb1bc5b3b9bce797be69/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in <toplevel>
ERROR: /private/var/tmp/_bazel_someuser/3ebc6728b9bdbb1bc5b3b9bce797be69/external/io_bazel_rules_go/go/private/common.bzl:53:15: name 'FileType' is not defined (did you mean 'go_filetype'?)
ERROR: /private/var/tmp/_bazel_someuser/3ebc6728b9bdbb1bc5b3b9bce797be69/external/io_bazel_rules_go/go/private/common.bzl:55:19: name 'FileType' is not defined (did you mean 'go_filetype'?)
ERROR: /private/var/tmp/_bazel_someuser/3ebc6728b9bdbb1bc5b3b9bce797be69/external/io_bazel_rules_go/go/private/common.bzl:59:16: name 'FileType' is not defined (did you mean 'go_filetype'?)
ERROR: error loading package '': in /private/var/tmp/_bazel_someuser/3ebc6728b9bdbb1bc5b3b9bce797be69/external/io_bazel_rules_go/go/def.bzl: in /private/var/tmp/_bazel_someuser/3ebc6728b9bdbb1bc5b3b9bce797be69/external/io_bazel_rules_go/go/private/context.bzl: Extension 'go/private/common.bzl' has errors
INFO: Elapsed time: 0.236s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
    Fetching @com_github_scele_rules_go_dep; fetching

@BenTheElder
Copy link
Member

From the README.md for this image currently https://github.com/kubernetes/ingress-nginx/blob/e98e3f3b9d43b3a81a4e0c7b91204d5550d74449/images/grpc-fortune-teller/README.md:

This is the grpc server application for the nginx-ingress grpc example. Bazel 0.12 is used for the building and container management.

I would guess Bazel 0.12 is substantially older than what you have installed, stable bazel is v4.1.0 now.

It's worth noting that this entire directory has a a few commits and hasn't really been actively developed https://github.com/kubernetes/ingress-nginx/commits/master/images/grpc-fortune-teller

Seeing as this image is the only thing in the repo that appears to use bazel, I imagine they'd accept a PR reworking it.

This repo is in need of more help, IMO #4404 https://github.com/kubernetes/ingress-nginx/graphs/contributors?from=2021-01-02&to=2021-06-30&type=c, so if you want this I'd guess take a stab at it.

NOTE: not a maintainer here 🙃

@darkn3rd
Copy link
Author

darkn3rd commented Jul 2, 2021

Bazel 0.12 seems analogous to using NCSA Mosaic when there is Firefox, as so much has change. I doubt still the dependencies, which pulls stuff externally, would work. Perhaps when I gain more Bazel experience, I could take a stab at this, but currently this is beyond my ken. I was looking to test out the GRPC feature with a demo application, so I thought I would try to compile this, but well, ahem, I was not able to do that. Currently, I am using other demo grpc programs to try out for experimenting with this feature.

@tao12345666333
Copy link
Member

This example really hasn't been updated for a long time.

As @BenTheElder mentioned, we are now spending more time on this project and need more help.

so if you want this I'd guess take a stab at it.

@BenTheElder I know you have a lot of experience with Bazel, do you have time to help fix it? ❤️

@BenTheElder
Copy link
Member

BenTheElder commented Jul 2, 2021

I don't think bazel experience is necessary here, it's just go + grpc and can be adapted to the rest of the repo.

Someone should rewrite the whole app probably?, it's also still using gopkg.lock ...

I don't have a need for this myself, just trying to point out that to build it you probably need to use the tooling in the readme, or replace the build yourself (given nobody was working on this to begin with and the whole repo is currently somewhat understaffed)

@tao12345666333
Copy link
Member

Thanks! You're right.

My previous idea was based on the upgrade build tool (Bazel), so I think this may require Bazel related experience. (Sorry to trouble you)

I just read the code of this app, it seems that it is just a sample program, and there is no strong dependency.
So it’s okay to update the build tool or rewrite it.

@darkn3rd Because this has nothing to do with the ingress-nginx itself, I will remove the bug label.

/remove-kind bug
/help

@k8s-ci-robot k8s-ci-robot added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed kind/bug Categorizes issue or PR as related to a bug. labels Jul 2, 2021
@BenTheElder
Copy link
Member

Yeah, I think it makes far more sense to throw out the existing build logic unless someone just needs to build it immediately, other than go build this should just need //go:embed and the protobuf codegen.

If you just need to build it now I'd try something like bazelisk + using the old version mentioned. It's apparent this sample is using extremely outdated tooling, I'm not sure if it makes sense to invest in at all vs pointing to some external sample apps ...?

@longwuyuan
Copy link
Contributor

/remove help-wanted

@longwuyuan
Copy link
Contributor

/remove-help

@k8s-ci-robot k8s-ci-robot removed the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Jul 8, 2021
@longwuyuan
Copy link
Contributor

/assign

@longwuyuan
Copy link
Contributor

/area docs

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