8000 [Feature] [Platform] Inventory as Proto · arangodb/kube-arangodb@9cc706d · GitHub
[go: up one dir, main page]

Skip to content

Commit 9cc706d

Browse files
committed
[Feature] [Platform] Inventory as Proto
1 parent 82486e6 commit 9cc706d

18 files changed

+650
-44
lines changed

.golangci.yaml

Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
- (Bugfix) Fix IntOrString Schema Type
5656
- (Feature) Enable Operator Handler StackTraces
5757
- (Feature) Add spec validation for MLExtension
58+
- (Feature) (Platform) Inventory as Proto
5859

5960
## [1.2.43](https://github.com/arangodb/kube-arangodb/tree/1.2.43) (2024-10-14)
6061
- (Feature) ArangoRoute CRD

Makefile

Lines changed: 5 additions & 1 deletion
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/protoc-gen-go@v1.5.2
800804
@GOBIN=$(GOPATH)/bin go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
@@ -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)

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

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
import "google/api/annotations.proto";
24+
25+
import "integrations/shared/v1/definition/empty.proto";
26+
import "integrations/inventory/v1/definition/state.proto";
27+
28+
package inventory;
29+
30+
option go_package = "github.com/arangodb/kube-arangodb/integrations/inventory/v1/definition";
31+
32+
service InventoryV1 {
33+
rpc HealthCheck (shared.Empty) returns (State) {
34+
option (google.api.http) = {
35+
get: "/_inventory"
36+
};
37+
}
38+
}

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

Lines changed: 106 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 8 additions & 6 deletions
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 *State) 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
}

0 commit comments

Comments
 (0)
0