Skip to content

Commit 216f73e

Browse files
authored
[Feature] [Platform] Inventory as Proto (#1809)
1 parent 667a156 commit 216f73e

19 files changed

+704
-45
lines changed

.golangci.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ linters-settings:
4747
pkg: github.com/arangodb/kube-arangodb/integrations/config/v1/definition
4848
- alias: pbImplEnvoyAuthV3
4949
pkg: github.com/arangodb/kube-arangodb/integrations/envoy/auth/v3
50+
- alias: pbInventoryV1
51+
pkg: github.com/arangodb/kube-arangodb/integrations/inventory/v1/definition
5052
- pkg: github.com/arangodb/kube-arangodb/integrations/pong/v1
5153
alias: pbImplPongV1
5254
- pkg: github.com/arangodb/kube-arangodb/integrations/pong/v1/definition

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Change Log
22

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

56
## [1.2.44](https://github.com/arangodb/kube-arangodb/tree/1.2.44) (2025-02-03)
67
- (Maintenance) Kubernetes 1.31.1 libraries

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,10 @@ tools: tools-min
795795
@echo ">> Unzipping protobuf compiler..."
796796
@unzip -o $(GOPATH)/protoc.zip -d $(GOPATH)/
797797
@chmod +x $(GOPATH)/bin/protoc
798+
@echo ">> Download proto deps"
799+
@rm -Rf $(GOPATH)/include/googleapis
800+
@git clone --branch "master" --depth 1 https://github.com/googleapis/googleapis.git $(GOPATH)/include/googleapis
801+
@rm -Rf $(VENDORDIR)/include/googleapis/.git
798802
@echo ">> Fetching protoc go plugins..."
799803
@GOBIN=$(GOPATH)/bin go install github.com/golang/protobuf/[email protected]
800804
@GOBIN=$(GOPATH)/bin go install google.golang.org/grpc/cmd/[email protected]
@@ -910,7 +914,7 @@ generate-internal:
910914
ROOT=$(ROOT) go test --count=1 "$(REPOPATH)/internal/..."
911915

912916
generate-proto:
913-
PATH="$(PATH):$(GOBUILDDIR)/bin" $(GOBUILDDIR)/bin/protoc -I.:$(GOBUILDDIR)/include/ \
917+
PATH="$(PATH):$(GOBUILDDIR)/bin" $(GOBUILDDIR)/bin/protoc -I.:$(GOBUILDDIR)/include/ -I.:$(GOBUILDDIR)/include/googleapis/ \
914918
--go_out=. --go_opt=paths=source_relative \
915919
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
916920
$(PROTOSOURCES)

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ require (
7676
github.com/arangodb-managed/integration-apis v0.2.1
7777
github.com/aws/aws-sdk-go v1.55.5
7878
github.com/jedib0t/go-pretty/v6 v6.6.5
79+
google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f
7980
helm.sh/helm/v3 v3.16.2
8081
)
8182

@@ -211,7 +212,6 @@ require (
211212
golang.org/x/net v0.31.0 // indirect
212213
golang.org/x/oauth2 v0.23.0 // indirect
213214
golang.org/x/term v0.27.0 // indirect
214-
google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f // indirect
215215
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
216216
gopkg.in/inf.v0 v0.9.1 // indirect
217217
gopkg.in/yaml.v2 v2.4.0 // indirect

pkg/platform/state.go renamed to integrations/inventory/v1/definition/inventory.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919
//
2020

21-
package platform
21+
package definition
2222

23-
type State struct {
24-
Configuration StateConfiguration `json:"configuration,omitempty"`
25-
}
23+
import ugrpc "github.com/arangodb/kube-arangodb/pkg/util/grpc"
24+
25+
func (s *Inventory) JSON() ([]byte, error) {
26+
if s == nil {
27+
return []byte("{}"), nil
28+
}
2629

27-
type StateConfiguration struct {
28-
Hash string `json:"hash,omitempty"`
30+
return ugrpc.Marshal(s)
2931
}

integrations/inventory/v1/definition/inventory.pb.go

+241
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2025 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
syntax = "proto3";
22+
23+
package inventory;
24+
25+
option go_package = "github.com/arangodb/kube-arangodb/integrations/inventory/v1/definition";
26+
27+
// Platform Inventory
28+
message Inventory {
29+
// Current Envoy Configuration details
30+
optional InventoryConfiguration configuration = 1;
31+
}
32+
33+
// Envoy Configuration details
34+
message InventoryConfiguration {
35+
// Configuration hash
36+
string hash = 1;
37+
}

0 commit comments

Comments
 (0)