Skip to content

Commit c681e55

Browse files
committed
[Feature] Compact Action
1 parent 6b82a17 commit c681e55

File tree

13 files changed

+253
-8
lines changed

13 files changed

+253
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
- (Documentation) ManualUpgrade Docs
88
- (Documentation) Add Required & Skip in Docs
99
- (Feature) (Platform) ECS Storage
10-
- (Bugfix) (Platform) Prevent NPE in case of missing Helm Release
10+
- (Bugfix) (Platform) Prevent NPE in case of missing Helm Release
11+
- (Feature) Compact Action
1112

1213
## [1.2.50](https://github.com/arangodb/kube-arangodb/tree/1.2.50) (2025-07-04)
1314
- (Feature) (Platform) MetaV1 Integration Service

docs/generated/actions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ nav_order: 11
2525
| CleanTLSCACertificate | no | 30m0s | no | Enterprise Only | Remove Certificate from CA TrustStore |
2626
| CleanTLSKeyfileCertificate | no | 30m0s | no | Enterprise Only | Remove old TLS certificate from server |
2727
| ClusterMemberCleanup | no | 10m0s | no | Community & Enterprise | Remove member from Cluster if it is gone already (Coordinators) |
28+
| CompactMember | no | 8h0m0s | no | Community & Enterprise | Runs the Compact API on the Member |
2829
| Delay | no | 10m0s | yes | Community & Enterprise | Define delay operation |
2930
| ~~DisableClusterScaling~~ | no | 10m0s | no | Community & Enterprise | Disable Cluster Scaling integration |
3031
| DisableMaintenance | no | 10m0s | no | Community & Enterprise | Disable ArangoDB maintenance mode |
@@ -123,6 +124,7 @@ spec:
123124
CleanTLSCACertificate: 30m0s
124125
CleanTLSKeyfileCertificate: 30m0s
125126
ClusterMemberCleanup: 10m0s
127+
CompactMember: 8h0m0s
126128
Delay: 10m0s
127129
DisableClusterScaling: 10m0s
128130
DisableMaintenance: 10m0s

internal/actions.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ actions:
2424
RecreateMember:
2525
description: Recreate member with same ID and Data
2626
timeout: 15m
27+
CompactMember:
28+
description: Runs the Compact API on the Member
29+
timeout: 8h
30+
scopes:
31+
- Normal
2732
CleanOutMember:
2833
description: Run the CleanOut job on member
2934
timeout: 48h

pkg/apis/deployment/v1/actions.generated.go

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

pkg/apis/deployment/v2alpha1/actions.generated.go

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

pkg/deployment/client/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ type Client interface {
5555
RefreshJWT(ctx context.Context) (JWTDetails, error)
5656

5757
DeleteExpiredJobs(ctx context.Context, timeout time.Duration) error
58+
59+
Compact(ctx context.Context, request *CompactRequest) error
5860
}
5961

6062
type client struct {

pkg/deployment/client/compact.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
package client
22+
23+
import (
24+
"context"
25+
goHttp "net/http"
26+
)
27+
28+
type CompactRequest struct {
29+
CompactBottomMostLevel *bool `json:"compactBottomMostLevel,omitempty"`
30+
ChangeLevel *bool `json:"changeLevel,omitempty"`
31+
}
32+
33+
const CompactUrl = "/_admin/compact"
34+
35+
func (c *client) Compact(ctx context.Context, request *CompactRequest) error {
36+
req, err := c.c.NewRequest(goHttp.MethodPut, CompactUrl)
37+
if err != nil {
38+
return err
39+
}
40+
41+
if request == nil {
42+
request = new(CompactRequest)
43+
}
44+
45+
req, err = req.SetBody(request)
46+
if err != nil {
47+
return err
48+
}
49+
50+
resp, err := c.c.Do(ctx, req)
51+
if err != nil {
52+
return err
53+
}
54+
55+
if err := resp.CheckStatus(goHttp.StatusOK); err != nil {
56+
return err
57+
}
58+
59+
return nil
60+
}

pkg/deployment/reconcile/action.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2016-2022 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.
@@ -34,6 +34,8 @@ import (
3434

3535
const (
3636
DefaultStartFailureGracePeriod = 10 * time.Second
37+
38+
LocalJobID api.PlanLocalKey = "jobID"
3739
)
3840

3941
func GetAllActions() []api.ActionType {

pkg/deployment/reconcile/action.register.generated.go

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

pkg/deployment/reconcile/action.register.generated_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,16 @@ func Test_Actions(t *testing.T) {
160160
})
161161
})
162162

163+
t.Run("CompactMember", func(t *testing.T) {
164+
ActionsExistence(t, api.ActionTypeCompactMember)
165+
t.Run("Internal", func(t *testing.T) {
166+
require.False(t, api.ActionTypeCompactMember.Internal())
167+
})
168+
t.Run("Optional", func(t *testing.T) {
169+
require.False(t, api.ActionTypeCompactMember.Optional())
170+
})
171+
})
172+
163173
t.Run("Delay", func(t *testing.T) {
164174
ActionsExistence(t, api.ActionTypeDelay)
165175
t.Run("Internal", func(t *testing.T) {

0 commit comments

Comments
 (0)