Skip to content

Commit 25d636e

Browse files
authored
[Feature] ConfigV1 Integration Service (#1704)
1 parent e97e425 commit 25d636e

37 files changed

+2385
-57
lines changed

.golangci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ linters-settings:
9999
alias: pbAuthorizationV0
100100
- pkg: github.com/arangodb/kube-arangodb/integrations/authorization/v0
101101
alias: pbImplAuthorizationV0
102+
- pkg: github.com/arangodb/kube-arangodb/integrations/config/v1/definition
103+
alias: pbConfigV1
104+
- pkg: github.com/arangodb/kube-arangodb/integrations/config/v1
105+
alias: pbImplConfigV1
102106
- pkg: github.com/arangodb/kube-arangodb/integrations/shared/v1/definition
103107
alias: pbSharedV1
104108
- pkg: github.com/arangodb/kube-arangodb/integrations/shared/v1

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- (Maintenance) Switch to ubuntu:24.04 base image
1414
- (Feature) Gateway Group for ArangoDeployment
1515
- (Feature) Gateway config loader
16+
- (Feature) ConfigV1 Integration Service
1617

1718
## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
1819
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries

Makefile

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -726,19 +726,9 @@ manifest-verify-helm-ee: manifests-verify-env-reset
726726
.PHONY: run-unit-tests
727727
run-unit-tests: $(SOURCES)
728728
go test --count=1 --tags "$(GOBUILDTAGS)" $(TESTVERBOSEOPTIONS) \
729-
$(REPOPATH)/pkg/apis/shared/... \
730-
$(REPOPATH)/pkg/apis/backup/... \
731-
$(REPOPATH)/pkg/apis/deployment/... \
732-
$(REPOPATH)/pkg/apis/replication/... \
733-
$(REPOPATH)/pkg/apis/storage/... \
734-
$(REPOPATH)/pkg/apis/ml/... \
735-
$(REPOPATH)/pkg/deployment/... \
736-
$(REPOPATH)/pkg/storage/... \
737-
$(REPOPATH)/pkg/crd/... \
738-
$(REPOPATH)/pkg/util/... \
739-
$(REPOPATH)/pkg/generated/metric_descriptions/... \
729+
$(REPOPATH)/pkg/... \
740730
$(REPOPATH)/cmd/... \
741-
$(REPOPATH)/pkg/handlers/...
731+
$(REPOPATH)/integrations/...
742732

743733
# Release building
744734

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ Flags:
182182
--kubernetes.max-batch-size int Size of batch during objects read (default 256)
183183
--kubernetes.qps float32 Number of queries per second for k8s API (default 15)
184184
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
185-
--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, http, inspector, integrations, k8s-client, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, pod_compare, root, root-event-recorder, server, server-authentication (default [info])
185+
--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, http, inspector, integration-config-v1, integrations, k8s-client, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, pod_compare, root, root-event-recorder, server, server-authentication (default [info])
186186
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
187187
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
188188
--metrics.excluded-prefixes stringArray List of the excluded metrics prefixes

integrations/authentication/v1/implementation_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ func Test_Basic(t *testing.T) {
4040
ctx, c := context.WithCancel(context.Background())
4141
defer c()
4242

43-
s, err := newInternal(ctx, Configuration{
44-
Path: directory,
45-
TTL: time.Duration(0),
46-
})
43+
s, err := newInternal(ctx, NewConfiguration().With(func(c Configuration) Configuration {
44+
c.Path = directory
45+
c.TTL = 0
46+
return c
47+
}))
4748
require.NoError(t, err)
4849

4950
// Create token

integrations/config/v1/config.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2024 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 v1
22+
23+
type Config struct {
24+
Modules ModuleDefinitions `json:"modules,omitempty"`
25+
}
26+
27+
func (c *Config) Init() {
28+
for k := range c.Modules {
29+
m := c.Modules[k]
30+
m.Name = k
31+
c.Modules[k] = m
32+
}
33+
}
34+
35+
type ModuleDefinitions map[string]ModuleDefinition
36+
37+
type ModuleDefinition struct {
38+
Name string `json:"-"`
39+
Path string `json:"path"`
40+
}

integrations/config/v1/config_test.go

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2024 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 v1
22+
23+
import (
24+
"fmt"
25+
"os"
26+
"testing"
27+
28+
"github.com/stretchr/testify/require"
29+
)
30+
31+
func Test_ConfigCreation(t *testing.T) {
32+
create := func(config Config) error {
33+
_, err := New(config)
34+
return err
35+
}
36+
37+
dir := t.TempDir()
38+
39+
require.NoError(t, os.WriteFile(fmt.Sprintf("%s/file", dir), []byte{}, 0644))
40+
41+
require.EqualError(t, create(Config{}), "Requires at least 1 module")
42+
43+
require.EqualError(t, create(Config{
44+
Modules: map[string]ModuleDefinition{
45+
"test": {},
46+
},
47+
}), "Path for module `test` cannot be empty")
48+
49+
require.EqualError(t, create(Config{
50+
Modules: map[string]ModuleDefinition{
51+
"test": {
52+
Path: "some/relative/path",
53+
},
54+
},
55+
}), "Path `some/relative/path` for module `test` needs to be absolute")
56+
57+
require.EqualError(t, create(Config{
58+
Modules: map[string]ModuleDefinition{
59+
"test": {
60+
Path: fmt.Sprintf("%s/non-existent", dir),
61+
},
62+
},
63+
}), fmt.Sprintf("Path `%s/non-existent` for module `test` does not exists", dir))
64+
65+
require.EqualError(t, create(Config{
66+
Modules: map[string]ModuleDefinition{
67+
"test": {
68+
Path: fmt.Sprintf("%s/file", dir),
69+
},
70+
},
71+
}), fmt.Sprintf("Path `%s/file` for module `test` is not a directory", dir))
72+
73+
require.NoError(t, create(Config{
74+
Modules: map[string]ModuleDefinition{
75+
"test": {
76+
Path: dir,
77+
},
78+
},
79+
}))
80+
}

integrations/config/v1/consts.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2024 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 v1
22+
23+
const (
24+
Name = "config.v1"
25+
)

0 commit comments

Comments
 (0)