1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Improvement] Add Anonymous Inspector mods (#1189)

This commit is contained in:
Adam Janikowski 2022-11-22 12:09:14 +01:00 committed by GitHub
parent 5da91de9e6
commit 120f926e08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 491 additions and 36 deletions

View file

@ -24,6 +24,7 @@
- (Improvement) Improve error message when replication can't be configured
- (Bugfix) Fix License handling in case of broken license secret
- (Bugfix) Check ArangoSync availability without checking healthiness
- (Improvement) Add Anonymous Inspector mods
## [1.2.20](https://github.com/arangodb/kube-arangodb/tree/1.2.20) (2022-10-25)
- (Feature) Add action progress

View file

@ -35,7 +35,7 @@ func (p *arangoClusterSynchronizationsInspector) Anonymous(gvk schema.GroupVersi
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &arangoClusterSynchronizationsInspectorAnonymousV1{i: p.v1}, true
return &arangoClusterSynchronizationsInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -24,12 +24,47 @@ 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"
)
type arangoClusterSynchronizationsInspectorAnonymousV1 struct {
i *arangoClusterSynchronizationsInspectorV1
i *inspectorState
}
func (e *arangoClusterSynchronizationsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.arangoClusterSynchronizations.v1.Get(ctx, name, opts)
}
func (e *arangoClusterSynchronizationsInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoClusterSynchronization); !ok {
return nil, newInvalidTypeError(ArangoClusterSynchronizationGKv1())
} else {
return e.i.ArangoClusterSynchronizationModInterface().V1().Create(ctx, o, opts)
}
}
func (e *arangoClusterSynchronizationsInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoClusterSynchronization); !ok {
return nil, newInvalidTypeError(ArangoClusterSynchronizationGKv1())
} else {
return e.i.ArangoClusterSynchronizationModInterface().V1().Update(ctx, o, opts)
}
}
func (e *arangoClusterSynchronizationsInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoClusterSynchronization); !ok {
return nil, newInvalidTypeError(ArangoClusterSynchronizationGKv1())
} else {
return e.i.ArangoClusterSynchronizationModInterface().V1().UpdateStatus(ctx, o, opts)
}
}
func (e *arangoClusterSynchronizationsInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.ArangoClusterSynchronizationModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *arangoClusterSynchronizationsInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.ArangoClusterSynchronizationModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *arangoMembersInspector) Anonymous(gvk schema.GroupVersionKind) (anonymo
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &arangoMembersInspectorAnonymousV1{i: p.v1}, true
return &arangoMembersInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -24,12 +24,47 @@ 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"
)
type arangoMembersInspectorAnonymousV1 struct {
i *arangoMembersInspectorV1
i *inspectorState
}
func (e *arangoMembersInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.arangoMembers.v1.Get(ctx, name, opts)
}
func (e *arangoMembersInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoMember); !ok {
return nil, newInvalidTypeError(ArangoMemberGKv1())
} else {
return e.i.ArangoMemberModInterface().V1().Create(ctx, o, opts)
}
}
func (e *arangoMembersInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoMember); !ok {
return nil, newInvalidTypeError(ArangoMemberGKv1())
} else {
return e.i.ArangoMemberModInterface().V1().Update(ctx, o, opts)
}
}
func (e *arangoMembersInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoMember); !ok {
return nil, newInvalidTypeError(ArangoMemberGKv1())
} else {
return e.i.ArangoMemberModInterface().V1().UpdateStatus(ctx, o, opts)
}
}
func (e *arangoMembersInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.ArangoMemberModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *arangoMembersInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.ArangoMemberModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *arangoTasksInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &arangoTasksInspectorAnonymousV1{i: p.v1}, true
return &arangoTasksInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -24,12 +24,47 @@ 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"
)
type arangoTasksInspectorAnonymousV1 struct {
i *arangoTasksInspectorV1
i *inspectorState
}
func (e *arangoTasksInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.arangoTasks.v1.Get(ctx, name, opts)
}
func (e *arangoTasksInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoTask); !ok {
return nil, newInvalidTypeError(ArangoTaskGKv1())
} else {
return e.i.ArangoTaskModInterface().V1().Create(ctx, o, opts)
}
}
func (e *arangoTasksInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoTask); !ok {
return nil, newInvalidTypeError(ArangoTaskGKv1())
} else {
return e.i.ArangoTaskModInterface().V1().Update(ctx, o, opts)
}
}
func (e *arangoTasksInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*api.ArangoTask); !ok {
return nil, newInvalidTypeError(ArangoTaskGKv1())
} else {
return e.i.ArangoTaskModInterface().V1().UpdateStatus(ctx, o, opts)
}
}
func (e *arangoTasksInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.ArangoTaskModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *arangoTasksInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.ArangoTaskModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *endpointsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.I
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &endpointsInspectorAnonymousV1{i: p.v1}, true
return &endpointsInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type endpointsInspectorAnonymousV1 struct {
i *endpointsInspectorV1
i *inspectorState
}
func (e *endpointsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.endpoints.v1.Get(ctx, name, opts)
}
func (e *endpointsInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*core.Endpoints); !ok {
return nil, newInvalidTypeError(EndpointsGKv1())
} else {
return e.i.EndpointsModInterface().V1().Create(ctx, o, opts)
}
}
func (e *endpointsInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*core.Endpoints); !ok {
return nil, newInvalidTypeError(EndpointsGKv1())
} else {
return e.i.EndpointsModInterface().V1().Update(ctx, o, opts)
}
}
func (e *endpointsInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(EndpointsGKv1())
}
func (e *endpointsInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.EndpointsModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *endpointsInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.EndpointsModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -0,0 +1,51 @@
//
// 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 (
"fmt"
"k8s.io/apimachinery/pkg/runtime/schema"
)
func newNotImplementedError(gvk schema.GroupVersionKind) error {
return notImplementedError{gvk: gvk}
}
type notImplementedError struct {
gvk schema.GroupVersionKind
}
func (n notImplementedError) Error() string {
return fmt.Sprintf("Action is not implemented for %s", n.gvk.String())
}
func newInvalidTypeError(gvk schema.GroupVersionKind) error {
return invalidTypeError{gvk: gvk}
}
type invalidTypeError struct {
gvk schema.GroupVersionKind
}
func (n invalidTypeError) Error() string {
return fmt.Sprintf("Type is invalid for %s", n.gvk.String())
}

