8000 [Feature] [Platform] CLI · arangodb/kube-arangodb@b3b43b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit b3b43b5

Browse files
committed
[Feature] [Platform] CLI
1 parent f5ec9c7 commit b3b43b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2520
-178
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- (Feature) (Platform) Inventory as Proto
55
- (Docs) Update Refs
66
- (Feature) Expose Agency Shard Details
7+
- (Feature) (Platform) CLI
78

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

Makefile

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,16 @@ BIN_OPS := $(BINDIR)/$(BIN_OPS_NAME)
234234
BIN_INT_NAME := $(PROJECT)_integration
235235
BIN_INT := $(BINDIR)/$(BIN_INT_NAME)
236236

237+
BIN_PLATFORM_NAME := $(PROJECT)_platform
238+
BIN_PLATFORM := $(BINDIR)/$(BIN_PLATFORM_NAME)
239+
237240
define binary
238241
$(eval _OS:=$(call UPPER_ENV,$1))
239242
$(eval _ARCH:=$(call UPPER_ENV,$2))
240243
VBIN_$(_OS)_$(_ARCH) := $(BINDIR)/$(RELEASE_MODE)/$1/$2/$(BINNAME)
241244
VBIN_OPS_$(_OS)_$(_ARCH) := $(BINDIR)/$(RELEASE_MODE)/$1/$2/$(BIN_OPS_NAME)
242245
VBIN_INT_$(_OS)_$(_ARCH) := $(BINDIR)/$(RELEASE_MODE)/$1/$2/$(BIN_INT_NAME)
246+
VBIN_PLATFORM_$(_OS)_$(_ARCH) := $(BINDIR)/$(RELEASE_MODE)/$1/$2/$(BIN_PLATFORM_NAME)
243247

244248
$$(VBIN_$(_OS)_$(_ARCH)): $$(SOURCES) dashboard/assets.go VERSION
245249
@mkdir -p $(BINDIR)/$(RELEASE_MODE)/$1/$2
@@ -253,7 +257,13 @@ $$(VBIN_INT_$(_OS)_$(_ARCH)): $$(SOURCES) dashboard/assets.go VERSION
253257
@mkdir -p $(BINDIR)/$(RELEASE_MODE)/$1/$2
254258
CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build $${GOBUILDARGS} --tags "$$(GOBUILDTAGS)" $$(COMPILE_DEBUG_FLAGS) -installsuffix netgo -gcflags=all="$$(GOBUILDGCFLAGS)" -ldflags "$$(GOBUILDLDFLAGS)" -o $$@ ./cmd/main-int
255259

256-
bin-all: $$(VBIN_$(_OS)_$(_ARCH)) $$(VBIN_OPS_$(_OS)_$(_ARCH)) $$(VBIN_INT_$(_OS)_$(_ARCH))
260+
.PHONY: $$(VBIN_PLATFORM_$(_OS)_$(_ARCH))
261+
262+
$$(VBIN_PLATFORM_$(_OS)_$(_ARCH)): $$(SOURCES) dashboard/assets.go VERSION
263+
@mkdir -p $(BINDIR)/$(RELEASE_MODE)/$1/$2
264+
CGO_ENABLED=0 GOOS=$1 GOARCH=$2 go build $${GOBUILDARGS} --tags "$$(GOBUILDTAGS)" $$(COMPILE_DEBUG_FLAGS) -installsuffix netgo -gcflags=all="$$(GOBUILDGCFLAGS)" -ldflags "$$(GOBUILDLDFLAGS)" -o $$@ ./cmd/main-platform
265+
266+
bin-all: $$(VBIN_$(_OS)_$(_ARCH)) $$(VBIN_OPS_$(_OS)_$(_ARCH)) $$(VBIN_INT_$(_OS)_$(_ARCH)) $$(VBIN_PLATFORM_$(_OS)_$(_ARCH))
257267

258268
endef
259269

@@ -454,7 +464,7 @@ dashboard/assets.go:
454464
.PHONY: bin
455465
bin: $(BIN)
456466

