Skip to content

Commit c5ffe86

Browse files
authored
[Feature] [Scheduler] Extract Integration (#1723)
1 parent 0d61081 commit c5ffe86

29 files changed

+2405
-1981
lines changed

docs/api/ArangoDeployment.V1.md

Lines changed: 207 additions & 207 deletions
Large diffs are not rendered by default.

docs/cli/arangodb_operator_integration.md

Lines changed: 58 additions & 58 deletions
Large diffs are not rendered by default.

pkg/apis/deployment/v1/deployment_spec.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ type DeploymentSpec struct {
262262

263263
// Gateway defined main Gateway configuration.
264264
Gateway *DeploymentSpecGateway `json:"gateway,omitempty"`
265+
266+
// Integration defined main Integration configuration.
267+
Integration *DeploymentSpecIntegration `json:"integration,omitempty"`
265268
}
266269

267270
// GetAllowMemberRecreation returns member recreation policy based on group and settings
@@ -582,7 +585,10 @@ func (s *DeploymentSpec) Validate() error {
582585
return errors.WithStack(errors.Wrap(err, "spec.architecture"))
583586
}
584587
if err := s.Gateway.Validate(); err != nil {
585-
return errors.WithStack(errors.Wrap(err, "spec.architecture"))
588+
return errors.WithStack(errors.Wrap(err, "spec.gateway"))
589+
}
590+
if err := s.Integration.Validate(); err != nil {
591+
return errors.WithStack(errors.Wrap(err, "spec.integration"))
586592
}
587593
return nil
588594
}

pkg/apis/deployment/v1/deployment_spec_gateway.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
package v1
2222

2323
import (
24-
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
25-
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
2624
"github.com/arangodb/kube-arangodb/pkg/util"
2725
)
2826

@@ -40,9 +38,6 @@ type DeploymentSpecGateway struct {
4038
// Image is the image to use for the gateway.
4139
// By default, the image is determined by the operator.
4240
Image *string `json:"image"`
43-
44-
// Sidecar define the integration sidecar spec
45-
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
4641
}
4742

4843
// IsEnabled returns whether the gateway is enabled.
@@ -63,22 +58,9 @@ func (d *DeploymentSpecGateway) IsDynamic() bool {
6358
return *d.Dynamic
6459
}
6560

66-
func (d *DeploymentSpecGateway) GetSidecar() *schedulerIntegrationApi.Sidecar {
67-
if d == nil || d.Sidecar == nil {
68-
return nil
69-
}
70-
return d.Sidecar
71-
}
72-
7361
// Validate the given spec
7462
func (d *DeploymentSpecGateway) Validate() error {
75-
if d == nil {
76-
d = &DeploymentSpecGateway{}
77-
}
78-
79-
return shared.WithErrors(
80-
shared.PrefixResourceErrors("integrationSidecar", d.GetSidecar().Validate()),
81-
)
63+
return nil
8264
}
8365

8466
// GetImage returns the image to use for the gateway.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
25+
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
26+
)
27+
28+
type DeploymentSpecIntegration struct {
29+
// Sidecar define the integration sidecar spec
30+
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
31+
}
32+
33+
func (d *DeploymentSpecIntegration) GetSidecar() *schedulerIntegrationApi.Sidecar {
34+
if d == nil || d.Sidecar == nil {
35+
return nil
36+
}
37+
return d.Sidecar
38+
}
39+
40+
// Validate the given spec
41+
func (d *DeploymentSpecIntegration) Validate() error {
42+
if d == nil {
43+
d = &DeploymentSpecIntegration{}
44+
}
45+
46+
return shared.WithErrors(
47+
shared.PrefixResourceErrors("sidecar", d.GetSidecar().Validate()),
48+
)
49+
}

pkg/apis/deployment/v1/zz_generated.deepcopy.go

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

pkg/apis/deployment/v2alpha1/deployment_spec.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ type DeploymentSpec struct {
262262

263263
// Gateway defined main Gateway configuration.
264264
Gateway *DeploymentSpecGateway `json:"gateway,omitempty"`
265+
266+
// Integration defined main Integration configuration.
267+
Integration *DeploymentSpecIntegration `json:"integration,omitempty"`
265268
}
266269

267270
// GetAllowMemberRecreation returns member recreation policy based on group and settings
@@ -582,7 +585,10 @@ func (s *DeploymentSpec) Validate() error {
582585
return errors.WithStack(errors.Wrap(err, "spec.architecture"))
583586
}
584587
if err := s.Gateway.Validate(); err != nil {
585-
return errors.WithStack(errors.Wrap(err, "spec.architecture"))
588+
return errors.WithStack(errors.Wrap(err, "spec.gateway"))
589+
}
590+
if err := s.Integration.Validate(); err != nil {
591+
return errors.WithStack(errors.Wrap(err, "spec.integration"))
586592
}
587593
return nil
588594
}

pkg/apis/deployment/v2alpha1/deployment_spec_gateway.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
package v2alpha1
2222

2323
import (
24-
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
25-
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
2624
"github.com/arangodb/kube-arangodb/pkg/util"
2725
)
2826

@@ -40,9 +38,6 @@ type DeploymentSpecGateway struct {
4038
// Image is the image to use for the gateway.
4139
// By default, the image is determined by the operator.
4240
Image *string `json:"image"`
43-
44-
// Sidecar define the integration sidecar spec
45-
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
4641
}
4742

4843
// IsEnabled returns whether the gateway is enabled.
@@ -63,22 +58,9 @@ func (d *DeploymentSpecGateway) IsDynamic() bool {
6358
return *d.Dynamic
6459
}
6560

66-
func (d *DeploymentSpecGateway) GetSidecar() *schedulerIntegrationApi.Sidecar {
67-
if d == nil || d.Sidecar == nil {
68-
return nil
69-
}
70-
return d.Sidecar
71-
}
72-
7361
// Validate the given spec
7462
func (d *DeploymentSpecGateway) Validate() error {
75-
if d == nil {
76-
d = &DeploymentSpecGateway{}
77-
}
78-
79-
return shared.WithErrors(
80-
shared.PrefixResourceErrors("integrationSidecar", d.GetSidecar().Validate()),
81-
)
63+
return nil
8264
}
8365

8466
// GetImage returns the image to use for the gateway.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 v2alpha1
22+
23+
import (
24+
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
25+
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
26+
)
27+
28+
type DeploymentSpecIntegration struct {
29+
// Sidecar define the integration sidecar spec
30+
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
31+
}
32+
33+
func (d *DeploymentSpecIntegration) GetSidecar() *schedulerIntegrationApi.Sidecar {
34+
if d == nil || d.Sidecar == nil {
35+
return nil
36+
}
37+
return d.Sidecar
38+
}
39+
40+
// Validate the given spec
41+
func (d *DeploymentSpecIntegration) Validate() error {
42+
if d == nil {
43+
d = &DeploymentSpecIntegration{}
44+
}
45+
46+
return shared.WithErrors(
47+
shared.PrefixResourceErrors("sidecar", d.GetSidecar().Validate()),
48+
)
49+
}

pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)