View file

@ -24,6 +24,7 @@ import (
"context"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type nodesInspectorAnonymousV1 struct {
@ -33,3 +34,23 @@ type nodesInspectorAnonymousV1 struct {
func (e *nodesInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
}
func (e *nodesInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
return nil, newNotImplementedError(NodeGKv1())
}
func (e *nodesInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(NodeGKv1())
}
func (e *nodesInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(NodeGKv1())
}
func (e *nodesInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return nil, newNotImplementedError(NodeGKv1())
}
func (e *nodesInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return newNotImplementedError(NodeGKv1())
}

View file

@ -35,12 +35,12 @@ func (p *podDisruptionBudgetsInspector) Anonymous(gvk schema.GroupVersionKind) (
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &podDisruptionBudgetsInspectorAnonymousV1{i: p.v1}, true
return &podDisruptionBudgetsInspectorAnonymousV1{i: p.state}, true
case PodDisruptionBudgetVersionV1Beta1:
if p.v1beta1 == nil || p.v1beta1.err != nil {
return nil, false
}
return &podDisruptionBudgetsInspectorAnonymousV1Beta1{i: p.v1beta1}, true
return &podDisruptionBudgetsInspectorAnonymousV1Beta1{i: p.state}, true
}
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
policyv1 "k8s.io/api/policy/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type podDisruptionBudgetsInspectorAnonymousV1 struct {
i *podDisruptionBudgetsInspectorV1
i *inspectorState
}
func (e *podDisruptionBudgetsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.podDisruptionBudgets.v1.Get(ctx, name, opts)
}
func (e *podDisruptionBudgetsInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*policyv1.PodDisruptionBudget); !ok {
return nil, newInvalidTypeError(PodDisruptionBudgetGKv1())
} else {
return e.i.PodDisruptionBudgetsModInterface().V1().Create(ctx, o, opts)
}
}
func (e *podDisruptionBudgetsInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*policyv1.PodDisruptionBudget); !ok {
return nil, newInvalidTypeError(PodDisruptionBudgetGKv1())
} else {
return e.i.PodDisruptionBudgetsModInterface().V1().Update(ctx, o, opts)
}
}
func (e *podDisruptionBudgetsInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(PodDisruptionBudgetGKv1())
}
func (e *podDisruptionBudgetsInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.PodDisruptionBudgetsModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *podDisruptionBudgetsInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.PodDisruptionBudgetsModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
policyv1beta1 "k8s.io/api/policy/v1beta1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type podDisruptionBudgetsInspectorAnonymousV1Beta1 struct {
i *podDisruptionBudgetsInspectorV1Beta1
i *inspectorState
}
func (e *podDisruptionBudgetsInspectorAnonymousV1Beta1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.podDisruptionBudgets.v1beta1.Get(ctx, name, opts)
}
func (e *podDisruptionBudgetsInspectorAnonymousV1Beta1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*policyv1beta1.PodDisruptionBudget); !ok {
return nil, newInvalidTypeError(PodDisruptionBudgetGKv1Beta1())
} else {
return e.i.PodDisruptionBudgetsModInterface().V1Beta1().Create(ctx, o, opts)
}
}
func (e *podDisruptionBudgetsInspectorAnonymousV1Beta1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*policyv1beta1.PodDisruptionBudget); !ok {
return nil, newInvalidTypeError(PodDisruptionBudgetGKv1Beta1())
} else {
return e.i.PodDisruptionBudgetsModInterface().V1Beta1().Update(ctx, o, opts)
}
}
func (e *podDisruptionBudgetsInspectorAnonymousV1Beta1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(PodDisruptionBudgetGKv1Beta1())
}
func (e *podDisruptionBudgetsInspectorAnonymousV1Beta1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.PodDisruptionBudgetsModInterface().V1Beta1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *podDisruptionBudgetsInspectorAnonymousV1Beta1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.PodDisruptionBudgetsModInterface().V1Beta1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *podsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interf
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &podsInspectorAnonymousV1{i: p.v1}, true
return &podsInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type podsInspectorAnonymousV1 struct {
i *podsInspectorV1
i *inspectorState
}
func (e *podsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.pods.v1.Get(ctx, name, opts)
}
func (e *podsInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*core.Pod); !ok {
return nil, newInvalidTypeError(PodGKv1())
} else {
return e.i.PodsModInterface().V1().Create(ctx, o, opts)
}
}
func (e *podsInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*core.Pod); !ok {
return nil, newInvalidTypeError(PodGKv1())
} else {
return e.i.PodsModInterface().V1().Update(ctx, o, opts)
}
}
func (e *podsInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(PodGKv1())
}
func (e *podsInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.PodsModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *podsInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.PodsModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *persistentVolumeClaimsInspector) Anonymous(gvk schema.GroupVersionKind)
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &persistentVolumeClaimsInspectorAnonymousV1{i: p.v1}, true
return &persistentVolumeClaimsInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type persistentVolumeClaimsInspectorAnonymousV1 struct {
i *persistentVolumeClaimsInspectorV1
i *inspectorState
}
func (e *persistentVolumeClaimsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.persistentVolumeClaims.v1.Get(ctx, name, opts)
}
func (e *persistentVolumeClaimsInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*core.PersistentVolumeClaim); !ok {
return nil, newInvalidTypeError(PersistentVolumeClaimGKv1())
} else {
return e.i.PersistentVolumeClaimsModInterface().V1().Create(ctx, o, opts)
}
}
func (e *persistentVolumeClaimsInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*core.PersistentVolumeClaim); !ok {
return nil, newInvalidTypeError(PersistentVolumeClaimGKv1())
} else {
return e.i.PersistentVolumeClaimsModInterface().V1().Update(ctx, o, opts)
}
}
func (e *persistentVolumeClaimsInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(PersistentVolumeClaimGKv1())
}
func (e *persistentVolumeClaimsInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.PersistentVolumeClaimsModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *persistentVolumeClaimsInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.PersistentVolumeClaimsModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *serviceAccountsInspector) Anonymous(gvk schema.GroupVersionKind) (anony
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &serviceAccountsInspectorAnonymousV1{i: p.v1}, true
return &serviceAccountsInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type serviceAccountsInspectorAnonymousV1 struct {
i *serviceAccountsInspectorV1
i *inspectorState
}
func (e *serviceAccountsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.serviceAccounts.v1.Get(ctx, name, opts)
}
func (e *serviceAccountsInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*core.ServiceAccount); !ok {
return nil, newInvalidTypeError(ServiceAccountGKv1())
} else {
return e.i.ServiceAccountsModInterface().V1().Create(ctx, o, opts)
}
}
func (e *serviceAccountsInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*core.ServiceAccount); !ok {
return nil, newInvalidTypeError(ServiceAccountGKv1())
} else {
return e.i.ServiceAccountsModInterface().V1().Update(ctx, o, opts)
}
}
func (e *serviceAccountsInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(ServiceAccountGKv1())
}
func (e *serviceAccountsInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.ServiceAccountsModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *serviceAccountsInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.ServiceAccountsModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *secretsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Int
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &secretsInspectorAnonymousV1{i: p.v1}, true
return &secretsInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type secretsInspectorAnonymousV1 struct {
i *secretsInspectorV1
i *inspectorState
}
func (e *secretsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.secrets.v1.Get(ctx, name, opts)
}
func (e *secretsInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*core.Secret); !ok {
return nil, newInvalidTypeError(SecretGKv1())
} else {
return e.i.SecretsModInterface().V1().Create(ctx, o, opts)
}
}
func (e *secretsInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*core.Secret); !ok {
return nil, newInvalidTypeError(SecretGKv1())
} else {
return e.i.SecretsModInterface().V1().Update(ctx, o, opts)
}
}
func (e *secretsInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(SecretGKv1())
}
func (e *secretsInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.SecretsModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *secretsInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.SecretsModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *servicesInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.In
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &servicesInspectorAnonymousV1{i: p.v1}, true
return &servicesInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type servicesInspectorAnonymousV1 struct {
i *servicesInspectorV1
i *inspectorState
}
func (e *servicesInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.services.v1.Get(ctx, name, opts)
}
func (e *servicesInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*core.Service); !ok {
return nil, newInvalidTypeError(ServiceGKv1())
} else {
return e.i.ServicesModInterface().V1().Create(ctx, o, opts)
}
}
func (e *servicesInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*core.Service); !ok {
return nil, newInvalidTypeError(ServiceGKv1())
} else {
return e.i.ServicesModInterface().V1().Update(ctx, o, opts)
}
}
func (e *servicesInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(ServiceGKv1())
}
func (e *servicesInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.ServicesModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *servicesInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.ServicesModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -35,7 +35,7 @@ func (p *serviceMonitorsInspector) Anonymous(gvk schema.GroupVersionKind) (anony
if p.v1 == nil || p.v1.err != nil {
return nil, false
}
return &serviceMonitorsInspectorAnonymousV1{i: p.v1}, true
return &serviceMonitorsInspectorAnonymousV1{i: p.state}, true
}
}

