Skip to content

Commit

Permalink
[Feature] [Platform] Inventory as Proto (#1809)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanikow authored Feb 4, 2025
1 parent 667a156 commit 216f73e
Show file tree
Hide file tree
Showing 19 changed files with 704 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ linters-settings:
pkg: github.com/arangodb/kube-arangodb/integrations/config/v1/definition
- alias: pbImplEnvoyAuthV3
pkg: github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3
- alias: pbInventoryV1
pkg: github.com/arangodb/kube-arangodb/integrations/inventory/v1/definition
- pkg: github.com/arangodb/kube-arangodb/integrations/pong/v1
alias: pbImplPongV1
- pkg: github.com/arangodb/kube-arangodb/integrations/pong/v1/definition
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Log

## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
- (Feature) (Platform) Inventory as Proto

## [1.2.44](https://github.com/arangodb/kube-arangodb/tree/1.2.44) (2025-02-03)
- (Maintenance) Kubernetes 1.31.1 libraries
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,10 @@ tools: tools-min
@echo ">> Unzipping protobuf compiler..."
@unzip -o $(GOPATH)/protoc.zip -d $(GOPATH)/
@chmod +x $(GOPATH)/bin/protoc
@echo ">> Download proto deps"
@rm -Rf $(GOPATH)/include/googleapis
@git clone --branch "master" --depth 1 https://github.com/googleapis/googleapis.git $(GOPATH)/include/googleapis
@rm -Rf $(VENDORDIR)/include/googleapis/.git
@echo ">> Fetching protoc go plugins..."
@GOBIN=$(GOPATH)/bin go install github.com/golang/protobuf/protoc-gen-go@v1.5.2
@GOBIN=$(GOPATH)/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
Expand Down Expand Up @@ -910,7 +914,7 @@ generate-internal:
ROOT=$(ROOT) go test --count=1 "$(REPOPATH)/internal/..."

generate-proto:
PATH="$(PATH):$(GOBUILDDIR)/bin" $(GOBUILDDIR)/bin/protoc -I.:$(GOBUILDDIR)/include/ \
PATH="$(PATH):$(GOBUILDDIR)/bin" $(GOBUILDDIR)/bin/protoc -I.:$(GOBUILDDIR)/include/ -I.:$(GOBUILDDIR)/include/googleapis/ \
--go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
$(PROTOSOURCES)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ require (
github.com/arangodb-managed/integration-apis v0.2.1
github.com/aws/aws-sdk-go v1.55.5
github.com/jedib0t/go-pretty/v6 v6.6.5
google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f
helm.sh/helm/v3 v3.16.2
)

Expand Down Expand Up @@ -211,7 +212,6 @@ require (
golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/term v0.27.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//

package platform
package definition

type State struct {
Configuration StateConfiguration `json:"configuration,omitempty"`
}
import ugrpc "github.com/arangodb/kube-arangodb/pkg/util/grpc"

func (s *Inventory) JSON() ([]byte, error) {
if s == nil {
return []byte("{}"), nil
}

type StateConfiguration struct {
Hash string `json:"hash,omitempty"`
return ugrpc.Marshal(s)
}
241 changes: 241 additions & 0 deletions integrations/inventory/v1/definition/inventory.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions integrations/inventory/v1/definition/inventory.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// DISCLAIMER
//
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//

syntax = "proto3";

package inventory;

option go_package = "github.com/arangodb/kube-arangodb/integrations/inventory/v1/definition";

// Platform Inventory
message Inventory {
// Current Envoy Configuration details
optional InventoryConfiguration configuration = 1;
}

// Envoy Configuration details
message InventoryConfiguration {
// Configuration hash
string hash = 1;
}
Loading

0 comments on commit 216f73e

Please sign in to comment.