Skip to content

Commit

Permalink
[Feature] [Scheduler] Extract Integration (#1723)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanikow authored Sep 12, 2024
1 parent 0d61081 commit c5ffe86
Show file tree
Hide file tree
Showing 29 changed files with 2,405 additions and 1,981 deletions.
414 changes: 207 additions & 207 deletions docs/api/ArangoDeployment.V1.md

Large diffs are not rendered by default.

116 changes: 58 additions & 58 deletions docs/cli/arangodb_operator_integration.md

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion pkg/apis/deployment/v1/deployment_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ type DeploymentSpec struct {

// Gateway defined main Gateway configuration.
Gateway *DeploymentSpecGateway `json:"gateway,omitempty"`

// Integration defined main Integration configuration.
Integration *DeploymentSpecIntegration `json:"integration,omitempty"`
}

// GetAllowMemberRecreation returns member recreation policy based on group and settings
Expand Down Expand Up @@ -582,7 +585,10 @@ func (s *DeploymentSpec) Validate() error {
return errors.WithStack(errors.Wrap(err, "spec.architecture"))
}
if err := s.Gateway.Validate(); err != nil {
return errors.WithStack(errors.Wrap(err, "spec.architecture"))
return errors.WithStack(errors.Wrap(err, "spec.gateway"))
}
if err := s.Integration.Validate(); err != nil {
return errors.WithStack(errors.Wrap(err, "spec.integration"))
}
return nil
}
Expand Down
20 changes: 1 addition & 19 deletions pkg/apis/deployment/v1/deployment_spec_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
package v1

import (
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
)

Expand All @@ -40,9 +38,6 @@ type DeploymentSpecGateway struct {
// Image is the image to use for the gateway.
// By default, the image is determined by the operator.
Image *string `json:"image"`

// Sidecar define the integration sidecar spec
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
}

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

func (d *DeploymentSpecGateway) GetSidecar() *schedulerIntegrationApi.Sidecar {
if d == nil || d.Sidecar == nil {
return nil
}
return d.Sidecar
}

// Validate the given spec
func (d *DeploymentSpecGateway) Validate() error {
if d == nil {
d = &DeploymentSpecGateway{}
}

return shared.WithErrors(
shared.PrefixResourceErrors("integrationSidecar", d.GetSidecar().Validate()),
)
return nil
}

// GetImage returns the image to use for the gateway.
Expand Down
49 changes: 49 additions & 0 deletions pkg/apis/deployment/v1/deployment_spec_integration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// DISCLAIMER
//
// Copyright 2024 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 (
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
)

type DeploymentSpecIntegration struct {
// Sidecar define the integration sidecar spec
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
}

func (d *DeploymentSpecIntegration) GetSidecar() *schedulerIntegrationApi.Sidecar {
if d == nil || d.Sidecar == nil {
return nil
}
return d.Sidecar
}

// Validate the given spec
func (d *DeploymentSpecIntegration) Validate() error {
if d == nil {
d = &DeploymentSpecIntegration{}
}

return shared.WithErrors(
shared.PrefixResourceErrors("sidecar", d.GetSidecar().Validate()),
)
}
27 changes: 24 additions & 3 deletions pkg/apis/deployment/v1/zz_generated.deepcopy.go

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

8 changes: 7 additions & 1 deletion pkg/apis/deployment/v2alpha1/deployment_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ type DeploymentSpec struct {

// Gateway defined main Gateway configuration.
Gateway *DeploymentSpecGateway `json:"gateway,omitempty"`

// Integration defined main Integration configuration.
Integration *DeploymentSpecIntegration `json:"integration,omitempty"`
}

// GetAllowMemberRecreation returns member recreation policy based on group and settings
Expand Down Expand Up @@ -582,7 +585,10 @@ func (s *DeploymentSpec) Validate() error {
return errors.WithStack(errors.Wrap(err, "spec.architecture"))
}
if err := s.Gateway.Validate(); err != nil {
return errors.WithStack(errors.Wrap(err, "spec.architecture"))
return errors.WithStack(errors.Wrap(err, "spec.gateway"))
}
if err := s.Integration.Validate(); err != nil {
return errors.WithStack(errors.Wrap(err, "spec.integration"))
}
return nil
}
Expand Down
20 changes: 1 addition & 19 deletions pkg/apis/deployment/v2alpha1/deployment_spec_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
package v2alpha1

import (
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
)

Expand All @@ -40,9 +38,6 @@ type DeploymentSpecGateway struct {
// Image is the image to use for the gateway.
// By default, the image is determined by the operator.
Image *string `json:"image"`

// Sidecar define the integration sidecar spec
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
}

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

func (d *DeploymentSpecGateway) GetSidecar() *schedulerIntegrationApi.Sidecar {
if d == nil || d.Sidecar == nil {
return nil
}
return d.Sidecar
}

// Validate the given spec
func (d *DeploymentSpecGateway) Validate() error {
if d == nil {
d = &DeploymentSpecGateway{}
}

return shared.WithErrors(
shared.PrefixResourceErrors("integrationSidecar", d.GetSidecar().Validate()),
)
return nil
}

// GetImage returns the image to use for the gateway.
Expand Down
49 changes: 49 additions & 0 deletions pkg/apis/deployment/v2alpha1/deployment_spec_integration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// DISCLAIMER
//
// Copyright 2024 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 v2alpha1

import (
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
)

type DeploymentSpecIntegration struct {
// Sidecar define the integration sidecar spec
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
}

func (d *DeploymentSpecIntegration) GetSidecar() *schedulerIntegrationApi.Sidecar {
if d == nil || d.Sidecar == nil {
return nil
}
return d.Sidecar
}

// Validate the given spec
func (d *DeploymentSpecIntegration) Validate() error {
if d == nil {
d = &DeploymentSpecIntegration{}
}

return shared.WithErrors(
shared.PrefixResourceErrors("sidecar", d.GetSidecar().Validate()),
)
}
27 changes: 24 additions & 3 deletions pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit c5ffe86

Please sign in to comment.