Skip to content

Commit

Permalink
Renames. (#6)
Browse files Browse the repository at this point in the history
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka authored Jan 5, 2021
1 parent a4ad967 commit 074b35a
Show file tree
Hide file tree
Showing 37 changed files with 907 additions and 983 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Linting & vetting.
env:
GOBIN: /tmp/.bin
run: cd golang && make lint
run: cd go && make lint
tests:
runs-on: ${{ matrix.platform }}
strategy:
Expand All @@ -55,4 +55,4 @@ jobs:
- name: Run unit tests.
env:
GOBIN: /tmp/.bin
run: cd golang && make test
run: cd go && make test
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ lint: $(BUF) docs
@echo ">> lint proto files"
@$(BUF) check lint
$(call require_clean_work_tree,"detected changed files - run make lint and commit changes.")
@echo ">> lint golang files"
@$(MAKE) -C golang lint
@echo ">> lint go files"
@$(MAKE) -C go lint
$(call require_clean_work_tree,"detected changed files - run make lint and commit changes.")

.PHONY: proto
proto:
@$(MAKE) -C ./golang proto
@$(MAKE) -C ./go proto
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# OpenConfig 1.0
# ProtoConfig 1.0

[![golang docs](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/thanos-io/OpenConfig/golang) [![Latest Release](https://img.shields.io/github/release/thanos-io/OpenConfig.svg?style=flat-square)](https://github.com/thanos-io/OpenConfig/releases/latest)
[![golang docs](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/protoconfig/protoconfig/go) [![Latest Release](https://img.shields.io/github/release/protoconfig/protoconfig.svg?style=flat-square)](https://github.com/protoconfig/protoconfig/releases/latest)

The `OpenConfig 1.0` is a specification that describes a process of using, defining, and consuming software configuration input in a unified way.
The `ProtoConfig 1.0` is a specification that describes a process of using, defining, and consuming software configuration input in a unified way.

*Like gRPC or OpenAPI but for Application (static or dynamic) Configuration.*

### TL;DR

The `OpenConfig 1.0` standardises application configuration, by describing the process as follows:
The `ProtoConfig 1.0` standardises application configuration, by describing the process as follows:

1. Application developer creates a [.proto](https://developers.google.com/protocol-buffers) file with `Configuration Proto Definition`, that defines what exactly options application has.
2. Thanks to the single source of truth for your app configuration, a developer can generate a data structure in the language they need. Such structs/classes can be then used to parse incoming input in native proto or JSON encoding (for example from `stdin`, CLI flag or HTTP API, etc).
* `OpenConfig` allows generation extensibility, so such definition can be also used to generate documentation, `--help`, `man`, custom types, or even whole CLI flag & args parsing code. Options are unlimited!
3. Following the `OpenConfig` convention, a human or program can now configure the application either by specifying JSON manually or by generating (again) data structure from `Configuration Proto Definition` in the programming language they want. Such struct/class is typed (if a language is typed), have a valid format, have help commentaries and can be encoded to `protobuf` supported format and passed to the `configurable` application!
* `ProtoConfig` allows generation extensibility, so such definition can be also used to generate documentation, `--help`, `man`, custom types, or even whole CLI flag & args parsing code. Options are unlimited!
3. Following the `ProtoConfig` convention, a human or program can now configure the application either by specifying JSON manually or by generating (again) data structure from `Configuration Proto Definition` in the programming language they want. Such struct/class is typed (if a language is typed), have a valid format, have help commentaries and can be encoded to `protobuf` supported format and passed to the `configurable` application!

`OpenConfig 1.0` standard specifies that every `OpenConfig 1.0` compatible application accepts encoded `protobuf` in proto or JSON format as the way of configuring itself. Either as the only way or in addition to other conventions (e.g args and flags).
`ProtoConfig 1.0` standard specifies that every `ProtoConfig 1.0` compatible application accepts encoded `protobuf` in proto or JSON format as the way of configuring itself. Either as the only way or in addition to other conventions (e.g args and flags).

![Open Config 1.0](https://docs.google.com/drawings/d/e/2PACX-1vSANZkljSiDgV-o0a-dL0ryZz19p3Hblt5V_qozhBcY5ILq8j3T2GEAdCCHFHoSGT9h2H4LDqJ9bCn_/pub?w=1440&h=1080)

Expand All @@ -27,7 +27,7 @@ Configure software in a way that is:
* **Allows Auto Generation**: *We don't need to manually implement application client or data format to encode and similarly data format to parse. All can be safely generated thanks to `protobuf` in almost any programming language, thanks to the wide plugin ecosystem. Additionally, you can generate a full CLI flag paring code or even documentation(!). It also means the smallest, possible impact in the event of application upgrade or modification. Type, Default, or even Help changed can be easily tracked in any language.*
* **Easy to Verify**: *Non-semantic verification and validation (e.g ) do not require executable participation. No need for CLI --dry-run logic, or even invoking anything external. All can be validated from the point of `protobuf`.* https://github.com/envoyproxy/protoc-gen-validate
* **Backward & Forward Compatible**: *Smooth version migrations, thanks to `protobuf` guarantee and safety checkers like [`buf check breaking`](https://docs.buf.build/breaking-usage)*
* **Extensible**: *On top of [**OpenConfig Proto Extensions Format 1.0.**](proto/openconfig/v1/extensions.proto) this specification allows CLI or language-specific extensions (e.g see [`kingpinv2` Go package](golang/kingpinv2) and its [extensions](golang/kingpinv2/proto/openconfig/kingpinv2/v1/extensions.proto))*
* **Extensible**: *On top of [**Proto Config Extensions Format 1.0.**](proto/protoconfig/v1/extensions.proto) this specification allows CLI or language-specific extensions (e.g see [`kingpinv2` Go package](go/kingpinv2) and its [extensions](go/kingpinv2/proto/protoconfig/kingpinv2/v1/extensions.proto))*

### Motivation

Expand All @@ -43,19 +43,19 @@ See [./specification#why-protocol-buffers](specification.md#why-protocol-buffers

### Example

See [example in Go](golang/README.md).
See [example in Go](go/README.md).

If you are not familiar with Go, this is still a useful example, as the flow and pattern will be similar to any language.

## This Repository

| Item | What | Status |
|--------|------|--------|
| [`proto/openconfig/v1/extensions.proto`](proto/openconfig/v1/extensions.proto) | *OpenConfig Proto Extensions Format 1.0* | Alpha |
| [`proto/protoconfig/v1/extensions.proto`](proto/protoconfig/v1/extensions.proto) | *Proto Config Extensions Format 1.0* | Alpha |
| [`proto/examples/helloworld/v1/helloworld.proto`]( proto/examples/helloworld/v1/helloworld.proto) | Example *Configuration Proto Definitions (CPD)* | Alpha |
| [`golang/`](golang) | Go module with (optional) *OpenConfig Proto Extensions Format 1.0* bindings | Alpha |
| [`golang/protoc-gen-go-openconfig`](golang/protoc-gen-go-openconfig/README.md) | Go module with (optional) protogen go plugin supporting *OpenConfig Proto Extensions Format 1.0* Go language | Alpha |
| [`golang/examples`](golang/examples/README.md) | Go module with (optional) protogen go plugin supporting *OpenConfig Proto Extensions Format 1.0* Go language | Alpha |
| [`go/`](go) | Go module with (optional) *Proto Config Extensions Format 1.0* bindings | Alpha |
| [`go/protoc-gen-go-protoconfig`](go/protoc-gen-go-protoconfig/README.md) | Go module with (optional) protogen go plugin supporting *Proto Config Extensions Format 1.0* Go language | Alpha |
| [`go/examples`](go/examples/README.md) | Go module with (optional) protogen go plugin supporting *Proto Config Extensions Format 1.0* Go language | Alpha |

### Contributing

Expand All @@ -67,8 +67,8 @@ Put an issue on this repo, create PR or ping us on the CNCF Slack (`@bwplotka`,

Help wanted!

* [ ] Documentation for using OpenConfig 1.0 by different language than supported by this repo.
* [ ] Documentation for writing OpenConfig 1.0 plugin for a different language than supported by this repo.
* [ ] Documentation for using ProtoConfig 1.0 by different language than supported by this repo.
* [ ] Documentation for writing ProtoConfig 1.0 plugin for a different language than supported by this repo.
* [ ] Publish formal RFC-compatible specification, finish it, add recommendations (e.g package names).
* [ ] Document extensibility.
* [ ] Add example if any configuration templating engine.
Expand Down
4 changes: 2 additions & 2 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ lint:
ENUM_ZERO_VALUE_SUFFIX:
- examples/helloworld/v1/helloworld.proto
ignore:
# per the lint configuration docs, the paths for lint ignores have the root
# Per the lint configuration docs, the paths for lint ignores have the root
# directory stripped so that this configuration works for both sources and images
# google/api and google/rpc are the directories within googleapis/ that we want to ignore
# google/api and google/rpc are the directories within googleapis/ that we want to ignore.
- google/protobuf/descriptor.proto
use:
- DEFAULT
File renamed without changes.
26 changes: 13 additions & 13 deletions golang/Makefile → go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include ../common.mk
include ../.bingo/Variables.mk

MODULE_EXAMPLES := examples
MODULE_GEN_GO := protoc-gen-go-openconfig
MODULE_GEN_GO := protoc-gen-go-protoconfig
MODULE_KINGPINV2 := kingpinv2

FILES_TO_FMT ?= $(shell find . -path ./vendor -prune -o -name '*.go' -print)
Expand All @@ -17,9 +17,9 @@ GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin
all: format build

.PHONY: build
build: ## Build protoc-gen-go-openconfig.
build: ## Build protoc-gen-go-protoconfig.
@echo ">> building $(MODULE_GEN_GO)"
@cd $(MODULE_GEN_GO) && GOBIN=$(GOBIN) go install github.com/thanos-io/OpenConfig/golang/protoc-gen-go-openconfig
@cd $(MODULE_GEN_GO) && GOBIN=$(GOBIN) go install github.com/protoconfig/protoconfig/go/protoc-gen-go-protoconfig

.PHONY: deps
deps: ## Ensures fresh go.mod and go.sum.
Expand Down Expand Up @@ -48,25 +48,25 @@ test:
PROTOC_GEN_GO_CURRENT := $(TMP_GOBIN)/protoc-gen-go

.PHONY: proto
proto: ## Generated golang protobuf
proto: ## Generate protobufs for all modules
proto: build $(BUF) $(PROTOC_GEN_GO)
@mkdir -p $(TMP_GOBIN)
@cp $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_CURRENT)
@echo ">> generating $(REPO_ROOT_DIR)/proto/openconfig/v1/extensions.proto in $(REPO_ROOT_DIR)/golang"
@echo ">> generating $(REPO_ROOT_DIR)/proto/protoconfig/v1/extensions.proto in $(REPO_ROOT_DIR)/go"
@PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \
-I $(REPO_ROOT_DIR)/proto \
--go_out=$(REPO_ROOT_DIR)/golang --go_opt=module="github.com/thanos-io/OpenConfig/golang" \
$(REPO_ROOT_DIR)/proto/openconfig/v1/extensions.proto
@echo ">> generating $(REPO_ROOT_DIR)/proto/openconfig/golang/kingpinv2/v1/extensions.proto in $(REPO_ROOT_DIR)/golang/kingpinv2"
--go_out=$(REPO_ROOT_DIR)/go --go_opt=module="github.com/protoconfig/protoconfig/go" \
$(REPO_ROOT_DIR)/proto/protoconfig/v1/extensions.proto
@echo ">> generating $(REPO_ROOT_DIR)/proto/protoconfig/go/kingpinv2/v1/extensions.proto in $(REPO_ROOT_DIR)/go/kingpinv2"
@PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \
-I $(REPO_ROOT_DIR)/proto \
--go_out=$(REPO_ROOT_DIR)/golang/kingpinv2 --go_opt=module="github.com/thanos-io/OpenConfig/golang/kingpinv2" \
$(REPO_ROOT_DIR)/proto/openconfig/golang/kingpinv2/v1/extensions.proto
@echo ">> generating $(REPO_ROOT_DIR)/proto/examples/helloworld/v1/helloworld.proto in $(REPO_ROOT_DIR)/golang/examples/helloworld/"
--go_out=$(REPO_ROOT_DIR)/go/kingpinv2 --go_opt=module="github.com/protoconfig/protoconfig/go/kingpinv2" \
$(REPO_ROOT_DIR)/proto/protoconfig/go/kingpinv2/v1/extensions.proto
@echo ">> generating $(REPO_ROOT_DIR)/proto/examples/helloworld/v1/helloworld.proto in $(REPO_ROOT_DIR)/go/examples/helloworld/"
@PATH=$(GOBIN):$(TMP_GOBIN) $(BUF) protoc \
-I $(REPO_ROOT_DIR)/proto \
--go_out=$(REPO_ROOT_DIR)/golang/examples/helloworld/ --go_opt=module="github.com/thanos-io/OpenConfig/golang/examples/helloworld" \
--go-openconfig_out=$(REPO_ROOT_DIR)/golang/examples/helloworld/ --go-openconfig_opt=module="github.com/thanos-io/OpenConfig/golang/examples/helloworld" \
--go_out=$(REPO_ROOT_DIR)/go/examples/helloworld/ --go_opt=module="github.com/protoconfig/protoconfig/go/examples/helloworld" \
--go-protoconfig_out=$(REPO_ROOT_DIR)/go/examples/helloworld/ --go-protoconfig_opt=module="github.com/protoconfig/protoconfig/go/examples/helloworld" \
$(REPO_ROOT_DIR)/proto/examples/helloworld/v1/helloworld.proto

.PHONY: check-git
Expand Down
4 changes: 2 additions & 2 deletions golang/compatibility.go → go/compatibility.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package openconfig
package protoconfig

// The SupportPackageIsVersion variables are referenced from generated protocol
// buffer files to ensure compatibility with the OpenConfig version used. The latest
// buffer files to ensure compatibility with the ProtoConfig version used. The latest
// support package version is 1.
//
// Older versions are kept for compatibility. They may be removed if
Expand Down
10 changes: 5 additions & 5 deletions golang/configurable.go → go/configurable.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package openconfig
package protoconfig

type Configurable interface {
// Decode parses byte slice as `Encoded Configuration Message` in JSON or proto format and unmarshal it on
// the Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion
// the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion
// (validation, default values etc).
// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `OpenConfig 1.0` extension support.
// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support.
Decode(ecm []byte) error
// DecodeString parses string `Encoded Configuration Message` in JSON or proto format and unmarshal it on
// the Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion
// the Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion
// (validation, default values etc).
// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `OpenConfig 1.0` extension support.
// Use `proto.Unmarshal` or `protojson.Unmarshal` for decoding without `ProtoConfig 1.0` extension support.
DecodeString(ecm string) error
}
12 changes: 6 additions & 6 deletions golang/configurator.go → go/configurator.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package openconfig
package protoconfig

// Configurator allows to produce `Encoded Configuration Messages` from the `Configuration Proto Definition`.
type Configurator interface {
// Encode encodes self as `Encoded Configuration Message` in proto format so it can be understood and
// passed to Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion
// passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion
// (validation, default values etc).
// Use `proto.Marshal` encoding without `OpenConfig 1.0` extension support.
// Use `proto.Marshal` encoding without `ProtoConfig 1.0` extension support.
Encode() ([]byte, error)
// EncodeJSON encodes self as `Encoded Configuration Message` in JSON format so it can be understood and
// passed to Configurable struct. It supports all `OpenConfig Proto Extensions Format 1.0` extenstion
// Use `protojson.Marshal` encoding without `OpenConfig 1.0` extension support.
// passed to Configurable struct. It supports all `Proto Config Extensions Format 1.0` extenstion
// Use `protojson.Marshal` encoding without `ProtoConfig 1.0` extension support.
EncodeJSON() ([]byte, error)

// Metadata returns metadata defined in `OpenConfig Proto Extensions Format 1.0`.
// Metadata returns metadata defined in `Proto Config Extensions Format 1.0`.
Metadata() Metadata
}
Loading

0 comments on commit 074b35a

Please sign in to comment.