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

Adding WebSocket Go example #6109

Merged
merged 1 commit into from
Sep 10, 2024
Merged

Conversation

matzew
Copy link
Member

@matzew matzew commented Sep 10, 2024

As per title

@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 10, 2024
Copy link

netlify bot commented Sep 10, 2024

Deploy Preview for knative ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit d5e6911
🔍 Latest deploy log https://app.netlify.com/sites/knative/deploys/66e02903e7b97700080807f8
😎 Deploy Preview https://deploy-preview-6109--knative.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@matzew matzew force-pushed the websocket_sample_go branch 3 times, most recently from b9cde4e to b6d1241 Compare September 10, 2024 11:07
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
template:
spec:
containers:
- image: ko://github.com/knative/docs/code-samples/serving/websockets-go/cmd/server
Copy link
Contributor

@skonto skonto Sep 10, 2024

Choose a reason for hiding this comment

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

The other samples have docker.io/{username}/grpc-ping-go, so let's keep consistency.

Copy link
Member Author

Choose a reason for hiding this comment

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

But than the ko does not work. (also the docker buildx does not directly work for me w/ podman, b/c of the --push. that's why I want to keep it.

Copy link
Contributor

@skonto skonto Sep 10, 2024

Choose a reason for hiding this comment

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

I suggest we remove that part for now, we don't use ko in the other examples. I am not saying we should or not use it, just suggesting that we keep things as is for now. Updating the samples with a different build approach is the topic for another PR.

Copy link
Contributor

@skonto skonto Sep 10, 2024

Choose a reason for hiding this comment

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

In the past we added buildx and since it touches many files any other addition should be more visible and get proper reviews. On top of that, if something does not work we can open another issue and fix it (migrate to ko etc).
Btw I am in favor of adding more options as suggested here #5273 (comment).

Copy link
Contributor

@skonto skonto Sep 10, 2024

Choose a reason for hiding this comment

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

@rhuss @pierDipi wdyth? Any objections to stamp?

# This is based on Debian and sets the GOPATH to /go.
FROM golang:latest as builder

ARG TARGETOS
Copy link
Contributor

@skonto skonto Sep 10, 2024

Choose a reason for hiding this comment

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

Tested locally works as expected:

$ wscat --connect 127.0.0.1:8080/ws
Connected (press CTRL+C to quit)
> hello
< hello
> hi
< hi
> 

Copy link
Contributor

@skonto skonto Sep 10, 2024

Choose a reason for hiding this comment

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

To be consistent with the other samples eg. grpc we need to add a section for running with docker, something like in the example for grpc

docker run --rm {username}/grpc-ping-go \
  /client \
  -server_addr="grpc-ping.default.1.2.3.4.sslip.io:80" \
  -insecure

Copy link
Member Author

Choose a reason for hiding this comment

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

never done that before. I mostly do never use docker, I just run things w/ ko

feel free to add things to this post.

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand but the docs have a common pattern to follow for now see my comment above about ko.

Copy link
Member Author

Choose a reason for hiding this comment

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

@skonto

docker run --rm docker.io/matzew/ws-goss \      
  /server \                                                 
  -server_addr="websockets-go.default.1.2.3.4.sslip.io:80" \
  -insecure

I am not getting this to work, please feel free to add the correct content. Otherwise we merge this and deal with this later?

The section above shows how to the binary w/in kube already. Not really adding too much value

Copy link
Member Author

Choose a reason for hiding this comment

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

I could do go run cmd/server/main.go ...

and localhost - that is simple enought - and has similar value

Copy link
Contributor

Choose a reason for hiding this comment

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

It is ok let's fix this in #6110

@skonto
Copy link
Contributor

skonto commented Sep 10, 2024

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 10, 2024
Copy link

knative-prow bot commented Sep 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: matzew, skonto

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

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 10, 2024
@knative-prow knative-prow bot merged commit 6735c3f into knative:main Sep 10, 2024
23 checks passed
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. lgtm 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.

2 participants