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

Documentation: grpc example #2307

Merged
merged 2 commits into from
May 10, 2018
Merged

Conversation

pcj
Copy link
Contributor

@pcj pcj commented Apr 8, 2018

Closes #2284

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please email the CNCF helpdesk: [email protected]

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 8, 2018
@pcj
Copy link
Contributor Author

pcj commented Apr 8, 2018

/assign @aledbf

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 8, 2018
@aledbf
Copy link
Member

aledbf commented Apr 8, 2018

@pcj thank you for this example. Please check the headers of the .go files to pass the validations.

About the PR:

  1. Please remove the installation steps (and k8s manifest). Just assume the cluster is up and running with the ingress controller installed. We already tried this approach before and is really hard to maintain
  2. You are adding too many requirements for the example. For instance I would prefer to build and host the docker image in quay.io with the ingress-nginx image and not require the use of gcloud registry
  3. Same comment for the dns requirement. You are adding too many references to gcloud and some user can think this only works in that cloud provider.
  4. I like the use of bazel but again most of the user just need grpcurl to test this. Can you just use that?

@pcj
Copy link
Contributor Author

pcj commented Apr 8, 2018

thanks @aledbf I'll fix up the go headers. So that I understand you correctly:

  1. Remove the nginx-ingress/* directory completely, replacing it with a paragraph in the README.md to "install nginx-ingress in standard fashion";

  2. Remove references to gcloud, replacing them with statements like "have persistent disk allocated", or something like that.

  3. Remove dns instructions, replacing it with again a paragraph to the effect "have a DNS pointing to your ingress controller".

  4. Remove all the bazel stuff, including the build steps for all the images, and all the clients. Also remove the fortune-teller application (?), replacing with an paragraph like "get your gRPC application up and running..".

What about the kube-cert-manager?

Anyway, I guess I should have asked this already, but what is your vision of the files necessary to have a functioning gRPC example? The one I have provided is pretty complete. So, what is the best combination of maintainability but still approachable? An example with multiple magical leaps within it will be pretty frustrating for people wanting to try it out.

Thanks for the prompt review! I'll try to keep to the same standard but I have to steal time away from other commitments, but I'll do my best.

@aledbf
Copy link
Member

aledbf commented Apr 8, 2018

Remove the nginx-ingress/* directory completely, replacing it with a paragraph in the README.md to "install nginx-ingress in standard fashion";

Yes

Remove references to gcloud, replacing them with statements like "have persistent disk allocated", or something like that.

Remove dns instructions, replacing it with again a paragraph to the effect "have a DNS pointing to your ingress controller".

Yes

Remove all the bazel stuff, including the build steps for all the images, and all the clients. Also remove the fortune-teller application (?), replacing with an paragraph like "get your gRPC application up and running..".

No. Just use grpcurl to show the example working. We can publish your image in quay.io so the user doesn't need to build a custom one and have a reference to your code to see how to build a gRPC app

What about the kube-cert-manager?
Anyway, I guess I should have asked this already, but what is your vision of the files necessary to have a functioning gRPC example? The one I have provided is pretty complete.

Agree. Your example is self-contained which I like but you assume too much about the environment where the cluster is running.

So, what is the best combination of maintainability but still approachable? An example with multiple magical leaps within it will be pretty frustrating for people wanting to try it out.

Agree. That is why I just said you should use the default user guide and avoid using too many references to a particular cloud provider. Keep in mind this must work OOTB with minikube too.

@aledbf
Copy link
Member

aledbf commented Apr 25, 2018

@pcj ping

@pcj
Copy link
Contributor Author

pcj commented Apr 25, 2018

Hi @aledbf sorry for delay, have not lost interest here... traveling now but I think I can get this taken care of by Friday or Saturday.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 1, 2018
@pcj
Copy link
Contributor Author

pcj commented May 1, 2018

@aledbf Apologies for delay. Example is now just a README.md and a few yaml files. I moved implementation of the grpc service to a separate repo and pushed that to a container registry.

@codecov-io
Copy link

codecov-io commented May 1, 2018

Codecov Report

Merging #2307 into master will decrease coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2307      +/-   ##
==========================================
- Coverage   41.75%   41.61%   -0.14%     
==========================================
  Files          74       74              
  Lines        5291     5291              
==========================================
- Hits         2209     2202       -7     
- Misses       2786     2792       +6     
- Partials      296      297       +1
Impacted Files Coverage Δ
cmd/nginx/main.go 21.37% <0%> (-4.83%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87d1b8b...326a274. Read the comment docs.

metadata:
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/ssl-redirect: "true"
Copy link
Member

Choose a reason for hiding this comment

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

nginx prefix missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

name: fortune-teller.stack.build
namespace: default
labels:
stable.k8s.psg.io/kcm.class: "kube-cert-manager"
Copy link
Member

Choose a reason for hiding this comment

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

is this label required?

@aledbf
Copy link
Member

aledbf commented May 1, 2018

@pcj just two comments. Also please squash the commits and we are ready to merge

@aledbf
Copy link
Member

aledbf commented May 1, 2018

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 1, 2018
@pcj
Copy link
Contributor Author

pcj commented May 2, 2018

OK, comments addressed & fixed, squashed into single commit and force pushed. Should be ready for merge. Thx.


### Step 2: the kubernetes `Service`

```yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a link to the corresponding YAML files would be better than copying their content directly here?
Or the other way around, keep the content of the manifests in the markdown but delete the files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure I can delete the redundant content. I prefer the readability of the yaml in the markdown but could be convinced otherwise. Unless another feels strongly, I'll just delete the yaml files.

Copy link
Member

@ElvinEfendi ElvinEfendi May 2, 2018

Choose a reason for hiding this comment

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

I like the style in other docs where we provide complete kubectl command:

cat docs/examples/grpc/svc.yaml | kubectl apply --namespace=fortune-teller-app -f -

Instead of relative path docs/examples/grpc/svc.yaml we could also use remote path - I don't have any preference there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ElvinEfendi done.

spec:
containers:
- name: fortune-teller-app
image: container.stack.build/pcj/fortune-teller:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we host this in the repo together with echoserver and other tools @aledbf?

Copy link
Member

Choose a reason for hiding this comment

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

That makes sense

Copy link
Contributor Author

@pcj pcj May 2, 2018

Choose a reason for hiding this comment

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

I was planning on putting this in quay.io, but it seems they still don't support docker registry v2.2 so I decided against it (ref bazelbuild/rules_docker#102 gentle ping @philips).

E0502 07:46:27.210516   20444 docker_session_.py:335] Error during upload of: quay.io/pcj/fortune-teller:latest
F0502 07:46:27.210813   20444 fast_pusher_.py:162] Error publishing quay.io/pcj/fortune-teller:latest: response: {'status': '415', 'content-length': '131', 'server': 'nginx/1.13.6', 'connection': 'keep-alive', 'date': 'Wed, 02 May 2018 13:46:27 GMT', 'content-type': 'application/json'}
manifest invalid: {u'message': u'manifest schema version not supported'}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aledbf Is hosting this image as @antoineco suggests part of this PR?

Copy link
Member

Choose a reason for hiding this comment

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

Yes please

Copy link
Contributor Author

@pcj pcj May 2, 2018

Choose a reason for hiding this comment

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

Sorry for the chatter here but I'm unclear on the requirements. Can I just mkdir images/grpc-fortune-teller, copy the existing code from https://github.com/stackb/grpc-fortune-teller and call it good, or do the images there need to work within some larger build workflow?

Copy link
Member

Choose a reason for hiding this comment

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

Can I just mkdir images/grpc-fortune-teller

Yes. After merging the PR I will publish the image in the same place than the ingress image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What will the anticipated image name be? (for the app.yaml image name). Something under quay.io, gcr.io/google_containers, or elsewhere?

Copy link
Member

Choose a reason for hiding this comment

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

quay.io/kubernetes-ingress-controller/grpc-fortune-teller:0.1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@pcj pcj force-pushed the grpc-example branch 2 times, most recently from 075aaa5 to 710127c Compare May 3, 2018 03:05
@k8s-ci-robot k8s-ci-robot removed the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 3, 2018
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 3, 2018
@pcj
Copy link
Contributor Author

pcj commented May 3, 2018

OK, I've added the grpc-fortune-teller under images/, updated image references to quay.io/kubernetes-ingress-controller/grpc-fortune-teller:0.1.

@aledbf, assuming you have bazel installed, you should be able to just type $ bazel run //app:push to push the image if your quay.io credentials are stored in ~/.docker/config.json (docker login). However, since quay.io does not support v2.2, it will likely fail with 'manifest version not supported'. In this case you'll just have to bazel run //app:image, re-tag the image and push it manually via docker push.

@pcj
Copy link
Contributor Author

pcj commented May 3, 2018

Unclear on why travis failed.

@antoineco
Copy link
Contributor

My general feeling is that we could definitely use a simpler example for demonstrating the use of gRPC. Fileutil.go and Bazel especially make me feel like we're showcasing a full-fledged Go project.

Regarding the content of the PR itself:
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 3, 2018
@aledbf
Copy link
Member

aledbf commented May 3, 2018

@pcj you need to add boilerplate code (license) to one or more files. Please execute ./hack/verify-boilerplate.sh to see where's the issue

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 3, 2018
@pcj
Copy link
Contributor Author

pcj commented May 3, 2018

Done. Boilerplate added to *.go files and refactored fileutil away.

pcj added 2 commits May 3, 2018 20:39
Deps are managed by bazel so these will fail to
show up in the vendor tree, triggering false positive build fail.
@aledbf
Copy link
Member

aledbf commented May 10, 2018

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aledbf, antoineco, pcj

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:

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 c80365d into kubernetes:master May 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants