Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ linters-settings:
pkg: github.com/arangodb/kube-arangodb/integrations/meta/v1
- alias: pbMetaV1
pkg: github.com/arangodb/kube-arangodb/integrations/meta/v1/definition
- alias: pbImplEventsV1
pkg: github.com/arangodb/kube-arangodb/integrations/events/v1
- alias: pbEventsV1
pkg: github.com/arangodb/kube-arangodb/integrations/events/v1/definition
- alias: pbImplAuthenticationV1
pkg: github.com/arangodb/kube-arangodb/integrations/authentication/v1
- alias: pbAuthenticationV1
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- (Feature) (License) Activation CLI
- (Bugfix) (DP) Propagate Timeout Across Subcommands
- (Maintenance) Bump Dependencies
- (Feature) (Platform) EventsV1 Integration

## [1.3.1](https://github.com/arangodb/kube-arangodb/tree/1.3.1) (2025-10-07)
- (Documentation) Add ArangoPlatformStorage Docs & Examples
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Flags:
--kubernetes.qps float32 Number of queries per second for k8s API. If set to 0 or less, API calls won't be throttled (default 32)
--leader.label.skip Skips Leader Label for the Pod
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
--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-authn-v1, integration-config-v1, integration-envoy-auth-v3, integration-envoy-auth-v3-impl-auth-bearer, integration-envoy-auth-v3-impl-auth-cookie, integration-envoy-auth-v3-impl-custom-openid, integration-envoy-auth-v3-impl-pass-mode, integration-meta-v1, integration-scheduler-v2, integration-shutdown-v1, integration-storage-v1-s3, integration-storage-v2, integrations, k8s-client, kubernetes, kubernetes-access, 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-service-operator, 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])
--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-authn-v1, integration-config-v1, integration-envoy-auth-v3, integration-envoy-auth-v3-impl-auth-bearer, integration-envoy-auth-v3-impl-auth-cookie, integration-envoy-auth-v3-impl-custom-openid, integration-envoy-auth-v3-impl-pass-mode, integration-events-v1, integration-meta-v1, integration-pong-v1, integration-scheduler-v2, integration-shutdown-v1, integration-storage-v1-s3, integration-storage-v2, integrations, k8s-client, kubernetes, kubernetes-access, 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-service-operator, 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])
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
--log.stdout If true, operator will log to the stdout (default true)
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/arangodb_operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Flags:
--kubernetes.qps float32 Number of queries per second for k8s API. If set to 0 or less, API calls won't be throttled (default 32)
--leader.label.skip Skips Leader Label for the Pod
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
--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-authn-v1, integration-config-v1, integration-envoy-auth-v3, integration-envoy-auth-v3-impl-auth-bearer, integration-envoy-auth-v3-impl-auth-cookie, integration-envoy-auth-v3-impl-custom-openid, integration-envoy-auth-v3-impl-pass-mode, integration-meta-v1, integration-scheduler-v2, integration-shutdown-v1, integration-storage-v1-s3, integration-storage-v2, integrations, k8s-client, kubernetes, kubernetes-access, 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-service-operator, 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])
--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-authn-v1, integration-config-v1, integration-envoy-auth-v3, integration-envoy-auth-v3-impl-auth-bearer, integration-envoy-auth-v3-impl-auth-cookie, integration-envoy-auth-v3-impl-custom-openid, integration-envoy-auth-v3-impl-pass-mode, integration-events-v1, integration-meta-v1, integration-pong-v1, integration-scheduler-v2, integration-shutdown-v1, integration-storage-v1-s3, integration-storage-v2, integrations, k8s-client, kubernetes, kubernetes-access, 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-service-operator, 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])
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
--log.stdout If true, operator will log to the stdout (default true)
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
Expand Down
7 changes: 7 additions & 0 deletions docs/cli/arangodb_operator_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ Flags:
--integration.envoy.auth.v3.extensions.users.create Defines if UserCreation extension is enabled (Env: INTEGRATION_ENVOY_AUTH_V3_EXTENSIONS_USERS_CREATE)
--integration.envoy.auth.v3.external Defines if External access to service envoy.auth.v3 is enabled (Env: INTEGRATION_ENVOY_AUTH_V3_EXTERNAL)
--integration.envoy.auth.v3.internal Defines if Internal access to service envoy.auth.v3 is enabled (Env: INTEGRATION_ENVOY_AUTH_V3_INTERNAL) (default true)
--integration.events.v1 Enable EventsV1 Integration Service (Env: INTEGRATION_EVENTS_V1)
--integration.events.v1.async Enables async injection of the events (Env: INTEGRATION_EVENTS_V1_ASYNC) (default true)
--integration.events.v1.async.retry.delay duration Delay of the retries (Env: INTEGRATION_EVENTS_V1_ASYNC_RETRY_DELAY) (default 1s)
--integration.events.v1.async.retry.timeout duration Timeout for the event injection (Env: INTEGRATION_EVENTS_V1_ASYNC_RETRY_TIMEOUT) (default 1m0s)
--integration.events.v1.async.size int Size of the async queue (Env: INTEGRATION_EVENTS_V1_ASYNC_SIZE) (default 16)
--integration.events.v1.external Defines if External access to service events.v1 is enabled (Env: INTEGRATION_EVENTS_V1_EXTERNAL)
--integration.events.v1.internal Defines if Internal access to service events.v1 is enabled (Env: INTEGRATION_EVENTS_V1_INTERNAL) (default true)
--integration.meta.v1 Enable MetaV1 Integration Service (Env: INTEGRATION_META_V1)
--integration.meta.v1.external Defines if External access to service meta.v1 is enabled (Env: INTEGRATION_META_V1_EXTERNAL)
--integration.meta.v1.internal Defines if Internal access to service meta.v1 is enabled (Env: INTEGRATION_META_V1_INTERNAL) (default true)
Expand Down
21 changes: 14 additions & 7 deletions docs/integration-sidecar.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ nav_order: 2