View file

@ -23,13 +23,43 @@ package inspector
import (
"context"
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
)
type serviceMonitorsInspectorAnonymousV1 struct {
i *serviceMonitorsInspectorV1
i *inspectorState
}
func (e *serviceMonitorsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
return e.i.Get(ctx, name, opts)
return e.i.serviceMonitors.v1.Get(ctx, name, opts)
}
func (e *serviceMonitorsInspectorAnonymousV1) Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error) {
if o, ok := obj.(*monitoring.ServiceMonitor); !ok {
return nil, newInvalidTypeError(ServiceMonitorGKv1())
} else {
return e.i.ServiceMonitorsModInterface().V1().Create(ctx, o, opts)
}
}
func (e *serviceMonitorsInspectorAnonymousV1) Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
if o, ok := obj.(*monitoring.ServiceMonitor); !ok {
return nil, newInvalidTypeError(ServiceMonitorGKv1())
} else {
return e.i.ServiceMonitorsModInterface().V1().Update(ctx, o, opts)
}
}
func (e *serviceMonitorsInspectorAnonymousV1) UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error) {
return nil, newNotImplementedError(ServiceMonitorGKv1())
}
func (e *serviceMonitorsInspectorAnonymousV1) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error) {
return e.i.ServiceMonitorsModInterface().V1().Patch(ctx, name, pt, data, opts, subresources...)
}
func (e *serviceMonitorsInspectorAnonymousV1) Delete(ctx context.Context, name string, opts meta.DeleteOptions) error {
return e.i.ServiceMonitorsModInterface().V1().Delete(ctx, name, opts)
}

View file

@ -25,6 +25,7 @@ import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
)
type Impl interface {
@ -33,4 +34,10 @@ type Impl interface {
type Interface interface {
Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error)
Create(ctx context.Context, obj meta.Object, opts meta.CreateOptions) (meta.Object, error)
Update(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error)
UpdateStatus(ctx context.Context, obj meta.Object, opts meta.UpdateOptions) (meta.Object, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result meta.Object, err error)
Delete(ctx context.Context, name string, opts meta.DeleteOptions) error
}