457-
$(BIN): $(VBIN_LINUX_AMD64) $(VBIN_OPS_LINUX_AMD64) $(VBIN_INT_LINUX_AMD64)
467+
$(BIN): $(VBIN_LINUX_AMD64) $(VBIN_OPS_LINUX_AMD64) $(VBIN_INT_LINUX_AMD64) $(VBIN_PLATFORM_LINUX_AMD64)
458468
@cp "$(VBIN_LINUX_AMD64)" "$(BIN)"
459469
@cp "$(VBIN_OPS_LINUX_AMD64)" "$(BIN_OPS)"
460470

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ Flags:
197197
--kubernetes.max-batch-size int Size of batch during objects read (default 256)
198198
--kubernetes.qps float32 Number of queries per second for k8s API (default 15)
199199
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
200-
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, helm, http, inspector, integration-config-v1, integration-envoy-auth-v3, integration-scheduler-v2, integration-storage-v1-s3, integration-storage-v2, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, platform-chart-operator, platform-pod-shutdown, platform-storage-operator, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication, webhook (default [info])
200+
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, helm, http, inspector, integration-config-v1, integration-envoy-auth-v3, integration-scheduler-v2, integration-storage-v1-s3, integration-storage-v2, integrations, k8s-client, kubernetes-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, platform-chart-operator, platform-pod-shutdown, platform-storage-operator, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication, webhook (default [info])
201201
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
202+
--log.stdout If true, operator will log to the stdout (default true)
202203
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
203204
--metrics.excluded-prefixes stringArray List of the excluded metrics prefixes
204205
--mode.single Enable single mode in Operator. WARNING: There should be only one replica of Operator, otherwise Operator can take unexpected actions

