mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-15 17:51:03 +00:00
[Feature] [ACS] Reorganize object (#976)
This commit is contained in:
parent
16d6555325
commit
66ff115ee1
4 changed files with 47 additions and 3 deletions
|
@ -25,10 +25,18 @@ import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||||
|
"github.com/arangodb/kube-arangodb/pkg/deployment/acs/sutil"
|
||||||
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
|
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
|
||||||
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Inspect(ctx context.Context, deployment *api.ArangoDeployment, client kclient.Client, cachedStatus inspectorInterface.Inspector) error {
|
func NewACS() sutil.ACS {
|
||||||
|
return acs{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type acs struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a acs) Inspect(ctx context.Context, deployment *api.ArangoDeployment, client kclient.Client, cachedStatus inspectorInterface.Inspector) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
33
pkg/deployment/acs/sutil/interfaces.go
Normal file
33
pkg/deployment/acs/sutil/interfaces.go
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
//
|
||||||
|
// DISCLAIMER
|
||||||
|
//
|
||||||
|
// Copyright 2016-2022 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 sutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||||
|
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
|
||||||
|
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ACS interface {
|
||||||
|
Inspect(ctx context.Context, deployment *api.ArangoDeployment, client kclient.Client, cachedStatus inspectorInterface.Inspector) error
|
||||||
|
}
|
|
@ -53,6 +53,8 @@ import (
|
||||||
"k8s.io/client-go/tools/record"
|
"k8s.io/client-go/tools/record"
|
||||||
|
|
||||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||||
|
"github.com/arangodb/kube-arangodb/pkg/deployment/acs"
|
||||||
|
"github.com/arangodb/kube-arangodb/pkg/deployment/acs/sutil"
|
||||||
"github.com/arangodb/kube-arangodb/pkg/deployment/chaos"
|
"github.com/arangodb/kube-arangodb/pkg/deployment/chaos"
|
||||||
memberState "github.com/arangodb/kube-arangodb/pkg/deployment/member"
|
memberState "github.com/arangodb/kube-arangodb/pkg/deployment/member"
|
||||||
"github.com/arangodb/kube-arangodb/pkg/deployment/reconcile"
|
"github.com/arangodb/kube-arangodb/pkg/deployment/reconcile"
|
||||||
|
@ -138,6 +140,7 @@ type Deployment struct {
|
||||||
resilience *resilience.Resilience
|
resilience *resilience.Resilience
|
||||||
resources *resources.Resources
|
resources *resources.Resources
|
||||||
chaosMonkey *chaos.Monkey
|
chaosMonkey *chaos.Monkey
|
||||||
|
acs sutil.ACS
|
||||||
syncClientCache client.ClientCache
|
syncClientCache client.ClientCache
|
||||||
haveServiceMonitorCRD bool
|
haveServiceMonitorCRD bool
|
||||||
|
|
||||||
|
@ -246,6 +249,7 @@ func New(config Config, deps Dependencies, apiObject *api.ArangoDeployment) (*De
|
||||||
stopCh: make(chan struct{}),
|
stopCh: make(chan struct{}),
|
||||||
agencyCache: agency.NewCache(apiObject.Spec.Mode),
|
agencyCache: agency.NewCache(apiObject.Spec.Mode),
|
||||||
currentState: inspector.NewInspector(newDeploymentThrottle(), deps.Client, apiObject.GetNamespace(), apiObject.GetName()),
|
currentState: inspector.NewInspector(newDeploymentThrottle(), deps.Client, apiObject.GetNamespace(), apiObject.GetName()),
|
||||||
|
acs: acs.NewACS(),
|
||||||
}
|
}
|
||||||
|
|
||||||
d.memberState = memberState.NewStateInspector(d)
|
d.memberState = memberState.NewStateInspector(d)
|
||||||
|
|
|
@ -39,7 +39,6 @@ import (
|
||||||
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||||
|
|
||||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||||
"github.com/arangodb/kube-arangodb/pkg/deployment/acs"
|
|
||||||
"github.com/arangodb/kube-arangodb/pkg/metrics"
|
"github.com/arangodb/kube-arangodb/pkg/metrics"
|
||||||
"github.com/arangodb/kube-arangodb/pkg/upgrade"
|
"github.com/arangodb/kube-arangodb/pkg/upgrade"
|
||||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||||
|
@ -178,7 +177,7 @@ func (d *Deployment) inspectDeploymentWithError(ctx context.Context, lastInterva
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := acs.Inspect(ctx, d.apiObject, d.deps.Client, d.GetCachedStatus()); err != nil {
|
if err := d.acs.Inspect(ctx, d.apiObject, d.deps.Client, d.GetCachedStatus()); err != nil {
|
||||||
d.deps.Log.Warn().Err(err).Msgf("Unable to handle ACS objects")
|
d.deps.Log.Warn().Err(err).Msgf("Unable to handle ACS objects")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue