Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] [Scheduler] Extract Integration #1723

Merged
merged 1 commit into from
Sep 12, 2024
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
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