8000 [Feature] [ACS] Reorganize object (#976) · sharekey/kube-arangodb@66ff115 · GitHub
[go: up one dir, main page]

8000 Skip to content

Commit 66ff115

Browse files
authored
[Feature] [ACS] Reorganize object (arangodb#976)
1 parent 16d6555 commit 66ff115

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

pkg/deployment/acs/acs.community.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,18 @@ import (
2525
"context"
2626

2727
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
28+
"github.com/arangodb/kube-arangodb/pkg/deployment/acs/sutil"
2829
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
2930
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
3031
)
3132

32-
func Inspect(ctx context.Context, deployment *api.ArangoDeployment, client kclient.Client, cachedStatus inspectorInterface.Inspector) error {
33+
func NewACS() sutil.ACS {
34+
return acs{}
35+
}
36+
37+
type acs struct {
38+
}
39+
40+
func (a acs) Inspect(ctx context.Context, deployment *api.ArangoDeployment, client kclient.Client, cachedStatus inspectorInterface.Inspector) error {
3341
return nil
3442
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2016-2022 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 sutil
22+
23+
import (
24+
"context"
25+
26+
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
27+
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
28+
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
29+
)
30+
31+
type ACS interface {
32+
Inspect(ctx context.Context, deployment *api.ArangoDeployment, client kclient.Client, cachedStatus inspectorInterface.Inspector) error
33+
}

pkg/deployment/deployment.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ import (
5353
"k8s.io/client-go/tools/record"
5454

5555
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
56+
"github.com/arangodb/kube-arangodb/pkg/deployment/acs"
57+
"github.com/arangodb/kube-arangodb/pkg/deployment/acs/sutil"
5658
"github.com/arangodb/kube-arangodb/pkg/deployment/chaos"
5759
memberState "github.com/arangodb/kube-arangodb/pkg/deployment/member"
5860
"github.com/arangodb/kube-arangodb/pkg/deployment/reconcile"
@@ -138,6 +140,7 @@ type Deployment struct {
138140
resilience *resilience.Resilience
139141
resources *resources.Resources
140142
chaosMonkey *chaos.Monkey
143+
acs sutil.ACS
141144
syncClientCache client.ClientCache
142145
haveServiceMonitorCRD bool
143146

@@ -246,6 +249,7 @@ func New(config Config, deps Dependencies, apiObject *api.ArangoDeployment) (*De
246249
stopCh: make(chan struct{}),
247250
agencyCache: agency.NewCache(apiObject.Spec.Mode),
248251
currentState: inspector.NewInspector(newDeploymentThrottle(), deps.Client, apiObject.GetNamespace(), apiObject.GetName()),
252+
acs: acs.NewACS(),
249253
}
250254

251255
d.memberState = memberState.NewStateInspector(d)

pkg/deployment/deployment_inspector.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import (
3939
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
4040

4141
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
42-
"github.com/arangodb/kube-arangodb/pkg/deployment/acs"
4342
"github.com/arangodb/kube-arangodb/pkg/metrics"
4443
"github.com/arangodb/kube-arangodb/pkg/upgrade"
4544
"github.com/arangodb/kube-arangodb/pkg/util"
@@ -178,7 +177,7 @@ func (d *Deployment) inspectDeploymentWithError(ctx context.Context, lastInterva
178177
}
179178
}
180179

181-
if err := acs.Inspect(ctx, d.apiObject, d.deps.Client, d.GetCachedStatus()); err != nil {
180+
if err := d.acs.Inspect(ctx, d.apiObject, d.deps.Client, d.GetCachedStatus()); err != nil {
182181
d.deps.Log.Warn().Err(err).Msgf("Unable to handle ACS objects")
183182
}
184183

0 commit comments

Comments
 (0)
0