Skip to content

Commit

Permalink
Introduce improvements requested in review
Browse files Browse the repository at this point in the history
  • Loading branch information
pkosiec committed Feb 25, 2022
1 parent 0f3c7b2 commit 397b49f
Show file tree
Hide file tree
Showing 12 changed files with 597 additions and 522 deletions.
11 changes: 5 additions & 6 deletions cmd/secret-storage-backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

Secret Storage Backend is a service which handles multiple secret storages for TypeInstances.

This service is implemented according to the [Delegated Storage](../../docs/proposal/20211207-delegated-storage.md) concept.

## Prerequisites

- [Go](https://golang.org)
- (Optional - if AWS Secrets Manager provider should be used) an AWS account with **AdministratorAccess** permissions on it

## Usage

Expand All @@ -29,7 +28,7 @@ By default, the Secret Storage Backend has the `aws_secretsmanager` provider ena
APP_LOGGER_DEV_MODE=true go run ./cmd/secret-storage-backend/main.go
```

The server will listen to gRPC calls according to the [Storage Backend Protocol Buffers schema](../../pkg/hub/api/grpc/storage_backend.proto).
The server listens to gRPC calls according to the [Storage Backend Protocol Buffers schema](../../pkg/hub/api/grpc/storage_backend.proto).
To perform such calls, you can use e.g. [Insomnia](https://insomnia.rest/) tool.

### Dotenv provider
Expand All @@ -46,10 +45,10 @@ To run the server with `dotenv` provider enabled, which stores data in files, ex

| Name | Required | Default | Description |
|-------------------------|----------|----------------------|-------------------------------------------------------------------------------------------------------------------------------|
| APP_GRPC_ADDR | no | `:50051` | TCP address the gRPC server binds to |
| APP_HEALTHZ_ADDR | no | `:8082` | TCP address the health probes endpoint binds to |
| APP_GRPC_ADDR | no | `:50051` | TCP address the gRPC server binds to. |
| APP_HEALTHZ_ADDR | no | `:8082` | TCP address the health probes endpoint binds to. |
| APP_SUPPORTED_PROVIDERS | no | `aws_secretsmanager` | Supported secret providers separated by `,`. A given provider must be passed in additional parameters of gRPC request inputs. |
| APP_LOGGER_DEV_MODE | no | `false` | Enable development mode logging |
| APP_LOGGER_DEV_MODE | no | `false` | Enable development mode logging. |

To configure providers, use environmental variables described in the [Providers](https://github.com/SpectralOps/teller#providers) paragraph for Teller's Readme.
Expand Down
3 changes: 2 additions & 1 deletion cmd/secret-storage-backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import (

// Config holds application related configuration.
type Config struct {
// Address is the TCP address the gRPC server binds to.
// GRPCAddr is the TCP address the gRPC server binds to.
GRPCAddr string `envconfig:"default=:50051"`

// HealthzAddr is the TCP address the health probes endpoint binds to.
HealthzAddr string `envconfig:"default=:8082"`

// SupportedProviders holds enabled secret providers separated by comma.
SupportedProviders []string `envconfig:"default=aws_secretsmanager"`

Logger logger.Config
Expand Down
24 changes: 12 additions & 12 deletions docs/proposal/20211207-delegated-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,16 @@ Also, the additional, nice-to-have goals are:
```proto
message TypeInstanceData {
string id = 1;
google.protobuf.Any value = 2;
bytes value = 2;
}
message OnCreateRequest {
TypeInstanceData typeinstance = 1;
google.protobuf.Any additional_parameters = 2;
bytes context = 2;
}
message OnCreateResponse {
google.protobuf.Any additional_parameters = 1;
optional bytes context = 1;
}
service SearchService {
Expand Down Expand Up @@ -483,11 +483,11 @@ Capact Local Hub calls proper storage backend service while accessing the TypeIn
message OnCreateRequest {
string typeinstance_id = 1;
bytes value = 2;
bytes additional_parameters = 3;
bytes context = 3;
}
message OnCreateResponse {
optional bytes additional_parameters = 1;
optional bytes context = 1;
}
message TypeInstanceResourceVersion {
Expand All @@ -499,24 +499,24 @@ Capact Local Hub calls proper storage backend service while accessing the TypeIn
string typeinstance_id = 1;
uint32 new_resource_version = 2;
bytes new_value = 3;
optional bytes additional_parameters = 4;
optional bytes context = 4;
}
message OnUpdateResponse {
optional bytes additional_parameters = 1;
optional bytes context = 1;
}
message OnDeleteRequest {
string typeinstance_id = 1;
bytes additional_parameters = 2;
bytes context = 2;
}
message OnDeleteResponse {}
message GetValueRequest {
string typeinstance_id = 1;
uint32 resource_version = 2;
bytes additional_parameters = 3;
bytes context = 3;
}
message GetValueResponse {
Expand All @@ -528,7 +528,7 @@ Capact Local Hub calls proper storage backend service while accessing the TypeIn
message GetLockedByRequest {
string typeinstance_id = 1;
bytes additional_parameters = 2;
bytes context = 2;
}
message GetLockedByResponse {
Expand All @@ -537,15 +537,15 @@ Capact Local Hub calls proper storage backend service while accessing the TypeIn
message OnLockRequest {
string typeinstance_id = 1;
bytes additional_parameters = 2;
bytes context = 2;
string locked_by = 3;
}
message OnLockResponse {}
message OnUnlockRequest {
string typeinstance_id = 1;
bytes additional_parameters = 2;
bytes context = 2;
}
message OnUnlockResponse {}
Expand Down
1 change: 0 additions & 1 deletion hack/gen-graphql-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ host::install::gqlgen() {

pushd "$TMP_DIR" >/dev/null

go mod init tmp
go install "github.com/99designs/gqlgen@${STABLE_GQLGEN_VERSION}"

popd >/dev/null
Expand Down
5 changes: 3 additions & 2 deletions hack/gen-grpc-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ host::install::protoc() {
shout "Install the protoc ${STABLE_PROTOC_VERSION} locally to a tempdir..."
mkdir -p "${TMP_DIR}/bin"

export PATH="${TMP_DIR}/bin:${PATH}"
export GOBIN="${TMP_DIR}/bin"
export PATH="${GOBIN}:${PATH}"

pushd "$TMP_DIR" >/dev/null

os=$(host::os)
Expand All @@ -65,7 +67,6 @@ host::install::protoc() {
# extract the archive
unzip "${name}".zip

go mod init tmp
go install "google.golang.org/protobuf/cmd/protoc-gen-go@${STABLE_PROTOC_GEN_GO_VERSION}"
go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@${STABLE_PROTOC_GEN_GO_GRPC_VERSION}"

Expand Down
1 change: 0 additions & 1 deletion hack/gen-k8s-resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ host::install::controller-gen() {

pushd "$TMP_DIR" >/dev/null

go mod init tmp
go install sigs.k8s.io/controller-tools/cmd/controller-gen@$STABLE_CONTROLLER_GEN_VERSION

popd >/dev/null
Expand Down
Loading

0 comments on commit 397b49f

Please sign in to comment.