cmd/cmd.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -58,6 +58,7 @@ import (
5858
"github.com/arangodb/kube-arangodb/pkg/operator/scope"
5959
"github.com/arangodb/kube-arangodb/pkg/server"
6060
"github.com/arangodb/kube-arangodb/pkg/util"
61+
"github.com/arangodb/kube-arangodb/pkg/util/cli"
6162
"github.com/arangodb/kube-arangodb/pkg/util/constants"
6263
"github.com/arangodb/kube-arangodb/pkg/util/errors"
6364
"github.com/arangodb/kube-arangodb/pkg/util/globals"
@@ -281,7 +282,8 @@ func Execute() int {
281282
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
282283

283284
if err := cmdMain.Execute(); err != nil {
284-
if v, ok := err.(CommandExitCode); ok {
285+
var v cli.CommandExitCode
286+
if errors.As(err, &v) {
285287
return v.ExitCode
286288
}
287289

cmd/init_container_version_check.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2016-2025 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ import (
2727
"github.com/rs/zerolog/log"
2828
"github.com/spf13/cobra"
2929

30+
"github.com/arangodb/kube-arangodb/pkg/util/cli"
3031
"github.com/arangodb/kube-arangodb/pkg/util/errors"
3132
)
3233

@@ -75,11 +76,11 @@ func (c *cmdVersionCheckInitContainersInputStruct) Run(cmd *cobra.Command, args
7576

7677
if c.major != 0 {
7778
if c.major != major {
78-
return Exit(cmdVersionCheckInitContainersInvalidVersionExitCode)
79+
return cli.Exit(cmdVersionCheckInitContainersInvalidVersionExitCode)
7980
}
8081
if c.minor != 0 {
8182
if c.minor != minor {
82-
return Exit(cmdVersionCheckInitContainersInvalidVersionExitCode)
83+
return cli.Exit(cmdVersionCheckInitContainersInvalidVersionExitCode)
8384
}
8485
}
8586
}

cmd/main-platform/main_int.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2024-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+
package main
22+
23+
import (
24+
"errors"
25+
"os"
26+
27+
"github.com/arangodb/kube-arangodb/pkg/logging"
28+
"github.com/arangodb/kube-arangodb/pkg/platform"
29+
"github.com/arangodb/kube-arangodb/pkg/util/cli"
30+
)
31+
32+
func main() {
33+
if err := mainE(); err != nil {
34+
var v cli.CommandExitCode
35+
if errors.As(err, &v) {
36+
os.Exit(v.ExitCode)
37+
}
38+
39+
os.Exit(1)
40+
}
41+
}
42+
43+
func mainE() error {
44+
c, err := platform.NewInstaller()
45+
if err != nil {
46+
return err
47+
}
48+
49+
if err := logging.Init(c); err != nil {
50+
return err
51+
}
52+
53+
if err := c.Execute(); err != nil {
54+
return err
55+
}
56+
57+
return nil
58+
}

docs/cli/arangodb_operator.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ Flags:
8282
--kubernetes.max-batch-size int Size of batch during objects read (default 256)
8383
--kubernetes.qps float32 Number of queries per second for k8s API (default 15)
8484
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
85-
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, helm, http, inspector, integration-config-v1, integration-envoy-auth-v3, integration-scheduler-v2, integration-storage-v1-s3, integration-storage-v2, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, platform-chart-operator, platform-pod-shutdown, platform-storage-operator, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication, webhook (default [info])
85+
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, helm, http, inspector, integration-config-v1, integration-envoy-auth-v3, integration-scheduler-v2, integration-storage-v1-s3, integration-storage-v2, integrations, k8s-client, kubernetes-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, platform-chart-operator, platform-pod-shutdown, platform-storage-operator, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication, webhook (default [info])
8686
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
87+
--log.stdout If true, operator will log to the stdout (default true)
8788
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
8889
--metrics.excluded-prefixes stringArray List of the excluded metrics prefixes
8990
--mode.single Enable single mode in Operator. WARNING: There should be only one replica of Operator, otherwise Operator can take unexpected actions
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
layout: page
3+
parent: Binaries
4+
title: arangodb_operator_platform
5+
---
6+
7+
# ArangoDB Operator Platform Command
8+
9+
[START_INJECT]: # (arangodb_operator_platform_cmd)
10+
```
11+
Usage:
12+
arangodb_operator_platform [command]
13+
14+
Available Commands:
15+
completion Generate the autocompletion script for the specified shell
16+
help Help about any command
17+
registry Registry related operations
18+
service Service related operations
19+
20+
Flags:
21+
-h, --help help for arangodb_operator_platform
22+
-n, --namespace string Kubernetes Namespace (default "default")
23+
24+
Use "arangodb_operator_platform [command] --help" for more information about a command.
25+
```
26+
[END_INJECT]: # (arangodb_operator_platform_cmd)
27+
28+
# ArangoDB Operator Platform Registry Command
29+
30+
[START_INJECT]: # (arangodb_operator_platform_registry_cmd)
31+
```
32+
Registry related operations
33+
34+
Usage:
35+
arangodb_operator_platform registry [command]
36+
37+
Available Commands:
38+
install Manages the Chart Installation
39+
status Describes Charts Status
40+
41+
Flags:
42+
-h, --help help for registry
43+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
44+
--platform.stage string Platform Stage Name (default "dev")
45+
46+
Global Flags:
47+
-n, --namespace string Kubernetes Namespace (default "default")
48+
49+
Use "arangodb_operator_platform registry [command] --help" for more information about a command.
50+
```
51+
[END_INJECT]: # (arangodb_operator_platform_registry_cmd)
52+
53+
# ArangoDB Operator Platform Registry Install Command
54+
55+
[START_INJECT]: # (arangodb_operator_platform_registry_install_cmd)
56+
```
57+
Manages the Chart Installation
58+
59+
Usage:
60+
arangodb_operator_platform registry install [flags] [...charts]
61+
62+
Flags:
63+
-a, --all Runs on all items
64+
-h, --help help for install
65+
-o, --output string Output format. Allowed table, json, yaml (default "table")
66+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
67+
--platform.stage string Platform Stage Name (default "dev")
68+
-u, --upgrade Enable upgrade procedure
69+
70+
Global Flags:
71+
-n, --namespace string Kubernetes Namespace (default "default")
72+
```
73+
[END_INJECT]: # (arangodb_operator_platform_registry_install_cmd)
74+
75+
# ArangoDB Operator Platform Registry Status Command
76+
77+
[START_INJECT]: # (arangodb_operator_platform_registry_status_cmd)
78+
```
79+
Describes Charts Status
80+
81+
Usage:
82+
arangodb_operator_platform registry status [flags]
83+
84+
Flags:
85+
-h, --help help for status
86+
-o, --output string Output format. Allowed table, json, yaml (default "table")
87+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
88+
--platform.stage string Platform Stage Name (default "dev")
89+
90+
Global Flags:
91+
-n, --namespace string Kubernetes Namespace (default "default")
92+
```
93+
[END_INJECT]: # (arangodb_operator_platform_registry_status_cmd)
94+
95+
# ArangoDB Operator Platform Service Command
96+
97+
[START_INJECT]: # (arangodb_operator_platform_service_cmd)
98+
```
99+
Service related operations
100+
101+
Usage:
102+
arangodb_operator_platform service [command]
103+
104+
Available Commands:
105+
enable Manages Service Installation/Management
106+
enable-service Manages Service Installation/Management
107+
status Shows Service Status
108+
109+
Flags:
110+
-h, --help help for service
111+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
112+
--platform.stage string Platform Stage Name (default "dev")
113+
114+
Global Flags:
115+
-n, --namespace string Kubernetes Namespace (default "default")
116+
117+
Use "arangodb_operator_platform service [command] --help" for more information about a command.
118+
```
119+
[END_INJECT]: # (arangodb_operator_platform_service_cmd)
120+
121+
# ArangoDB Operator Platform Service Enable Command
122+
123+
[START_INJECT]: # (arangodb_operator_platform_service_enable_cmd)
124+
```
125+
Manages Service Installation/Management
126+
127+
Usage:
128+
arangodb_operator_platform service enable [flags] deployment name chart
129+
130+
Flags:
131+
-h, --help help for enable
132+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
133+
--platform.stage string Platform Stage Name (default "dev")
134+
-f, --values strings Chart values
135+
136+
Global Flags:
137+
-n, --namespace string Kubernetes Namespace (default "default")
138+
```
139+
[END_INJECT]: # (arangodb_operator_platform_service_enable_cmd)
140+
141+
# ArangoDB Operator Platform Service EnableService Command
142+
143+
[START_INJECT]: # (arangodb_operator_platform_service_enableservice_cmd)
144+
```
145+
Manages Service Installation/Management
146+
147+
Usage:
148+
arangodb_operator_platform service enable-service [flags] deployment chart
149+
150+
Flags:
151+
-h, --help help for enable-service
152+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
153+
--platform.stage string Platform Stage Name (default "dev")
154+
-f, --values strings Chart values
155+
156+
Global Flags:
157+
-n, --namespace string Kubernetes Namespace (default "default")
158+
```
159+
[END_INJECT]: # (arangodb_operator_platform_service_enableservice_cmd)
160+
161+
# ArangoDB Operator Platform Service Status Command
162+
163+
[START_INJECT]: # (arangodb_operator_platform_service_status_cmd)
164+
```
165+
Shows Service Status
166+
167+
Usage:
168+
arangodb_operator_platform service status [flags] deployment
169+
170+
Flags:
171+
-h, --help help for status
172+
-o, --output string Output format. Allowed table, json, yaml (default "table")
173+
--platform.name string Kubernetes Platform Name (name of the ArangoDeployment)
174+
--platform.stage string Platform Stage Name (default "dev")
175+
176+
Global Flags:
177+
-n, --namespace string Kubernetes Namespace (default "default")
178+
```
179+
[END_INJECT]: # (arangodb_operator_platform_service_status_cmd)
180+

0 commit comments

Comments
 (0)
0