mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Improvement] Arango Kubernetes Client Mod Implementation (#1157)
This commit is contained in:
parent
5f1efa2ffa
commit
3bd456e9e3
8 changed files with 394 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
|||
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
|
||||
- (Improvement) Bump dependencies
|
||||
- (Documentation) (1.3.0) EE & CE Definitions
|
||||
- (Improvement) Arango Kubernetes Client Mod Implementation
|
||||
|
||||
## [1.2.20](https://github.com/arangodb/kube-arangodb/tree/1.2.20) (2022-10-25)
|
||||
- (Feature) Add action progress
|
||||
|
|
35
pkg/deployment/resources/inspector/acs_mod.go
Normal file
35
pkg/deployment/resources/inspector/acs_mod.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// 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 inspector
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/mods"
|
||||
)
|
||||
|
||||
func (i *inspectorState) ArangoClusterSynchronizationModInterface() mods.ArangoClusterSynchronizationMods {
|
||||
return arangoClusterSynchronizationMod{
|
||||
i: i,
|
||||
}
|
||||
}
|
||||
|
||||
type arangoClusterSynchronizationMod struct {
|
||||
i *inspectorState
|
||||
}
|
89
pkg/deployment/resources/inspector/acs_mod_v1.go
Normal file
89
pkg/deployment/resources/inspector/acs_mod_v1.go
Normal file
|
@ -0,0 +1,89 @@
|
|||
//
|
||||
// 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 inspector
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
typedApi "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/deployment/v1"
|
||||
arangoclustersynchronizationv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization/v1"
|
||||
)
|
||||
|
||||
func (p arangoClusterSynchronizationMod) V1() arangoclustersynchronizationv1.ModInterface {
|
||||
return arangoClusterSynchronizationModV1(p)
|
||||
}
|
||||
|
||||
type arangoClusterSynchronizationModV1 struct {
|
||||
i *inspectorState
|
||||
}
|
||||
|
||||
func (p arangoClusterSynchronizationModV1) client() typedApi.ArangoClusterSynchronizationInterface {
|
||||
return p.i.Client().Arango().DatabaseV1().ArangoClusterSynchronizations(p.i.Namespace())
|
||||
}
|
||||
|
||||
func (p arangoClusterSynchronizationModV1) Create(ctx context.Context, endpoint *api.ArangoClusterSynchronization, opts meta.CreateOptions) (*api.ArangoClusterSynchronization, error) {
|
||||
if endpoint, err := p.client().Create(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoClusterSynchronization().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoClusterSynchronizationModV1) Update(ctx context.Context, endpoint *api.ArangoClusterSynchronization, opts meta.UpdateOptions) (*api.ArangoClusterSynchronization, error) {
|
||||
if endpoint, err := p.client().Update(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoClusterSynchronization().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoClusterSynchronizationModV1) UpdateStatus(ctx context.Context, endpoint *api.ArangoClusterSynchronization, opts meta.UpdateOptions) (*api.ArangoClusterSynchronization, error) {
|
||||
if endpoint, err := p.client().UpdateStatus(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoClusterSynchronization().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoClusterSynchronizationModV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result *api.ArangoClusterSynchronization, err error) {
|
||||
if endpoint, err := p.client().Patch(ctx, name, pt, data, opts, subresources...); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoClusterSynchronization().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoClusterSynchronizationModV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
|
||||
if err := p.client().Delete(ctx, name, opts); err != nil {
|
||||
return err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoClusterSynchronization().Invalidate()
|
||||
return err
|
||||
}
|
||||
}
|
35
pkg/deployment/resources/inspector/am_mod.go
Normal file
35
pkg/deployment/resources/inspector/am_mod.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// 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 inspector
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/mods"
|
||||
)
|
||||
|
||||
func (i *inspectorState) ArangoMemberModInterface() mods.ArangoMemberMods {
|
||||
return arangoMemberMod{
|
||||
i: i,
|
||||
}
|
||||
}
|
||||
|
||||
type arangoMemberMod struct {
|
||||
i *inspectorState
|
||||
}
|
89
pkg/deployment/resources/inspector/am_mod_v1.go
Normal file
89
pkg/deployment/resources/inspector/am_mod_v1.go
Normal file
|
@ -0,0 +1,89 @@
|
|||
//
|
||||
// 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 inspector
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
typedApi "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/deployment/v1"
|
||||
arangomemberv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember/v1"
|
||||
)
|
||||
|
||||
func (p arangoMemberMod) V1() arangomemberv1.ModInterface {
|
||||
return arangoMemberModV1(p)
|
||||
}
|
||||
|
||||
type arangoMemberModV1 struct {
|
||||
i *inspectorState
|
||||
}
|
||||
|
||||
func (p arangoMemberModV1) client() typedApi.ArangoMemberInterface {
|
||||
return p.i.Client().Arango().DatabaseV1().ArangoMembers(p.i.Namespace())
|
||||
}
|
||||
|
||||
func (p arangoMemberModV1) Create(ctx context.Context, endpoint *api.ArangoMember, opts meta.CreateOptions) (*api.ArangoMember, error) {
|
||||
if endpoint, err := p.client().Create(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoMember().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoMemberModV1) Update(ctx context.Context, endpoint *api.ArangoMember, opts meta.UpdateOptions) (*api.ArangoMember, error) {
|
||||
if endpoint, err := p.client().Update(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoMember().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoMemberModV1) UpdateStatus(ctx context.Context, endpoint *api.ArangoMember, opts meta.UpdateOptions) (*api.ArangoMember, error) {
|
||||
if endpoint, err := p.client().UpdateStatus(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoMember().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoMemberModV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result *api.ArangoMember, err error) {
|
||||
if endpoint, err := p.client().Patch(ctx, name, pt, data, opts, subresources...); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoMember().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoMemberModV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
|
||||
if err := p.client().Delete(ctx, name, opts); err != nil {
|
||||
return err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoMember().Invalidate()
|
||||
return err
|
||||
}
|
||||
}
|
35
pkg/deployment/resources/inspector/at_mod.go
Normal file
35
pkg/deployment/resources/inspector/at_mod.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// 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 inspector
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/mods"
|
||||
)
|
||||
|
||||
func (i *inspectorState) ArangoTaskModInterface() mods.ArangoTaskMods {
|
||||
return arangoTaskMod{
|
||||
i: i,
|
||||
}
|
||||
}
|
||||
|
||||
type arangoTaskMod struct {
|
||||
i *inspectorState
|
||||
}
|
89
pkg/deployment/resources/inspector/at_mod_v1.go
Normal file
89
pkg/deployment/resources/inspector/at_mod_v1.go
Normal file
|
@ -0,0 +1,89 @@
|
|||
//
|
||||
// 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 inspector
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
typedApi "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/deployment/v1"
|
||||
arangotaskv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask/v1"
|
||||
)
|
||||
|
||||
func (p arangoTaskMod) V1() arangotaskv1.ModInterface {
|
||||
return arangoTaskModV1(p)
|
||||
}
|
||||
|
||||
type arangoTaskModV1 struct {
|
||||
i *inspectorState
|
||||
}
|
||||
|
||||
func (p arangoTaskModV1) client() typedApi.ArangoTaskInterface {
|
||||
return p.i.Client().Arango().DatabaseV1().ArangoTasks(p.i.Namespace())
|
||||
}
|
||||
|
||||
func (p arangoTaskModV1) Create(ctx context.Context, endpoint *api.ArangoTask, opts meta.CreateOptions) (*api.ArangoTask, error) {
|
||||
if endpoint, err := p.client().Create(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoTask().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoTaskModV1) Update(ctx context.Context, endpoint *api.ArangoTask, opts meta.UpdateOptions) (*api.ArangoTask, error) {
|
||||
if endpoint, err := p.client().Update(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoTask().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoTaskModV1) UpdateStatus(ctx context.Context, endpoint *api.ArangoTask, opts meta.UpdateOptions) (*api.ArangoTask, error) {
|
||||
if endpoint, err := p.client().UpdateStatus(ctx, endpoint, opts); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoTask().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoTaskModV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result *api.ArangoTask, err error) {
|
||||
if endpoint, err := p.client().Patch(ctx, name, pt, data, opts, subresources...); err != nil {
|
||||
return endpoint, err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoTask().Invalidate()
|
||||
return endpoint, err
|
||||
}
|
||||
}
|
||||
|
||||
func (p arangoTaskModV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
|
||||
if err := p.client().Delete(ctx, name, opts); err != nil {
|
||||
return err
|
||||
} else {
|
||||
p.i.GetThrottles().ArangoTask().Invalidate()
|
||||
return err
|
||||
}
|
||||
}
|
|
@ -21,11 +21,14 @@
|
|||
package mods
|
||||
|
||||
import (
|
||||
arangoclustersynchronizationv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization/v1"
|
||||
arangomemberv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember/v1"
|
||||
arangotaskv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask/v1"
|
||||
endpointsv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/endpoints/v1"
|
||||
persistentvolumeclaimv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/persistentvolumeclaim/v1"
|
||||
podv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/pod/v1"
|
||||
poddisruptionbudgetv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget/v1beta1"
|
||||
poddisruptionbudgetv1beta1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget/v1beta1"
|
||||
secretv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/secret/v1"
|
||||
servicev1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/service/v1"
|
||||
serviceaccountv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/serviceaccount/v1"
|
||||
|
@ -62,7 +65,19 @@ type ServiceMonitorsMods interface {
|
|||
|
||||
type PodDisruptionBudgetsMods interface {
|
||||
V1() poddisruptionbudgetv1.ModInterface
|
||||
V1Beta1() v1beta1.ModInterface
|
||||
V1Beta1() poddisruptionbudgetv1beta1.ModInterface
|
||||
}
|
||||
|
||||
type ArangoMemberMods interface {
|
||||
V1() arangomemberv1.ModInterface
|
||||
}
|
||||
|
||||
type ArangoTaskMods interface {
|
||||
V1() arangotaskv1.ModInterface
|
||||
}
|
||||
|
||||
type ArangoClusterSynchronizationMods interface {
|
||||
V1() arangoclustersynchronizationv1.ModInterface
|
||||
}
|
||||
|
||||
type Mods interface {
|
||||
|
@ -74,4 +89,8 @@ type Mods interface {
|
|||
EndpointsModInterface() EndpointsMods
|
||||
ServiceMonitorsModInterface() ServiceMonitorsMods
|
||||
PodDisruptionBudgetsModInterface() PodDisruptionBudgetsMods
|
||||
|
||||
ArangoMemberModInterface() ArangoMemberMods
|
||||
ArangoTaskModInterface() ArangoTaskMods
|
||||
ArangoClusterSynchronizationModInterface() ArangoClusterSynchronizationMods
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue