mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Refactor] Anonymous Inspector functions (#973)
This commit is contained in:
parent
45fefbaf1a
commit
df37ed1bf8
95 changed files with 2246 additions and 164 deletions
|
@ -3,6 +3,7 @@
|
|||
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
|
||||
- (Feature) Add CoreV1 Endpoints Inspector
|
||||
- (Feature) Add Current ArangoDeployment Inspector
|
||||
- (Refactor) Anonymous inspector functions
|
||||
|
||||
## [1.2.11](https://github.com/arangodb/kube-arangodb/tree/1.2.11) (2022-04-30)
|
||||
- (Bugfix) Orphan PVC are not removed
|
||||
|
|
|
@ -26,7 +26,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
certificates "github.com/arangodb-helper/go-certificates"
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
|
@ -41,7 +41,7 @@ const (
|
|||
|
||||
// createClientAuthCACertificate creates a client authentication CA certificate and stores it in a secret with name
|
||||
// specified in the given spec.
|
||||
func createClientAuthCACertificate(ctx context.Context, log zerolog.Logger, secrets secretv1.ModInterface, spec api.SyncAuthenticationSpec, deploymentName string, ownerRef *metav1.OwnerReference) error {
|
||||
func createClientAuthCACertificate(ctx context.Context, log zerolog.Logger, secrets secretv1.ModInterface, spec api.SyncAuthenticationSpec, deploymentName string, ownerRef *meta.OwnerReference) error {
|
||||
log = log.With().Str("secret", spec.GetClientCASecretName()).Logger()
|
||||
options := certificates.CreateCertificateOptions{
|
||||
CommonName: fmt.Sprintf("%s Client Authentication Root Certificate", deploymentName),
|
||||
|
|
|
@ -38,7 +38,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
|
||||
secretv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/secret/v1"
|
||||
"github.com/rs/zerolog"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -49,7 +49,7 @@ const (
|
|||
// createTLSCACertificate creates a CA certificate and stores it in a secret with name
|
||||
// specified in the given spec.
|
||||
func createTLSCACertificate(ctx context.Context, log zerolog.Logger, secrets secretv1.ModInterface, spec api.TLSSpec,
|
||||
deploymentName string, ownerRef *metav1.OwnerReference) error {
|
||||
deploymentName string, ownerRef *meta.OwnerReference) error {
|
||||
log = log.With().Str("secret", spec.GetCASecretName()).Logger()
|
||||
|
||||
options := certificates.CreateCertificateOptions{
|
||||
|
@ -79,7 +79,7 @@ func createTLSCACertificate(ctx context.Context, log zerolog.Logger, secrets sec
|
|||
// createTLSServerCertificate creates a TLS certificate for a specific server and stores
|
||||
// it in a secret with the given name.
|
||||
func createTLSServerCertificate(ctx context.Context, log zerolog.Logger, cachedStatus inspectorInterface.Inspector, secrets secretv1.ModInterface, names tls.KeyfileInput, spec api.TLSSpec,
|
||||
secretName string, ownerRef *metav1.OwnerReference) (bool, error) {
|
||||
secretName string, ownerRef *meta.OwnerReference) (bool, error) {
|
||||
log = log.With().Str("secret", secretName).Logger()
|
||||
// Load CA certificate
|
||||
ctxChild, cancel := globals.GetGlobalTimeouts().Kubernetes().WithTimeout(ctx)
|
||||
|
|
39
pkg/deployment/resources/inspector/acs_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/acs_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *arangoClusterSynchronizationsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := ArangoClusterSynchronizationGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case ArangoClusterSynchronizationVersionV1:
|
||||
return &arangoClusterSynchronizationsInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/acs_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/acs_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type arangoClusterSynchronizationsInspectorAnonymousV1 struct {
|
||||
i *arangoClusterSynchronizationsInspectorV1
|
||||
}
|
||||
|
||||
func (e *arangoClusterSynchronizationsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
81
pkg/deployment/resources/inspector/acs_constants.go
Normal file
81
pkg/deployment/resources/inspector/acs_constants.go
Normal file
|
@ -0,0 +1,81 @@
|
|||
//
|
||||
// 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/apis/deployment"
|
||||
deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// ArangoClusterSynchronization
|
||||
const (
|
||||
ArangoClusterSynchronizationGroup = deployment.ArangoDeploymentGroupName
|
||||
ArangoClusterSynchronizationResource = deployment.ArangoClusterSynchronizationResourcePlural
|
||||
ArangoClusterSynchronizationKind = deployment.ArangoClusterSynchronizationResourceKind
|
||||
ArangoClusterSynchronizationVersionV1 = deploymentv1.ArangoDeploymentVersion
|
||||
)
|
||||
|
||||
func ArangoClusterSynchronizationGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: ArangoClusterSynchronizationGroup,
|
||||
Kind: ArangoClusterSynchronizationKind,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoClusterSynchronizationGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: ArangoClusterSynchronizationGroup,
|
||||
Kind: ArangoClusterSynchronizationKind,
|
||||
Version: ArangoClusterSynchronizationVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoClusterSynchronizationGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: ArangoClusterSynchronizationGroup,
|
||||
Resource: ArangoClusterSynchronizationResource,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoClusterSynchronizationGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: ArangoClusterSynchronizationGroup,
|
||||
Resource: ArangoClusterSynchronizationResource,
|
||||
Version: ArangoClusterSynchronizationVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *arangoClusterSynchronizationsInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return ArangoClusterSynchronizationGKv1()
|
||||
}
|
||||
|
||||
func (p *arangoClusterSynchronizationsInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return ArangoClusterSynchronizationGRv1()
|
||||
}
|
||||
|
||||
func (p *arangoClusterSynchronizationsInspector) GroupKind() schema.GroupKind {
|
||||
return ArangoClusterSynchronizationGK()
|
||||
}
|
||||
|
||||
func (p *arangoClusterSynchronizationsInspector) GroupResource() schema.GroupResource {
|
||||
return ArangoClusterSynchronizationGR()
|
||||
}
|
|
@ -23,13 +23,11 @@ package inspector
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *arangoClusterSynchronizationsInspector) V1() (ins.Inspector, error) {
|
||||
|
@ -129,12 +127,9 @@ func (p *arangoClusterSynchronizationsInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *arangoClusterSynchronizationsInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*api.ArangoClusterSynchronization, error) {
|
||||
func (p *arangoClusterSynchronizationsInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*api.ArangoClusterSynchronization, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: deployment.ArangoDeploymentGroupName,
|
||||
Resource: deployment.ArangoClusterSynchronizationResourcePlural,
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(ArangoClusterSynchronizationGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/am_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/am_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *arangoMembersInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := ArangoMemberGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case ArangoMemberVersionV1:
|
||||
return &arangoMembersInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/am_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/am_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type arangoMembersInspectorAnonymousV1 struct {
|
||||
i *arangoMembersInspectorV1
|
||||
}
|
||||
|
||||
func (e *arangoMembersInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
81
pkg/deployment/resources/inspector/am_constants.go
Normal file
81
pkg/deployment/resources/inspector/am_constants.go
Normal file
|
@ -0,0 +1,81 @@
|
|||
//
|
||||
// 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/apis/deployment"
|
||||
deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// ArangoMember
|
||||
const (
|
||||
ArangoMemberGroup = deployment.ArangoDeploymentGroupName
|
||||
ArangoMemberResource = deployment.ArangoMemberResourcePlural
|
||||
ArangoMemberKind = deployment.ArangoMemberResourceKind
|
||||
ArangoMemberVersionV1 = deploymentv1.ArangoDeploymentVersion
|
||||
)
|
||||
|
||||
func ArangoMemberGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: ArangoMemberGroup,
|
||||
Kind: ArangoMemberKind,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoMemberGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: ArangoMemberGroup,
|
||||
Kind: ArangoMemberKind,
|
||||
Version: ArangoMemberVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoMemberGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: ArangoMemberGroup,
|
||||
Resource: ArangoMemberResource,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoMemberGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: ArangoMemberGroup,
|
||||
Resource: ArangoMemberResource,
|
||||
Version: ArangoMemberVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *arangoMembersInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return ArangoMemberGKv1()
|
||||
}
|
||||
|
||||
func (p *arangoMembersInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return ArangoMemberGRv1()
|
||||
}
|
||||
|
||||
func (p *arangoMembersInspector) GroupKind() schema.GroupKind {
|
||||
return ArangoMemberGK()
|
||||
}
|
||||
|
||||
func (p *arangoMembersInspector) GroupResource() schema.GroupResource {
|
||||
return ArangoMemberGR()
|
||||
}
|
|
@ -23,13 +23,11 @@ package inspector
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *arangoMembersInspector) V1() ins.Inspector {
|
||||
|
@ -109,12 +107,9 @@ func (p *arangoMembersInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *arangoMembersInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*api.ArangoMember, error) {
|
||||
func (p *arangoMembersInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*api.ArangoMember, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: deployment.ArangoDeploymentGroupName,
|
||||
Resource: deployment.ArangoMemberResourcePlural,
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(ArangoMemberGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/at_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/at_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *arangoTasksInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := ArangoTaskGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case ArangoTaskVersionV1:
|
||||
return &arangoTasksInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/at_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/at_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type arangoTasksInspectorAnonymousV1 struct {
|
||||
i *arangoTasksInspectorV1
|
||||
}
|
||||
|
||||
func (e *arangoTasksInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
81
pkg/deployment/resources/inspector/at_constants.go
Normal file
81
pkg/deployment/resources/inspector/at_constants.go
Normal file
|
@ -0,0 +1,81 @@
|
|||
//
|
||||
// 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/apis/deployment"
|
||||
deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// ArangoTask
|
||||
const (
|
||||
ArangoTaskGroup = deployment.ArangoDeploymentGroupName
|
||||
ArangoTaskResource = deployment.ArangoTaskResourcePlural
|
||||
ArangoTaskKind = deployment.ArangoTaskResourceKind
|
||||
ArangoTaskVersionV1 = deploymentv1.ArangoDeploymentVersion
|
||||
)
|
||||
|
||||
func ArangoTaskGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: ArangoTaskGroup,
|
||||
Kind: ArangoTaskKind,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoTaskGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: ArangoTaskGroup,
|
||||
Kind: ArangoTaskKind,
|
||||
Version: ArangoTaskVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoTaskGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: ArangoTaskGroup,
|
||||
Resource: ArangoTaskResource,
|
||||
}
|
||||
}
|
||||
|
||||
func ArangoTaskGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: ArangoTaskGroup,
|
||||
Resource: ArangoTaskResource,
|
||||
Version: ArangoTaskVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *arangoTasksInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return ArangoTaskGKv1()
|
||||
}
|
||||
|
||||
func (p *arangoTasksInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return ArangoTaskGRv1()
|
||||
}
|
||||
|
||||
func (p *arangoTasksInspector) GroupKind() schema.GroupKind {
|
||||
return ArangoTaskGK()
|
||||
}
|
||||
|
||||
func (p *arangoTasksInspector) GroupResource() schema.GroupResource {
|
||||
return ArangoTaskGR()
|
||||
}
|
|
@ -23,13 +23,11 @@ package inspector
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *arangoTasksInspector) V1() (ins.Inspector, error) {
|
||||
|
@ -129,12 +127,9 @@ func (p *arangoTasksInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *arangoTasksInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*api.ArangoTask, error) {
|
||||
func (p *arangoTasksInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*api.ArangoTask, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: deployment.ArangoDeploymentGroupName,
|
||||
Resource: deployment.ArangoTaskResourcePlural,
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(ArangoTaskGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/endpoints_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/endpoints_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *endpointsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := EndpointsGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case EndpointsVersionV1:
|
||||
return &endpointsInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/endpoints_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/endpoints_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type endpointsInspectorAnonymousV1 struct {
|
||||
i *endpointsInspectorV1
|
||||
}
|
||||
|
||||
func (e *endpointsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
80
pkg/deployment/resources/inspector/endpoints_constants.go
Normal file
80
pkg/deployment/resources/inspector/endpoints_constants.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// 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 (
|
||||
core "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// Endpoints
|
||||
const (
|
||||
EndpointsGroup = core.GroupName
|
||||
EndpointsResource = "endpoints"
|
||||
EndpointsKind = "Endpoints"
|
||||
EndpointsVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func EndpointsGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: EndpointsGroup,
|
||||
Kind: EndpointsKind,
|
||||
}
|
||||
}
|
||||
|
||||
func EndpointsGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: EndpointsGroup,
|
||||
Kind: EndpointsKind,
|
||||
Version: EndpointsVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func EndpointsGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: EndpointsGroup,
|
||||
Resource: EndpointsResource,
|
||||
}
|
||||
}
|
||||
|
||||
func EndpointsGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: EndpointsGroup,
|
||||
Resource: EndpointsResource,
|
||||
Version: EndpointsVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *endpointsInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return EndpointsGKv1()
|
||||
}
|
||||
|
||||
func (p *endpointsInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return EndpointsGRv1()
|
||||
}
|
||||
|
||||
func (p *endpointsInspector) GroupKind() schema.GroupKind {
|
||||
return EndpointsGK()
|
||||
}
|
||||
|
||||
func (p *endpointsInspector) GroupResource() schema.GroupResource {
|
||||
return EndpointsGR()
|
||||
}
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/endpoints/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *endpointsInspector) V1() (ins.Inspector, error) {
|
||||
|
@ -128,12 +127,9 @@ func (p *endpointsInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *endpointsInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*core.Endpoints, error) {
|
||||
func (p *endpointsInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*core.Endpoints, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: core.GroupName,
|
||||
Resource: "endpoints",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(EndpointsGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask"
|
||||
|
@ -48,6 +49,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||
"github.com/rs/zerolog"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -157,6 +159,38 @@ type inspectorState struct {
|
|||
initialised bool
|
||||
}
|
||||
|
||||
func (i *inspectorState) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
for _, o := range i.AnonymousObjects() {
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
obj, ok := o.Anonymous(gvk)
|
||||
if ok {
|
||||
return obj, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (i *inspectorState) AnonymousObjects() []anonymous.Impl {
|
||||
return []anonymous.Impl{
|
||||
i.pods,
|
||||
i.secrets,
|
||||
i.persistentVolumeClaims,
|
||||
i.services,
|
||||
i.serviceAccounts,
|
||||
i.nodes,
|
||||
i.podDisruptionBudgets,
|
||||
i.serviceMonitors,
|
||||
i.arangoMembers,
|
||||
i.arangoTasks,
|
||||
i.arangoClusterSynchronizations,
|
||||
i.endpoints,
|
||||
}
|
||||
}
|
||||
|
||||
func (i *inspectorState) GetCurrentArangoDeployment() (*api.ArangoDeployment, error) {
|
||||
if i.deploymentResult == nil {
|
||||
return nil, errors.Newf("Deployment not initialised")
|
||||
|
|
39
pkg/deployment/resources/inspector/nodes_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/nodes_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *nodesInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := NodeGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case NodeVersionV1:
|
||||
return &nodesInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/nodes_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/nodes_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type nodesInspectorAnonymousV1 struct {
|
||||
i *nodesInspectorV1
|
||||
}
|
||||
|
||||
func (e *nodesInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
80
pkg/deployment/resources/inspector/nodes_constants.go
Normal file
80
pkg/deployment/resources/inspector/nodes_constants.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// 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 (
|
||||
core "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// Node
|
||||
const (
|
||||
NodeGroup = core.GroupName
|
||||
NodeResource = "nodes"
|
||||
NodeKind = "Node"
|
||||
NodeVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func NodeGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: NodeGroup,
|
||||
Kind: NodeKind,
|
||||
}
|
||||
}
|
||||
|
||||
func NodeGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: NodeGroup,
|
||||
Kind: NodeKind,
|
||||
Version: NodeVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func NodeGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: NodeGroup,
|
||||
Resource: NodeResource,
|
||||
}
|
||||
}
|
||||
|
||||
func NodeGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: NodeGroup,
|
||||
Resource: NodeResource,
|
||||
Version: NodeVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *nodesInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return NodeGKv1()
|
||||
}
|
||||
|
||||
func (p *nodesInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return NodeGRv1()
|
||||
}
|
||||
|
||||
func (p *nodesInspector) GroupKind() schema.GroupKind {
|
||||
return NodeGK()
|
||||
}
|
||||
|
||||
func (p *nodesInspector) GroupResource() schema.GroupResource {
|
||||
return NodeGR()
|
||||
}
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/node/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *nodesInspector) V1() (ins.Inspector, error) {
|
||||
|
@ -112,12 +111,9 @@ func (p *nodesInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *nodesInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*core.Node, error) {
|
||||
func (p *nodesInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*core.Node, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: core.GroupName,
|
||||
Resource: "nodes",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(NodeGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
41
pkg/deployment/resources/inspector/pdbs_anonymous.go
Normal file
41
pkg/deployment/resources/inspector/pdbs_anonymous.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *podDisruptionBudgetsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := PodDisruptionBudgetGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case PodDisruptionBudgetVersionV1:
|
||||
return &podDisruptionBudgetsInspectorAnonymousV1{i: p.v1}, true
|
||||
case PodDisruptionBudgetVersionV1Beta1:
|
||||
return &podDisruptionBudgetsInspectorAnonymousV1Beta1{i: p.v1beta1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/pdbs_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/pdbs_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type podDisruptionBudgetsInspectorAnonymousV1 struct {
|
||||
i *podDisruptionBudgetsInspectorV1
|
||||
}
|
||||
|
||||
func (e *podDisruptionBudgetsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
35
pkg/deployment/resources/inspector/pdbs_anonymous_v1beta1.go
Normal file
35
pkg/deployment/resources/inspector/pdbs_anonymous_v1beta1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type podDisruptionBudgetsInspectorAnonymousV1Beta1 struct {
|
||||
i *podDisruptionBudgetsInspectorV1Beta1
|
||||
}
|
||||
|
||||
func (e *podDisruptionBudgetsInspectorAnonymousV1Beta1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
105
pkg/deployment/resources/inspector/pdbs_constants.go
Normal file
105
pkg/deployment/resources/inspector/pdbs_constants.go
Normal file
|
@ -0,0 +1,105 @@
|
|||
//
|
||||
// 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 (
|
||||
policy "k8s.io/api/policy/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// PodDisruptionBudget
|
||||
const (
|
||||
PodDisruptionBudgetGroup = policy.GroupName
|
||||
PodDisruptionBudgetResource = "poddisruptionbudgets"
|
||||
PodDisruptionBudgetKind = "PodDisruptionBudget"
|
||||
PodDisruptionBudgetVersionV1Beta1 = "v1beta1"
|
||||
PodDisruptionBudgetVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func PodDisruptionBudgetGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: PodDisruptionBudgetGroup,
|
||||
Kind: PodDisruptionBudgetKind,
|
||||
}
|
||||
}
|
||||
|
||||
func PodDisruptionBudgetGKv1Beta1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: PodDisruptionBudgetGroup,
|
||||
Kind: PodDisruptionBudgetKind,
|
||||
Version: PodDisruptionBudgetVersionV1Beta1,
|
||||
}
|
||||
}
|
||||
|
||||
func PodDisruptionBudgetGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: PodDisruptionBudgetGroup,
|
||||
Kind: PodDisruptionBudgetKind,
|
||||
Version: PodDisruptionBudgetVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func PodDisruptionBudgetGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: PodDisruptionBudgetGroup,
|
||||
Resource: PodDisruptionBudgetResource,
|
||||
}
|
||||
}
|
||||
|
||||
func PodDisruptionBudgetGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: PodDisruptionBudgetGroup,
|
||||
Resource: PodDisruptionBudgetResource,
|
||||
Version: PodDisruptionBudgetVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func PodDisruptionBudgetGRv1Beta1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: PodDisruptionBudgetGroup,
|
||||
Resource: PodDisruptionBudgetResource,
|
||||
Version: PodDisruptionBudgetVersionV1Beta1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *podDisruptionBudgetsInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return PodDisruptionBudgetGKv1()
|
||||
}
|
||||
|
||||
func (p *podDisruptionBudgetsInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return PodDisruptionBudgetGRv1()
|
||||
}
|
||||
|
||||
func (p *podDisruptionBudgetsInspectorV1Beta1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return PodDisruptionBudgetGKv1Beta1()
|
||||
}
|
||||
|
||||
func (p *podDisruptionBudgetsInspectorV1Beta1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return PodDisruptionBudgetGRv1Beta1()
|
||||
}
|
||||
|
||||
func (p *podDisruptionBudgetsInspector) GroupKind() schema.GroupKind {
|
||||
return PodDisruptionBudgetGK()
|
||||
}
|
||||
|
||||
func (p *podDisruptionBudgetsInspector) GroupResource() schema.GroupResource {
|
||||
return PodDisruptionBudgetGR()
|
||||
}
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget/v1"
|
||||
policy "k8s.io/api/policy/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *podDisruptionBudgetsInspector) V1() (ins.Inspector, error) {
|
||||
|
@ -112,12 +111,9 @@ func (p *podDisruptionBudgetsInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *podDisruptionBudgetsInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*policy.PodDisruptionBudget, error) {
|
||||
func (p *podDisruptionBudgetsInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*policy.PodDisruptionBudget, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: policy.GroupName,
|
||||
Resource: "podDisruptionBudgets",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(PodDisruptionBudgetGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget/v1beta1"
|
||||
policy "k8s.io/api/policy/v1beta1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *podDisruptionBudgetsInspector) V1Beta1() (ins.Inspector, error) {
|
||||
|
@ -112,12 +111,9 @@ func (p *podDisruptionBudgetsInspectorV1Beta1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *podDisruptionBudgetsInspectorV1Beta1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*policy.PodDisruptionBudget, error) {
|
||||
func (p *podDisruptionBudgetsInspectorV1Beta1) Get(ctx context.Context, name string, opts meta.GetOptions) (*policy.PodDisruptionBudget, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: policy.GroupName,
|
||||
Resource: "podDisruptionBudgets",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(PodDisruptionBudgetGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/pods_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/pods_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *podsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := PodGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case PodVersionV1:
|
||||
return &podsInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/pods_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/pods_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type podsInspectorAnonymousV1 struct {
|
||||
i *podsInspectorV1
|
||||
}
|
||||
|
||||
func (e *podsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
80
pkg/deployment/resources/inspector/pods_constants.go
Normal file
80
pkg/deployment/resources/inspector/pods_constants.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// 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 (
|
||||
core "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// Pod
|
||||
const (
|
||||
PodGroup = core.GroupName
|
||||
PodResource = "pods"
|
||||
PodKind = "Pod"
|
||||
PodVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func PodGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: PodGroup,
|
||||
Kind: PodKind,
|
||||
}
|
||||
}
|
||||
|
||||
func PodGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: PodGroup,
|
||||
Kind: PodKind,
|
||||
Version: PodVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func PodGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: PodGroup,
|
||||
Resource: PodResource,
|
||||
}
|
||||
}
|
||||
|
||||
func PodGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: PodGroup,
|
||||
Resource: PodResource,
|
||||
Version: PodVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *podsInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return PodGKv1()
|
||||
}
|
||||
|
||||
func (p *podsInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return PodGRv1()
|
||||
}
|
||||
|
||||
func (p *podsInspector) GroupKind() schema.GroupKind {
|
||||
return PodGK()
|
||||
}
|
||||
|
||||
func (p *podsInspector) GroupResource() schema.GroupResource {
|
||||
return PodGR()
|
||||
}
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/pod/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *podsInspector) V1() ins.Inspector {
|
||||
|
@ -109,12 +108,9 @@ func (p *podsInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *podsInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*core.Pod, error) {
|
||||
func (p *podsInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*core.Pod, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: core.GroupName,
|
||||
Resource: "pods",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(PodGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/pvcs_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/pvcs_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *persistentVolumeClaimsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := PersistentVolumeClaimGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case PersistentVolumeClaimVersionV1:
|
||||
return &persistentVolumeClaimsInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/pvcs_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/pvcs_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type persistentVolumeClaimsInspectorAnonymousV1 struct {
|
||||
i *persistentVolumeClaimsInspectorV1
|
||||
}
|
||||
|
||||
func (e *persistentVolumeClaimsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
80
pkg/deployment/resources/inspector/pvcs_constants.go
Normal file
80
pkg/deployment/resources/inspector/pvcs_constants.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// 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 (
|
||||
core "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// PersistentVolumeClaim
|
||||
const (
|
||||
PersistentVolumeClaimGroup = core.GroupName
|
||||
PersistentVolumeClaimResource = "persistentvolumeclaims"
|
||||
PersistentVolumeClaimKind = "PersistentVolumeClaim"
|
||||
PersistentVolumeClaimVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func PersistentVolumeClaimGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: PersistentVolumeClaimGroup,
|
||||
Kind: PersistentVolumeClaimKind,
|
||||
}
|
||||
}
|
||||
|
||||
func PersistentVolumeClaimGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: PersistentVolumeClaimGroup,
|
||||
Kind: PersistentVolumeClaimKind,
|
||||
Version: PersistentVolumeClaimVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func PersistentVolumeClaimGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: PersistentVolumeClaimGroup,
|
||||
Resource: PersistentVolumeClaimResource,
|
||||
}
|
||||
}
|
||||
|
||||
func PersistentVolumeClaimGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: PersistentVolumeClaimGroup,
|
||||
Resource: PersistentVolumeClaimResource,
|
||||
Version: PersistentVolumeClaimVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *persistentVolumeClaimsInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return PersistentVolumeClaimGKv1()
|
||||
}
|
||||
|
||||
func (p *persistentVolumeClaimsInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return PersistentVolumeClaimGRv1()
|
||||
}
|
||||
|
||||
func (p *persistentVolumeClaimsInspector) GroupKind() schema.GroupKind {
|
||||
return PersistentVolumeClaimGK()
|
||||
}
|
||||
|
||||
func (p *persistentVolumeClaimsInspector) GroupResource() schema.GroupResource {
|
||||
return PersistentVolumeClaimGR()
|
||||
}
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/persistentvolumeclaim/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *persistentVolumeClaimsInspector) V1() ins.Inspector {
|
||||
|
@ -108,12 +107,9 @@ func (p *persistentVolumeClaimsInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *persistentVolumeClaimsInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*core.PersistentVolumeClaim, error) {
|
||||
func (p *persistentVolumeClaimsInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*core.PersistentVolumeClaim, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: core.GroupName,
|
||||
Resource: "persistentVolumeClaims",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(PersistentVolumeClaimGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/sa_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/sa_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *serviceAccountsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := ServiceAccountGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case ServiceAccountVersionV1:
|
||||
return &serviceAccountsInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/sa_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/sa_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type serviceAccountsInspectorAnonymousV1 struct {
|
||||
i *serviceAccountsInspectorV1
|
||||
}
|
||||
|
||||
func (e *serviceAccountsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
80
pkg/deployment/resources/inspector/sa_constants.go
Normal file
80
pkg/deployment/resources/inspector/sa_constants.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// 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 (
|
||||
core "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// ServiceAccount
|
||||
const (
|
||||
ServiceAccountGroup = core.GroupName
|
||||
ServiceAccountResource = "serviceaccounts"
|
||||
ServiceAccountKind = "ServiceAccount"
|
||||
ServiceAccountVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func ServiceAccountGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: ServiceAccountGroup,
|
||||
Kind: ServiceAccountKind,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceAccountGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: ServiceAccountGroup,
|
||||
Kind: ServiceAccountKind,
|
||||
Version: ServiceAccountVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceAccountGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: ServiceAccountGroup,
|
||||
Resource: ServiceAccountResource,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceAccountGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: ServiceAccountGroup,
|
||||
Resource: ServiceAccountResource,
|
||||
Version: ServiceAccountVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *serviceAccountsInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return ServiceAccountGKv1()
|
||||
}
|
||||
|
||||
func (p *serviceAccountsInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return ServiceAccountGRv1()
|
||||
}
|
||||
|
||||
func (p *serviceAccountsInspector) GroupKind() schema.GroupKind {
|
||||
return ServiceAccountGK()
|
||||
}
|
||||
|
||||
func (p *serviceAccountsInspector) GroupResource() schema.GroupResource {
|
||||
return ServiceAccountGR()
|
||||
}
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/serviceaccount/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *serviceAccountsInspector) V1() ins.Inspector {
|
||||
|
@ -108,12 +107,9 @@ func (p *serviceAccountsInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *serviceAccountsInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*core.ServiceAccount, error) {
|
||||
func (p *serviceAccountsInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*core.ServiceAccount, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: core.GroupName,
|
||||
Resource: "serviceAccounts",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(ServiceAccountGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/secrets_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/secrets_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *secretsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := SecretGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case SecretVersionV1:
|
||||
return &secretsInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/secrets_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/secrets_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type secretsInspectorAnonymousV1 struct {
|
||||
i *secretsInspectorV1
|
||||
}
|
||||
|
||||
func (e *secretsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
80
pkg/deployment/resources/inspector/secrets_constants.go
Normal file
80
pkg/deployment/resources/inspector/secrets_constants.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// 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 (
|
||||
core "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// Secret
|
||||
const (
|
||||
SecretGroup = core.GroupName
|
||||
SecretResource = "secrets"
|
||||
SecretKind = "Secret"
|
||||
SecretVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func SecretGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: SecretGroup,
|
||||
Kind: SecretKind,
|
||||
}
|
||||
}
|
||||
|
||||
func SecretGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: SecretGroup,
|
||||
Kind: SecretKind,
|
||||
Version: SecretVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func SecretGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: SecretGroup,
|
||||
Resource: SecretResource,
|
||||
}
|
||||
}
|
||||
|
||||
func SecretGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: SecretGroup,
|
||||
Resource: SecretResource,
|
||||
Version: SecretVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *secretsInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return SecretGKv1()
|
||||
}
|
||||
|
||||
func (p *secretsInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return SecretGRv1()
|
||||
}
|
||||
|
||||
func (p *secretsInspector) GroupKind() schema.GroupKind {
|
||||
return SecretGK()
|
||||
}
|
||||
|
||||
func (p *secretsInspector) GroupResource() schema.GroupResource {
|
||||
return SecretGR()
|
||||
}
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/secret/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *secretsInspector) V1() ins.Inspector {
|
||||
|
@ -108,12 +107,9 @@ func (p *secretsInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *secretsInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*core.Secret, error) {
|
||||
func (p *secretsInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*core.Secret, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: core.GroupName,
|
||||
Resource: "secrets",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(SecretGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/services_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/services_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *servicesInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := ServiceGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case ServiceVersionV1:
|
||||
return &servicesInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/services_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/services_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type servicesInspectorAnonymousV1 struct {
|
||||
i *servicesInspectorV1
|
||||
}
|
||||
|
||||
func (e *servicesInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
80
pkg/deployment/resources/inspector/services_constants.go
Normal file
80
pkg/deployment/resources/inspector/services_constants.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// 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 (
|
||||
core "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// Service
|
||||
const (
|
||||
ServiceGroup = core.GroupName
|
||||
ServiceResource = "services"
|
||||
ServiceKind = "Service"
|
||||
ServiceVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func ServiceGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: ServiceGroup,
|
||||
Kind: ServiceKind,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: ServiceGroup,
|
||||
Kind: ServiceKind,
|
||||
Version: ServiceVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: ServiceGroup,
|
||||
Resource: ServiceResource,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: ServiceGroup,
|
||||
Resource: ServiceResource,
|
||||
Version: ServiceVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *servicesInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return ServiceGKv1()
|
||||
}
|
||||
|
||||
func (p *servicesInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return ServiceGRv1()
|
||||
}
|
||||
|
||||
func (p *servicesInspector) GroupKind() schema.GroupKind {
|
||||
return ServiceGK()
|
||||
}
|
||||
|
||||
func (p *servicesInspector) GroupResource() schema.GroupResource {
|
||||
return ServiceGR()
|
||||
}
|
|
@ -27,8 +27,7 @@ import (
|
|||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/service/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *servicesInspector) V1() ins.Inspector {
|
||||
|
@ -108,12 +107,9 @@ func (p *servicesInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *servicesInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*core.Service, error) {
|
||||
func (p *servicesInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*core.Service, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: core.GroupName,
|
||||
Resource: "services",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(ServiceGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
39
pkg/deployment/resources/inspector/sm_anonymous.go
Normal file
39
pkg/deployment/resources/inspector/sm_anonymous.go
Normal file
|
@ -0,0 +1,39 @@
|
|||
//
|
||||
// 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/anonymous"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (p *serviceMonitorsInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
|
||||
g := ServiceMonitorGK()
|
||||
|
||||
if g.Kind == gvk.Kind && g.Group == gvk.Group {
|
||||
switch gvk.Version {
|
||||
case ServiceMonitorVersionV1:
|
||||
return &serviceMonitorsInspectorAnonymousV1{i: p.v1}, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
35
pkg/deployment/resources/inspector/sm_anonymous_v1.go
Normal file
35
pkg/deployment/resources/inspector/sm_anonymous_v1.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 (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
type serviceMonitorsInspectorAnonymousV1 struct {
|
||||
i *serviceMonitorsInspectorV1
|
||||
}
|
||||
|
||||
func (e *serviceMonitorsInspectorAnonymousV1) Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error) {
|
||||
return e.i.Get(ctx, name, opts)
|
||||
}
|
80
pkg/deployment/resources/inspector/sm_constants.go
Normal file
80
pkg/deployment/resources/inspector/sm_constants.go
Normal file
|
@ -0,0 +1,80 @@
|
|||
//
|
||||
// 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 (
|
||||
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
// ServiceMonitor
|
||||
const (
|
||||
ServiceMonitorGroup = monitoring.GroupName
|
||||
ServiceMonitorResource = "servicemonitors"
|
||||
ServiceMonitorKind = "ServiceMonitor"
|
||||
ServiceMonitorVersionV1 = "v1"
|
||||
)
|
||||
|
||||
func ServiceMonitorGK() schema.GroupKind {
|
||||
return schema.GroupKind{
|
||||
Group: ServiceMonitorGroup,
|
||||
Kind: ServiceMonitorKind,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceMonitorGKv1() schema.GroupVersionKind {
|
||||
return schema.GroupVersionKind{
|
||||
Group: ServiceMonitorGroup,
|
||||
Kind: ServiceMonitorKind,
|
||||
Version: ServiceMonitorVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceMonitorGR() schema.GroupResource {
|
||||
return schema.GroupResource{
|
||||
Group: ServiceMonitorGroup,
|
||||
Resource: ServiceMonitorResource,
|
||||
}
|
||||
}
|
||||
|
||||
func ServiceMonitorGRv1() schema.GroupVersionResource {
|
||||
return schema.GroupVersionResource{
|
||||
Group: ServiceMonitorGroup,
|
||||
Resource: ServiceMonitorResource,
|
||||
Version: ServiceMonitorVersionV1,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *serviceMonitorsInspectorV1) GroupVersionKind() schema.GroupVersionKind {
|
||||
return ServiceMonitorGKv1()
|
||||
}
|
||||
|
||||
func (p *serviceMonitorsInspectorV1) GroupVersionResource() schema.GroupVersionResource {
|
||||
return ServiceMonitorGRv1()
|
||||
}
|
||||
|
||||
func (p *serviceMonitorsInspector) GroupKind() schema.GroupKind {
|
||||
return ServiceMonitorGK()
|
||||
}
|
||||
|
||||
func (p *serviceMonitorsInspector) GroupResource() schema.GroupResource {
|
||||
return ServiceMonitorGR()
|
||||
}
|
|
@ -25,12 +25,9 @@ import (
|
|||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/servicemonitor/v1"
|
||||
core "k8s.io/api/core/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func (p *serviceMonitorsInspector) V1() (ins.Inspector, error) {
|
||||
|
@ -114,12 +111,9 @@ func (p *serviceMonitorsInspectorV1) Read() ins.ReadInterface {
|
|||
return p
|
||||
}
|
||||
|
||||
func (p *serviceMonitorsInspectorV1) Get(ctx context.Context, name string, opts metav1.GetOptions) (*monitoring.ServiceMonitor, error) {
|
||||
func (p *serviceMonitorsInspectorV1) Get(ctx context.Context, name string, opts meta.GetOptions) (*monitoring.ServiceMonitor, error) {
|
||||
if s, ok := p.GetSimple(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: core.GroupName,
|
||||
Resource: "serviceMonitors",
|
||||
}, name)
|
||||
return nil, apiErrors.NewNotFound(ServiceMonitorGR(), name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
"time"
|
||||
|
||||
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
|
||||
|
@ -137,9 +137,9 @@ func (r *Resources) EnsureArangoMembers(ctx context.Context, cachedStatus inspec
|
|||
if !c.Exists(ctx) {
|
||||
// Create ArangoMember
|
||||
obj := &api.ArangoMember{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: name,
|
||||
OwnerReferences: []metav1.OwnerReference{
|
||||
OwnerReferences: []meta.OwnerReference{
|
||||
obj.AsOwner(),
|
||||
},
|
||||
},
|
||||
|
@ -159,7 +159,7 @@ func (r *Resources) EnsureArangoMembers(ctx context.Context, cachedStatus inspec
|
|||
if err := c.Update(ctx, func(m *api.ArangoMember) bool {
|
||||
changed := false
|
||||
if len(m.OwnerReferences) == 0 {
|
||||
m.OwnerReferences = []metav1.OwnerReference{
|
||||
m.OwnerReferences = []meta.OwnerReference{
|
||||
obj.AsOwner(),
|
||||
}
|
||||
changed = true
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
|
||||
policyv1beta1 "k8s.io/api/policy/v1beta1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
)
|
||||
|
||||
|
@ -89,15 +89,15 @@ func PDBNameForGroup(depl string, group api.ServerGroup) string {
|
|||
return fmt.Sprintf("%s-%s-pdb", depl, group.AsRole())
|
||||
}
|
||||
|
||||
func newPDB(minAvail int, deplname string, group api.ServerGroup, owner metav1.OwnerReference) *policyv1beta1.PodDisruptionBudget {
|
||||
func newPDB(minAvail int, deplname string, group api.ServerGroup, owner meta.OwnerReference) *policyv1beta1.PodDisruptionBudget {
|
||||
return &policyv1beta1.PodDisruptionBudget{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: PDBNameForGroup(deplname, group),
|
||||
OwnerReferences: []metav1.OwnerReference{owner},
|
||||
OwnerReferences: []meta.OwnerReference{owner},
|
||||
},
|
||||
Spec: policyv1beta1.PodDisruptionBudgetSpec{
|
||||
MinAvailable: newFromInt(minAvail),
|
||||
Selector: &metav1.LabelSelector{
|
||||
Selector: &meta.LabelSelector{
|
||||
MatchLabels: k8sutil.LabelsForDeployment(deplname, group.AsRole()),
|
||||
},
|
||||
},
|
||||
|
@ -119,7 +119,7 @@ func (r *Resources) ensurePDBForGroup(ctx context.Context, group api.ServerGroup
|
|||
var pdb *policyv1beta1.PodDisruptionBudget
|
||||
err := globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
var err error
|
||||
pdb, err = i.Read().Get(ctxChild, pdbname, metav1.GetOptions{})
|
||||
pdb, err = i.Read().Get(ctxChild, pdbname, meta.GetOptions{})
|
||||
return err
|
||||
})
|
||||
if k8sutil.IsNotFound(err) {
|
||||
|
@ -128,7 +128,7 @@ func (r *Resources) ensurePDBForGroup(ctx context.Context, group api.ServerGroup
|
|||
pdb := newPDB(wantedMinAvail, deplname, group, r.context.GetAPIObject().AsOwner())
|
||||
log.Debug().Msg("Creating new PDB")
|
||||
err := globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
_, err := r.context.PodDisruptionBudgetsModInterface().Create(ctxChild, pdb, metav1.CreateOptions{})
|
||||
_, err := r.context.PodDisruptionBudgetsModInterface().Create(ctxChild, pdb, meta.CreateOptions{})
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -153,7 +153,7 @@ func (r *Resources) ensurePDBForGroup(ctx context.Context, group api.ServerGroup
|
|||
if pdb.GetDeletionTimestamp() == nil {
|
||||
// Update the PDB
|
||||
err := globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
return r.context.PodDisruptionBudgetsModInterface().Delete(ctxChild, pdbname, metav1.DeleteOptions{})
|
||||
return r.context.PodDisruptionBudgetsModInterface().Delete(ctxChild, pdbname, meta.DeleteOptions{})
|
||||
})
|
||||
if err != nil && !k8sutil.IsNotFound(err) {
|
||||
log.Error().Err(err).Msg("PDB deletion failed")
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"context"
|
||||
|
||||
|
@ -47,7 +47,7 @@ func createClient(f kclient.FakeClientBuilder, apiObject *api.ArangoDeployment,
|
|||
memberName := a.ArangoMemberName(apiObject.GetName(), group)
|
||||
|
||||
svc := core.Service{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: memberName,
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -75,7 +75,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
|
|||
// Default deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -135,7 +135,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
|
|||
// Default+AutoUpgrade deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -197,7 +197,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
|
|||
// Default+TLS disabled deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -259,7 +259,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
|
|||
// No authentication, mmfiles
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -320,7 +320,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
|
|||
// Custom args
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
|
|
@ -29,7 +29,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/deployment/pod"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
|
||||
|
@ -45,7 +45,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
|
|||
// Default deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -104,7 +104,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
|
|||
// Default+AutoUpgrade deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -164,7 +164,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
|
|||
// Default+AutoUpgrade deployment for 3.6.0
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -224,7 +224,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
|
|||
// Default+TLS disabled deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -284,7 +284,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
|
|||
// No authentication
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -343,7 +343,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
|
|||
// Custom args, RocksDB
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
|
|
@ -29,7 +29,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/deployment/pod"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
|
||||
|
@ -45,7 +45,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
// Default deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -104,7 +104,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
// Default+AutoUpgrade deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -164,7 +164,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
// Default+ClusterDomain deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -225,7 +225,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
// Default+TLS disabled deployment
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -285,7 +285,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
// No authentication
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
@ -344,7 +344,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
|
|||
// Custom args, MMFiles
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
|
|
@ -28,7 +28,7 @@ import (
|
|||
|
||||
"github.com/arangodb/kube-arangodb/pkg/deployment/pod"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
|
||||
|
@ -309,7 +309,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
|
|||
// ActiveFailover
|
||||
{
|
||||
apiObject := &api.ArangoDeployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: "name",
|
||||
Namespace: tests.FakeNamespace,
|
||||
},
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
|
||||
"github.com/rs/zerolog"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
|
@ -147,7 +147,7 @@ func (r *Resources) inspectFinalizerPodAgencyServing(ctx context.Context, log ze
|
|||
// of the agent, also remove the PVC
|
||||
if memberStatus.Conditions.IsTrue(api.ConditionTypeAgentRecoveryNeeded) {
|
||||
err := globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
return r.context.PersistentVolumeClaimsModInterface().Delete(ctxChild, memberStatus.PersistentVolumeClaimName, metav1.DeleteOptions{})
|
||||
return r.context.PersistentVolumeClaimsModInterface().Delete(ctxChild, memberStatus.PersistentVolumeClaimName, meta.DeleteOptions{})
|
||||
})
|
||||
if err != nil && !k8sutil.IsNotFound(err) {
|
||||
log.Warn().Err(err).Msg("Failed to delete PVC for member")
|
||||
|
@ -176,7 +176,7 @@ func (r *Resources) inspectFinalizerPodDrainDBServer(ctx context.Context, log ze
|
|||
// If this DBServer is cleaned out, we need to remove the PVC.
|
||||
if memberStatus.Conditions.IsTrue(api.ConditionTypeCleanedOut) || memberStatus.Phase == api.MemberPhaseDrain {
|
||||
err := globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
return r.context.PersistentVolumeClaimsModInterface().Delete(ctxChild, memberStatus.PersistentVolumeClaimName, metav1.DeleteOptions{})
|
||||
return r.context.PersistentVolumeClaimsModInterface().Delete(ctxChild, memberStatus.PersistentVolumeClaimName, meta.DeleteOptions{})
|
||||
})
|
||||
if err != nil && !k8sutil.IsNotFound(err) {
|
||||
log.Warn().Err(err).Msg("Failed to delete PVC for member")
|
||||
|
|
|
@ -31,7 +31,7 @@ import (
|
|||
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"strings"
|
||||
|
||||
|
@ -108,7 +108,7 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
|
|||
nextInterval = nextInterval.ReduceTo(recheckSoonPodInspectorInterval)
|
||||
if !wasTerminated {
|
||||
// Record termination time
|
||||
now := metav1.Now()
|
||||
now := meta.Now()
|
||||
memberStatus.RecentTerminations = append(memberStatus.RecentTerminations, now)
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
|
|||
nextInterval = nextInterval.ReduceTo(recheckSoonPodInspectorInterval)
|
||||
if !wasTerminated {
|
||||
// Record termination time
|
||||
now := metav1.Now()
|
||||
now := meta.Now()
|
||||
memberStatus.RecentTerminations = append(memberStatus.RecentTerminations, now)
|
||||
}
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
|
|||
if m.Conditions.Update(api.ConditionTypeTerminated, true, "Pod Terminated", "") {
|
||||
if !wasTerminated {
|
||||
// Record termination time
|
||||
now := metav1.Now()
|
||||
now := meta.Now()
|
||||
m.RecentTerminations = append(m.RecentTerminations, now)
|
||||
}
|
||||
// Save it
|
||||
|
@ -349,7 +349,7 @@ func (r *Resources) InspectPods(ctx context.Context, cachedStatus inspectorInter
|
|||
if m.Conditions.Update(api.ConditionTypeTerminated, true, "Pod Does Not Exist", "") {
|
||||
if !wasTerminated {
|
||||
// Record termination time
|
||||
now := metav1.Now()
|
||||
now := meta.Now()
|
||||
m.RecentTerminations = append(m.RecentTerminations, now)
|
||||
}
|
||||
updateMemberNeeded = true
|
||||
|
|
|
@ -29,7 +29,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
driver "github.com/arangodb/go-driver"
|
||||
"github.com/arangodb/go-driver/agency"
|
||||
|
@ -72,7 +72,7 @@ func (r *Resources) prepareAgencyPodTermination(ctx context.Context, log zerolog
|
|||
// Check PVC
|
||||
ctxChild, cancel := globals.GetGlobalTimeouts().Kubernetes().WithTimeout(ctx)
|
||||
defer cancel()
|
||||
pvc, err := r.context.GetCachedStatus().PersistentVolumeClaim().V1().Read().Get(ctxChild, memberStatus.PersistentVolumeClaimName, metav1.GetOptions{})
|
||||
pvc, err := r.context.GetCachedStatus().PersistentVolumeClaim().V1().Read().Get(ctxChild, memberStatus.PersistentVolumeClaimName, meta.GetOptions{})
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to get PVC for member")
|
||||
return errors.WithStack(err)
|
||||
|
@ -157,7 +157,7 @@ func (r *Resources) prepareDBServerPodTermination(ctx context.Context, log zerol
|
|||
// Check PVC
|
||||
ctxChild, cancel := globals.GetGlobalTimeouts().Kubernetes().WithTimeout(ctx)
|
||||
defer cancel()
|
||||
pvc, err := r.context.GetCachedStatus().PersistentVolumeClaim().V1().Read().Get(ctxChild, memberStatus.PersistentVolumeClaimName, metav1.GetOptions{})
|
||||
pvc, err := r.context.GetCachedStatus().PersistentVolumeClaim().V1().Read().Get(ctxChild, memberStatus.PersistentVolumeClaimName, meta.GetOptions{})
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to get PVC for member")
|
||||
return errors.WithStack(err)
|
||||
|
|
|
@ -30,7 +30,7 @@ import (
|
|||
|
||||
"github.com/rs/zerolog"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
|
@ -106,7 +106,7 @@ func (r *Resources) inspectFinalizerPVCMemberExists(ctx context.Context, log zer
|
|||
if memberStatus.PodName != "" {
|
||||
log.Info().Msg("Removing Pod of member, because PVC is being removed")
|
||||
err := globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
return r.context.PodsModInterface().Delete(ctxChild, memberStatus.PodName, metav1.DeleteOptions{})
|
||||
return r.context.PodsModInterface().Delete(ctxChild, memberStatus.PodName, meta.DeleteOptions{})
|
||||
})
|
||||
if err != nil && !k8sutil.IsNotFound(err) {
|
||||
log.Debug().Err(err).Msg("Failed to delete pod")
|
||||
|
|
|
@ -37,7 +37,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||
coreosv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func LabelsForExporterServiceMonitor(name string, obj deploymentApi.DeploymentSpec) map[string]string {
|
||||
|
@ -103,7 +103,7 @@ func (r *Resources) serviceMonitorSpec() (coreosv1.ServiceMonitorSpec, error) {
|
|||
Endpoints: []coreosv1.Endpoint{
|
||||
endpoint,
|
||||
},
|
||||
Selector: metav1.LabelSelector{
|
||||
Selector: meta.LabelSelector{
|
||||
MatchLabels: LabelsForExporterServiceMonitorSelector(r.context.GetName()),
|
||||
},
|
||||
}, nil
|
||||
|
@ -113,7 +113,7 @@ func (r *Resources) serviceMonitorSpec() (coreosv1.ServiceMonitorSpec, error) {
|
|||
Endpoints: []coreosv1.Endpoint{
|
||||
r.makeEndpoint(spec.IsSecure()),
|
||||
},
|
||||
Selector: metav1.LabelSelector{
|
||||
Selector: meta.LabelSelector{
|
||||
MatchLabels: LabelsForExporterServiceMonitorSelector(deploymentName),
|
||||
},
|
||||
}, nil
|
||||
|
@ -149,7 +149,7 @@ func (r *Resources) EnsureServiceMonitor(ctx context.Context) error {
|
|||
serviceMonitors := mClient.MonitoringV1().ServiceMonitors(ns)
|
||||
ctxChild, cancel := globals.GetGlobalTimeouts().Kubernetes().WithTimeout(ctx)
|
||||
defer cancel()
|
||||
servMon, err := serviceMonitors.Get(ctxChild, serviceMonitorName, metav1.GetOptions{})
|
||||
servMon, err := serviceMonitors.Get(ctxChild, serviceMonitorName, meta.GetOptions{})
|
||||
if err != nil {
|
||||
if k8sutil.IsNotFound(err) {
|
||||
if !wantMetrics {
|
||||
|
@ -163,16 +163,16 @@ func (r *Resources) EnsureServiceMonitor(ctx context.Context) error {
|
|||
|
||||
// Need to create one:
|
||||
smon := &coreosv1.ServiceMonitor{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: serviceMonitorName,
|
||||
Labels: LabelsForExporterServiceMonitor(r.context.GetName(), r.context.GetSpec()),
|
||||
OwnerReferences: []metav1.OwnerReference{owner},
|
||||
OwnerReferences: []meta.OwnerReference{owner},
|
||||
},
|
||||
Spec: spec,
|
||||
}
|
||||
|
||||
err = globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
_, err := serviceMonitors.Create(ctxChild, smon, metav1.CreateOptions{})
|
||||
_, err := serviceMonitors.Create(ctxChild, smon, meta.CreateOptions{})
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -217,7 +217,7 @@ func (r *Resources) EnsureServiceMonitor(ctx context.Context) error {
|
|||
servMon.Spec = spec
|
||||
|
||||
err = globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
_, err := serviceMonitors.Update(ctxChild, servMon, metav1.UpdateOptions{})
|
||||
_, err := serviceMonitors.Update(ctxChild, servMon, meta.UpdateOptions{})
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -228,7 +228,7 @@ func (r *Resources) EnsureServiceMonitor(ctx context.Context) error {
|
|||
}
|
||||
// Need to get rid of the ServiceMonitor:
|
||||
err = globals.GetGlobalTimeouts().Kubernetes().RunWithTimeout(ctx, func(ctxChild context.Context) error {
|
||||
return serviceMonitors.Delete(ctxChild, serviceMonitorName, metav1.DeleteOptions{})
|
||||
return serviceMonitors.Delete(ctxChild, serviceMonitorName, meta.DeleteOptions{})
|
||||
})
|
||||
if err == nil {
|
||||
log.Debug().Msgf("Deleted ServiceMonitor %s", serviceMonitorName)
|
||||
|
|
36
pkg/util/k8sutil/inspector/anonymous/anonymous.go
Normal file
36
pkg/util/k8sutil/inspector/anonymous/anonymous.go
Normal file
|
@ -0,0 +1,36 @@
|
|||
// //
|
||||
// // 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 anonymous
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
type Impl interface {
|
||||
Anonymous(gvk schema.GroupVersionKind) (Interface, bool)
|
||||
}
|
||||
|
||||
type Interface interface {
|
||||
Get(ctx context.Context, name string, opts meta.GetOptions) (meta.Object, error)
|
||||
}
|
|
@ -21,7 +21,9 @@
|
|||
package arangoclustersynchronization
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
)
|
||||
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() (v1.Inspector, error)
|
||||
}
|
||||
|
|
|
@ -22,9 +22,12 @@ package v1
|
|||
|
||||
import (
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
ListSimple() []*api.ArangoClusterSynchronization
|
||||
GetSimple(name string) (*api.ArangoClusterSynchronization, bool)
|
||||
Filter(filters ...Filter) []*api.ArangoClusterSynchronization
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
package arangomember
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
)
|
||||
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() v1.Inspector
|
||||
}
|
||||
|
|
|
@ -22,9 +22,12 @@ package v1
|
|||
|
||||
import (
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
GetSimple(name string) (*api.ArangoMember, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
Read() ReadInterface
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
package arangotask
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
)
|
||||
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() (v1.Inspector, error)
|
||||
}
|
||||
|
|
|
@ -22,9 +22,12 @@ package v1
|
|||
|
||||
import (
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
ListSimple() []*api.ArangoTask
|
||||
GetSimple(name string) (*api.ArangoTask, bool)
|
||||
Filter(filters ...Filter) []*api.ArangoTask
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
package endpoints
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/endpoints/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
)
|
||||
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() (v1.Inspector, error)
|
||||
}
|
||||
|
|
|
@ -20,9 +20,14 @@
|
|||
|
||||
package v1
|
||||
|
||||
import core "k8s.io/api/core/v1"
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
core "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
ListSimple() []*core.Endpoints
|
||||
GetSimple(name string) (*core.Endpoints, bool)
|
||||
Filter(filters ...Filter) []*core.Endpoints
|
||||
|
|
35
pkg/util/k8sutil/inspector/gvk/gvk.go
Normal file
35
pkg/util/k8sutil/inspector/gvk/gvk.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 gvk
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
type GK interface {
|
||||
GroupKind() schema.GroupKind
|
||||
GroupResource() schema.GroupResource
|
||||
}
|
||||
|
||||
type GVK interface {
|
||||
GroupVersionKind() schema.GroupVersionKind
|
||||
GroupVersionResource() schema.GroupVersionResource
|
||||
}
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/server"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangodeployment"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember"
|
||||
|
@ -47,6 +48,10 @@ type Inspector interface {
|
|||
|
||||
Initialised() bool
|
||||
|
||||
anonymous.Impl
|
||||
|
||||
AnonymousObjects() []anonymous.Impl
|
||||
|
||||
refresh.Inspector
|
||||
throttle.Inspector
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package node
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/node/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
)
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() (v1.Inspector, error)
|
||||
}
|
||||
|
|
|
@ -21,10 +21,13 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
core "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
ListSimple() []*core.Node
|
||||
GetSimple(name string) (*core.Node, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package persistentvolumeclaim
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/persistentvolumeclaim/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
)
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() v1.Inspector
|
||||
}
|
||||
|
|
|
@ -21,10 +21,13 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
core "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
ListSimple() []*core.PersistentVolumeClaim
|
||||
GetSimple(name string) (*core.PersistentVolumeClaim, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package pod
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/pod/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
)
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() v1.Inspector
|
||||
}
|
||||
|
|
|
@ -21,10 +21,13 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
core "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
ListSimple() []*core.Pod
|
||||
GetSimple(name string) (*core.Pod, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package poddisruptionbudget
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget/v1beta1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
|
@ -33,6 +35,9 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() (v1.Inspector, error)
|
||||
V1Beta1() (v1beta1.Inspector, error)
|
||||
}
|
||||
|
|
|
@ -20,9 +20,14 @@
|
|||
|
||||
package v1beta1
|
||||
|
||||
import policy "k8s.io/api/policy/v1"
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
policy "k8s.io/api/policy/v1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
GetSimple(name string) (*policy.PodDisruptionBudget, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
Read() ReadInterface
|
||||
|
|
|
@ -20,9 +20,14 @@
|
|||
|
||||
package v1beta1
|
||||
|
||||
import policy "k8s.io/api/policy/v1beta1"
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
policy "k8s.io/api/policy/v1beta1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
GetSimple(name string) (*policy.PodDisruptionBudget, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
Read() ReadInterface
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package secret
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/secret/v1"
|
||||
)
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() v1.Inspector
|
||||
}
|
||||
|
|
|
@ -21,11 +21,14 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
core "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// Inspector for secrets
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
ListSimple() []*core.Secret
|
||||
GetSimple(name string) (*core.Secret, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package service
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/service/v1"
|
||||
)
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() v1.Inspector
|
||||
}
|
||||
|
|
|
@ -21,10 +21,13 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
core "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
GetSimple(name string) (*core.Service, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
Read() ReadInterface
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package serviceaccount
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/serviceaccount/v1"
|
||||
)
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() v1.Inspector
|
||||
}
|
||||
|
|
|
@ -20,9 +20,14 @@
|
|||
|
||||
package v1
|
||||
|
||||
import core "k8s.io/api/core/v1"
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
core "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
GetSimple(name string) (*core.ServiceAccount, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
Read() ReadInterface
|
||||
|
|
|
@ -23,6 +23,7 @@ package v1
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
core "k8s.io/api/core/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
@ -38,6 +39,8 @@ type ModInterface interface {
|
|||
|
||||
// Interface has methods to work with ServiceAccount resources.
|
||||
type Interface interface {
|
||||
anonymous.Impl
|
||||
|
||||
ModInterface
|
||||
ReadInterface
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
package servicemonitor
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/servicemonitor/v1"
|
||||
)
|
||||
|
@ -32,5 +34,8 @@ type Inspector interface {
|
|||
type Definition interface {
|
||||
refresh.Inspector
|
||||
|
||||
gvk.GK
|
||||
anonymous.Impl
|
||||
|
||||
V1() (v1.Inspector, error)
|
||||
}
|
||||
|
|
|
@ -20,9 +20,14 @@
|
|||
|
||||
package v1
|
||||
|
||||
import monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
|
||||
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
|
||||
)
|
||||
|
||||
type Inspector interface {
|
||||
gvk.GVK
|
||||
|
||||
GetSimple(name string) (*monitoring.ServiceMonitor, bool)
|
||||
Iterate(action Action, filters ...Filter) error
|
||||
Read() ReadInterface
|
||||
|
|
|
@ -23,6 +23,7 @@ package v1
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
|
||||
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
|
@ -38,6 +39,8 @@ type ModInterface interface {
|
|||
|
||||
// Interface has methods to work with ServiceMonitor resources.
|
||||
type Interface interface {
|
||||
anonymous.Impl
|
||||
|
||||
ModInterface
|
||||
ReadInterface
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue