Skip to content

Commit

Permalink
Drop json rpc gateway support (#583)
Browse files Browse the repository at this point in the history
## Description

Drop all code dealing with json rpc.

## Why is this needed

Its likely unused code which has some weird code (:eye: runtime.String) that make other PRs more tedious (#567, also I want to drop the self-signed `/cert` stuff too) to implement.

## How Has This Been Tested?

`go build` and CI.

## How are existing users impacted? What migration steps/scripts do we need?

No impact I suspect (and hope). I know of 3 other tink clients and they all use grpc:
 - https://github.com/swills/py-tink-cli
 - https://github.com/micahhausler/tink/tree/feature/k8s-mode/cmd/virtual-worker
 - an Equinix Metal internal service
  • Loading branch information
mergify[bot] authored Feb 10, 2022
2 parents f704d1c + 740cfec commit fc76c03
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 2,672 deletions.
7 changes: 5 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
has nix && use nix
dotenv_if_exists
PATH_add bin
path_add GOBIN bin

export TINKERBELL_GRPC_AUTHORITY=127.0.0.1:42113
export TINKERBELL_CERT_URL=http://127.0.0.1:42114/cert

which nix &>/dev/null && use nix && unset GOPATH
3 changes: 0 additions & 3 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ plugins:
opt:
- paths=source_relative
- require_unimplemented_servers=false
- name: grpc-gateway
out: .
opt: paths=source_relative
37 changes: 13 additions & 24 deletions cmd/tink-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ var version = "devel"
// DaemonConfig represents all the values you can configure as part of the tink-server.
// You can change the configuration via environment variable, or file, or command flags.
type DaemonConfig struct {
Facility string
PGDatabase string
PGUSer string
PGPassword string
PGSSLMode string
OnlyMigration bool
GRPCAuthority string
TLSCert string
CertDir string
HTTPAuthority string
HTTPBasicAuthUsername string
HTTPBasicAuthPassword string
Facility string
PGDatabase string
PGUSer string
PGPassword string
PGSSLMode string
OnlyMigration bool
GRPCAuthority string
TLSCert string
CertDir string
HTTPAuthority string
}

func (c *DaemonConfig) AddFlags(fs *pflag.FlagSet) {
Expand Down Expand Up @@ -87,12 +85,6 @@ func (c *DaemonConfig) PopulateFromLegacyEnvVar() {
if httpAuthority := os.Getenv("TINKERBELL_HTTP_AUTHORITY"); httpAuthority != "" {
c.HTTPAuthority = httpAuthority
}
if basicAuthUser := os.Getenv("TINK_AUTH_USERNAME"); basicAuthUser != "" {
c.HTTPBasicAuthUsername = basicAuthUser
}
if basicAuthPass := os.Getenv("TINK_AUTH_PASSWORD"); basicAuthPass != "" {
c.HTTPBasicAuthPassword = basicAuthPass
}
}

func main() {
Expand Down Expand Up @@ -188,12 +180,9 @@ func NewRootCommand(config *DaemonConfig, logger log.Logger) *cobra.Command {
}, errCh)

httpServer.SetupHTTP(ctx, logger, &httpServer.Config{
CertPEM: cert,
ModTime: modT,
GRPCAuthority: config.GRPCAuthority,
HTTPAuthority: config.HTTPAuthority,
HTTPBasicAuthUsername: config.HTTPBasicAuthUsername,
HTTPBasicAuthPassword: config.HTTPBasicAuthPassword,
CertPEM: cert,
ModTime: modT,
HTTPAuthority: config.HTTPAuthority,
}, errCh)

select {
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ services:
PGUSER: tinkerbell
TINKERBELL_GRPC_AUTHORITY: :42113
TINKERBELL_HTTP_AUTHORITY: :42114
TINK_AUTH_USERNAME: ${TINKERBELL_TINK_USERNAME}
TINK_AUTH_PASSWORD: ${TINKERBELL_TINK_PASSWORD}
depends_on:
tink-server-migration:
condition: service_started
Expand Down Expand Up @@ -64,8 +62,6 @@ services:
PGUSER: tinkerbell
TINKERBELL_GRPC_AUTHORITY: :42113
TINKERBELL_HTTP_AUTHORITY: :42114
TINK_AUTH_USERNAME: ${TINKERBELL_TINK_USERNAME}
TINK_AUTH_PASSWORD: ${TINKERBELL_TINK_PASSWORD}
depends_on:
db:
condition: service_healthy
Expand Down
2 changes: 0 additions & 2 deletions docs/ENVVARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ The follow describes environment variables available to be set when running Tink

| Name | Type | Service(s) | Description |
| ---------------------------------------------------------------------------------------------- | ------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `TINK_AUTH_USERNAME=tink` | string | server | username to use for basic auth to http endpoints |
| `TINK_AUTH_PASSWORD=tink` | string | server | password to use for basic auth to http endpoints |
| `TINKERBELL_CERT_URL=http://127.0.0.1:42114/cert` | string | cli/worker | url from which to get a TLS certificate, needed when Tink Server's TLS cert is signed by an unknown certificate authority, ie self-signed |
| `CERTS_DIR=/certs` | string | server | a directory which contains the `bundle.pem` and `server-key.pem` files, for use when running Tink with TLS |
| `TINKERBELL_CERTS_DIR=/certs` | string | server | same as `CERTS_DIR`, deprecated in server |
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/google/uuid v1.3.0
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/jedib0t/go-pretty v4.3.0+incompatible
github.com/ktr0731/evans v0.10.0
github.com/lib/pq v1.10.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASx
github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
Expand Down Expand Up @@ -573,7 +572,6 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down
Loading

0 comments on commit fc76c03

Please sign in to comment.