### Resource Types

Integration Sidecar is supported in a few resources managed by Operator:
Integration Sidecar is supported in a basic resources managed by Kubernetes:

- ArangoSchedulerDeployment (scheduler.arangodb.com/v1beta1)
- ArangoSchedulerBatchJob (scheduler.arangodb.com/v1beta1)
- ArangoSchedulerCronJob (scheduler.arangodb.com/v1beta1)
- ArangoSchedulerPod (scheduler.arangodb.com/v1beta1)

Standard Kubernetes Resources (like Pod) are also supported with Webhook extension is enabled.
- Pod

To enable integration sidecar for specific deployment label needs to be defined:

Expand Down Expand Up @@ -140,6 +135,18 @@ metadata:
integration.profiles.arangodb.com/meta: v1
```

#### [Events V1](./integration/events.v1.md)

Events Integration Sidecar

To enable:

```yaml
metadata:
labels:
integration.profiles.arangodb.com/events: v1
```

### Envs

#### INTEGRATION_API_ADDRESS
Expand Down
2 changes: 1 addition & 1 deletion docs/integration/authentication.v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ parent: Integration Sidecars

Definitions:

- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.0/integrations/authentication/v1/definition/definition.proto)
- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.1/integrations/authentication/v1/definition/definition.proto)
2 changes: 1 addition & 1 deletion docs/integration/authorization.v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ parent: Integration Sidecars

Definitions:

- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.0/integrations/authorization/v0/definition/definition.proto)
- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.1/integrations/authorization/v0/definition/definition.proto)

12 changes: 12 additions & 0 deletions docs/integration/events.v1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: page
title: Integration Sidecar Meta V1
grand_parent: ArangoDBPlatform
parent: Integration Sidecars
---

# Events V1

Definitions:

- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.1/integrations/events/v1/definition/definition.proto)
2 changes: 1 addition & 1 deletion docs/integration/meta.v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ parent: Integration Sidecars

Definitions:

- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.0/integrations/meta/v1/definition/definition.proto)
- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.1/integrations/meta/v1/definition/definition.proto)
2 changes: 1 addition & 1 deletion docs/integration/scheduler.v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ parent: Integration Sidecars

Definitions:

- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.0/integrations/scheduler/v1/definition/definition.proto)
- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.1/integrations/scheduler/v1/definition/definition.proto)

2 changes: 1 addition & 1 deletion docs/integration/scheduler.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ parent: Integration Sidecars

Definitions:

- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.0/integrations/scheduler/v2/definition/definition.proto)
- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.1/integrations/scheduler/v2/definition/definition.proto)

2 changes: 1 addition & 1 deletion docs/integration/shutdown.v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ parent: Integration Sidecars

Definitions:

- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.0/integrations/shutdown/v1/definition/shutdown.proto)
- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.1/integrations/shutdown/v1/definition/shutdown.proto)

Operator will send shutdown request once all containers marked with annotation are stopped.

Expand Down
2 changes: 1 addition & 1 deletion docs/integration/storage.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ parent: Integration Sidecars

Definitions:

- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.0/integrations/storage/v2/definition/storage.proto)
- [Service](https://github.com/arangodb/kube-arangodb/blob/1.3.1/integrations/storage/v2/definition/storage.proto)

## Configuration

Expand Down
1 change: 1 addition & 0 deletions docs/platform/storage/gcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: page
title: Google Cloud Storage
parent: Storage
grand_parent: ArangoDBPlatform
nav_order: 2
---

Expand Down
1 change: 1 addition & 0 deletions docs/platform/storage/minio.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: page
title: MinIO
parent: Storage
grand_parent: ArangoDBPlatform
nav_order: 3
---

Expand Down
1 change: 1 addition & 0 deletions docs/platform/storage/s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: page
title: AWS S3
parent: Storage
grand_parent: ArangoDBPlatform
nav_order: 1
---

Expand Down
6 changes: 3 additions & 3 deletions integrations/authentication/v1/definition/definition.pb.gw.go

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

122 changes: 122 additions & 0 deletions integrations/events/v1/async.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
//
// 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
//

package v1

import (
"context"
"time"

"github.com/pkg/errors"
"google.golang.org/protobuf/proto"

"github.com/arangodb/kube-arangodb/pkg/util/globals"
)

func WithAsync[IN proto.Message, H RemoteStore[IN]](in H, size int, timeout time.Duration, delay time.Duration) RemoteStore[IN] {
return &asyncRemoteWriter[IN, H]{
upstream: in,
cache: make(chan []IN, size),
timeout: timeout,
delay: delay,
}
}

type asyncRemoteWriter[IN proto.Message, H RemoteStore[IN]] struct {
upstream H

cache chan []IN

timeout time.Duration
delay time.Duration
}

func (a *asyncRemoteWriter[IN, H]) Init(ctx context.Context) error {
return a.upstream.Init(ctx)
}

func (a *asyncRemoteWriter[IN, H]) Background(ctx context.Context) {
logger.Info("Async background started")
defer func() {
logger.Info("Async background completed")
}()

for {
select {
case <-ctx.Done():
close(a.cache)
for events := range a.cache {
// Cleanup the queue
a.emitEvents(events...)
}
return
case events := <-a.cache:
a.emitEvents(events...)
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Goroutine Leak in Background Method

The Background method has a race condition. When ctx is cancelled, the goroutine (line 61-64) closes a.cache, causing the for-range loop to exit. However, if a.emitEvents() is currently blocked in the select statement (lines 80-94) waiting for a response, it will continue running after Background() returns. This can lead to background goroutines continuing to execute after the context is cancelled and the Background handler has already returned, which is a violation of the Background handler contract. The delay parameter (line 48) is also never used.

Fix in Cursor Fix in Web


func (a *asyncRemoteWriter[IN, H]) emitEvents(events ...IN) {
if len(events) == 0 {
return
}

timeoutTimer := time.NewTimer(a.timeout)
defer timeoutTimer.Stop()

delayTimer := time.NewTicker(a.delay)
defer delayTimer.Stop()

for {
err := globals.GetGlobals().Timeouts().ArangoD().RunWithTimeout(context.Background(), func(ctxChild context.Context) error {
return a.upstream.Emit(ctxChild, events...)
})
if err != nil {
logger.Err(err).Warn("Unable to send events batch, retry")
} else {
logger.Debug("Batch sent")
return
}

select {
case <-delayTimer.C:
continue
case <-timeoutTimer.C:
logger.Error("Unable to send events in expected time")
return
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Retry Loop Ignores Delay, Causes Busy-Wait

The emitEvents method's retry loop immediately retries failed upstream.Emit calls without using the configured delay field. This creates a tight, busy-wait loop that can consume excessive CPU and rapidly retry operations.

Fix in Cursor Fix in Web

}

func (a *asyncRemoteWriter[IN, H]) Emit(ctx context.Context, events ...IN) error {
if len(events) == 0 {
return nil
}

timeout := time.NewTimer(time.Second)
defer timeout.Stop()

select {
case a.cache <- events:
return nil
case <-timeout.C:
return errors.Errorf("timeout waiting for events to be scheduled")
}
}
47 changes: 47 additions & 0 deletions integrations/events/v1/collection.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// 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
//

package v1

import (
"context"
"time"

"github.com/arangodb/go-driver/v2/arangodb"

"github.com/arangodb/kube-arangodb/pkg/util/cache"
)

func withTTLIndex(in cache.Object[arangodb.Collection]) cache.Object[arangodb.Collection] {
return cache.NewObject(func(ctx context.Context) (arangodb.Collection, time.Duration, error) {
col, err := in.Get(ctx)
if err != nil {
return nil, 0, err
}

if _, _, err := col.EnsureTTLIndex(ctx, []string{"created"}, int(DefaultTTL/time.Second), &arangodb.CreateTTLIndexOptions{
Name: "system_events_created_ttl_index",
}); err != nil {
return nil, 0, err
}

return col, time.Hour, nil
})
}
Loading