This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export TF_VAR_DO_TOKEN=insert_your_token_here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| node=${1} | |
| if [ -n "${node}" ]; then | |
| shift | |
| nodeName=$(kubectl get node ${node} -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}') || exit 1 | |
| nodeSelector='"nodeSelector": { "kubernetes.io/hostname": "'${nodeName:?}'" },' | |
| podName=${USER+${USER}-}sudo-${node} | |
| else | |
| nodeSelector="" | |
| podName=${USER+${USER}-}sudo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax = "proto3"; | |
| service PingService { | |
| rpc Ping (PingRequest) returns (PingResponse); | |
| } | |
| message PingRequest { | |
| string data = 1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "log" | |
| "os" | |
| "time" | |
| pb "github.com/kainlite/grpc-ping/ping" | |
| "google.golang.org/grpc" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "log" | |
| "net" | |
| pb "github.com/kainlite/grpc-ping/ping" | |
| "google.golang.org/grpc" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protoc -I ping/ ping/ping.proto --go_out=plugins=grpc:ping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ ping localhost -c 4 | |
| PING localhost(localhost (::1)) 56 data bytes | |
| 64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.145 ms | |
| 64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.152 ms | |
| 64 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.154 ms | |
| 64 bytes from localhost (::1): icmp_seq=4 ttl=64 time=0.141 ms | |
| --- localhost ping statistics --- | |
| 4 packets transmitted, 4 received, 0% packet loss, time 3144ms | |
| rtt min/avg/max/mdev = 0.141/0.148/0.154/0.005 ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ go run ping_client/main.go | |
| 2019/06/23 18:01:02 8 characters roundtrip to (localhost:50000): seq=0 time=1.941841ms | |
| 2019/06/23 18:01:03 8 characters roundtrip to (localhost:50000): seq=1 time=420.992µs | |
| 2019/06/23 18:01:04 8 characters roundtrip to (localhost:50000): seq=2 time=401.115µs | |
| 2019/06/23 18:01:05 8 characters roundtrip to (localhost:50000): seq=3 time=428.467µs | |
| 2019/06/23 18:01:06 8 characters roundtrip to (localhost:50000): seq=4 time=374.057µs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ go run ping_server/main.go | |
| 2019/06/23 18:01:02 Received: 00 | |
| 2019/06/23 18:01:03 Received: 00 | |
| 2019/06/23 18:01:04 Received: 00 | |
| 2019/06/23 18:01:05 Received: 00 | |
| 2019/06/23 18:01:06 Received: 00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ├── account.json | |
| ├── LICENSE | |
| ├── main.tf | |
| ├── module | |
| │ ├── main.tf | |
| │ ├── outputs.tf | |
| │ └── variables.tf | |
| ├── README.md | |
| └── terraform.tfvars |