mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] Add ArangoTask API (#935)
This commit is contained in:
parent
a117bdb1dd
commit
6712304dd2
46 changed files with 2284 additions and 17 deletions
|
@ -9,6 +9,7 @@
|
|||
- (Feature) (ACS) Add ACS handler
|
||||
- (Feature) Allow to restart DBServers in cases when WriteConcern will be satisfied
|
||||
- (Feature) Allow to configure action timeouts
|
||||
- (Feature) (AT) Add ArangoTask API
|
||||
|
||||
## [1.2.8](https://github.com/arangodb/kube-arangodb/tree/1.2.8) (2022-02-24)
|
||||
- Do not check License V2 on Community images
|
||||
|
|
|
@ -18,6 +18,7 @@ rules:
|
|||
verbs: ["get", "list", "watch", "update", "delete"]
|
||||
resourceNames:
|
||||
- "arangoclustersynchronizations.database.arangodb.com"
|
||||
- "arangotasks.database.arangodb.com"
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -14,7 +14,7 @@ metadata:
|
|||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["database.arangodb.com"]
|
||||
resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status", "arangoclustersynchronizations", "arangoclustersynchronizations/status"]
|
||||
resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status", "arangoclustersynchronizations", "arangoclustersynchronizations/status", "arangotasks", "arangotasks/status"]
|
||||
verbs: ["*"]
|
||||
- apiGroups: [""]
|
||||
resources: ["pods", "services", "endpoints", "persistentvolumeclaims", "events", "secrets", "serviceaccounts"]
|
||||
|
|
1
go.mod
1
go.mod
|
@ -28,6 +28,7 @@ require (
|
|||
github.com/arangodb/go-driver v1.2.1
|
||||
github.com/arangodb/go-driver/v2 v2.0.0-20211021031401-d92dcd5a4c83
|
||||
github.com/arangodb/go-upgrade-rules v0.0.0-20180809110947-031b4774ff21
|
||||
github.com/arangodb/rebalancer v0.1.1
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible
|
||||
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
|
|
47
pkg/apis/deployment/v1/arango_task.go
Normal file
47
pkg/apis/deployment/v1/arango_task.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// 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 v1
|
||||
|
||||
import (
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ArangoTaskList is a list of ArangoDB tasks.
|
||||
type ArangoTaskList struct {
|
||||
meta.TypeMeta `json:",inline"`
|
||||
// Standard list metadata
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
meta.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ArangoTask `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ArangoTask contains task definition info.
|
||||
type ArangoTask struct {
|
||||
meta.TypeMeta `json:",inline"`
|
||||
meta.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec ArangoTaskSpec `json:"spec,omitempty"`
|
||||
Status ArangoTaskStatus `json:"status,omitempty"`
|
||||
}
|
74
pkg/apis/deployment/v1/arango_task_spec.go
Normal file
74
pkg/apis/deployment/v1/arango_task_spec.go
Normal file
|
@ -0,0 +1,74 @@
|
|||
//
|
||||
// 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 v1
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type ArangoTaskType string
|
||||
|
||||
type ArangoTaskDetails []byte
|
||||
|
||||
func (a ArangoTaskDetails) MarshalJSON() ([]byte, error) {
|
||||
d := make([]byte, len(a))
|
||||
|
||||
copy(d, a)
|
||||
|
||||
return d, nil
|
||||
}
|
||||
|
||||
func (a *ArangoTaskDetails) UnmarshalJSON(bytes []byte) error {
|
||||
var i interface{}
|
||||
|
||||
if err := json.Unmarshal(bytes, &i); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d := make([]byte, len(bytes))
|
||||
|
||||
copy(d, bytes)
|
||||
|
||||
*a = d
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a ArangoTaskDetails) Get(i interface{}) error {
|
||||
return json.Unmarshal(a, &i)
|
||||
}
|
||||
|
||||
func (a *ArangoTaskDetails) Set(i interface{}) error {
|
||||
if d, err := json.Marshal(i); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*a = d
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ json.Unmarshaler = &ArangoTaskDetails{}
|
||||
var _ json.Marshaler = ArangoTaskDetails{}
|
||||
|
||||
type ArangoTaskSpec struct {
|
||||
Type ArangoTaskType `json:"type,omitempty"`
|
||||
|
||||
Details ArangoTaskDetails `json:"details,omitempty"`
|
||||
}
|
38
pkg/apis/deployment/v1/arango_task_status.go
Normal file
38
pkg/apis/deployment/v1/arango_task_status.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// 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 v1
|
||||
|
||||
type ArangoTaskState string
|
||||
|
||||
const (
|
||||
ArangoTaskUnknownState ArangoTaskState = ""
|
||||
ArangoTaskPendingState ArangoTaskState = "Pending"
|
||||
ArangoTaskRunningState ArangoTaskState = "Running"
|
||||
ArangoTaskSuccessState ArangoTaskState = "Success"
|
||||
ArangoTaskFailedState ArangoTaskState = "Failed"
|
||||
)
|
||||
|
||||
type ArangoTaskStatus struct {
|
||||
AcceptedSpec *ArangoTaskSpec `json:"acceptedSpec,omitempty"`
|
||||
|
||||
State ArangoTaskState `json:"state,omitempty"`
|
||||
Details ArangoTaskDetails `json:"details,omitempty"`
|
||||
}
|
60
pkg/apis/deployment/v1/arango_task_test.go
Normal file
60
pkg/apis/deployment/v1/arango_task_test.go
Normal file
|
@ -0,0 +1,60 @@
|
|||
//
|
||||
// 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 v1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_ArangoTask_Details(t *testing.T) {
|
||||
arangoTaskDetails(t, int(5))
|
||||
arangoTaskDetails(t, "test")
|
||||
arangoTaskDetails(t, []interface{}{"data", "two"})
|
||||
arangoTaskDetails(t, map[string]interface{}{
|
||||
"data": "exp",
|
||||
})
|
||||
}
|
||||
|
||||
func arangoTaskDetails(t *testing.T, obj interface{}) {
|
||||
arangoTaskDetailsExp(t, obj, obj)
|
||||
}
|
||||
|
||||
func arangoTaskDetailsExp(t *testing.T, obj, exp interface{}) {
|
||||
t.Run(reflect.TypeOf(obj).String(), func(t *testing.T) {
|
||||
var d ArangoTaskDetails
|
||||
|
||||
require.NoError(t, d.Set(obj))
|
||||
|
||||
b, err := json.Marshal(d)
|
||||
require.NoError(t, err)
|
||||
|
||||
var n ArangoTaskDetails
|
||||
require.NoError(t, json.Unmarshal(b, &n))
|
||||
|
||||
require.NoError(t, n.Get(&exp))
|
||||
|
||||
require.EqualValues(t, obj, exp)
|
||||
})
|
||||
}
|
|
@ -52,6 +52,8 @@ func addKnownTypes(s *runtime.Scheme) error {
|
|||
&ArangoMemberList{},
|
||||
&ArangoClusterSynchronization{},
|
||||
&ArangoClusterSynchronizationList{},
|
||||
&ArangoTask{},
|
||||
&ArangoTaskList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(s, SchemeGroupVersion)
|
||||
return nil
|
||||
|
|
165
pkg/apis/deployment/v1/zz_generated.deepcopy.go
generated
165
pkg/apis/deployment/v1/zz_generated.deepcopy.go
generated
|
@ -62,6 +62,28 @@ func (in *Action) DeepCopy() *Action {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in ActionTimeouts) DeepCopyInto(out *ActionTimeouts) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(ActionTimeouts, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActionTimeouts.
|
||||
func (in ActionTimeouts) DeepCopy() ActionTimeouts {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ActionTimeouts)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoClusterSynchronization) DeepCopyInto(out *ArangoClusterSynchronization) {
|
||||
*out = *in
|
||||
|
@ -545,6 +567,134 @@ func (in *ArangoMemberStatus) DeepCopy() *ArangoMemberStatus {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoTask) DeepCopyInto(out *ArangoTask) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTask.
|
||||
func (in *ArangoTask) DeepCopy() *ArangoTask {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTask)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ArangoTask) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in ArangoTaskDetails) DeepCopyInto(out *ArangoTaskDetails) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(ArangoTaskDetails, len(*in))
|
||||
copy(*out, *in)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTaskDetails.
|
||||
func (in ArangoTaskDetails) DeepCopy() ArangoTaskDetails {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTaskDetails)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoTaskList) DeepCopyInto(out *ArangoTaskList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ArangoTask, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTaskList.
|
||||
func (in *ArangoTaskList) DeepCopy() *ArangoTaskList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTaskList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ArangoTaskList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoTaskSpec) DeepCopyInto(out *ArangoTaskSpec) {
|
||||
*out = *in
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
*out = make(ArangoTaskDetails, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTaskSpec.
|
||||
func (in *ArangoTaskSpec) DeepCopy() *ArangoTaskSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTaskSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoTaskStatus) DeepCopyInto(out *ArangoTaskStatus) {
|
||||
*out = *in
|
||||
if in.AcceptedSpec != nil {
|
||||
in, out := &in.AcceptedSpec, &out.AcceptedSpec
|
||||
*out = new(ArangoTaskSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
*out = make(ArangoTaskDetails, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTaskStatus.
|
||||
func (in *ArangoTaskStatus) DeepCopy() *ArangoTaskStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTaskStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *AuthenticationSpec) DeepCopyInto(out *AuthenticationSpec) {
|
||||
*out = *in
|
||||
|
@ -2654,13 +2804,20 @@ func (in *Timeout) DeepCopy() *Timeout {
|
|||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Timeouts) DeepCopyInto(out *Timeouts) {
|
||||
*out = *in
|
||||
if in.AddMember != nil {
|
||||
in, out := &in.AddMember, &out.AddMember
|
||||
if in.MaintenanceGracePeriod != nil {
|
||||
in, out := &in.MaintenanceGracePeriod, &out.MaintenanceGracePeriod
|
||||
*out = new(Timeout)
|
||||
**out = **in
|
||||
}
|
||||
if in.MaintenanceGracePeriod != nil {
|
||||
in, out := &in.MaintenanceGracePeriod, &out.MaintenanceGracePeriod
|
||||
if in.Actions != nil {
|
||||
in, out := &in.Actions, &out.Actions
|
||||
*out = make(ActionTimeouts, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.AddMember != nil {
|
||||
in, out := &in.AddMember, &out.AddMember
|
||||
*out = new(Timeout)
|
||||
**out = **in
|
||||
}
|
||||
|
|
47
pkg/apis/deployment/v2alpha1/arango_task.go
Normal file
47
pkg/apis/deployment/v2alpha1/arango_task.go
Normal file
|
@ -0,0 +1,47 @@
|
|||
//
|
||||
// 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 v2alpha1
|
||||
|
||||
import (
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ArangoTaskList is a list of ArangoDB tasks.
|
||||
type ArangoTaskList struct {
|
||||
meta.TypeMeta `json:",inline"`
|
||||
// Standard list metadata
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
meta.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ArangoTask `json:"items"`
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ArangoTask contains task definition info.
|
||||
type ArangoTask struct {
|
||||
meta.TypeMeta `json:",inline"`
|
||||
meta.ObjectMeta `json:"metadata,omitempty"`
|
||||
Spec ArangoTaskSpec `json:"spec,omitempty"`
|
||||
Status ArangoTaskStatus `json:"status,omitempty"`
|
||||
}
|
74
pkg/apis/deployment/v2alpha1/arango_task_spec.go
Normal file
74
pkg/apis/deployment/v2alpha1/arango_task_spec.go
Normal file
|
@ -0,0 +1,74 @@
|
|||
//
|
||||
// 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 v2alpha1
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
type ArangoTaskType string
|
||||
|
||||
type ArangoTaskDetails []byte
|
||||
|
||||
func (a ArangoTaskDetails) MarshalJSON() ([]byte, error) {
|
||||
d := make([]byte, len(a))
|
||||
|
||||
copy(d, a)
|
||||
|
||||
return d, nil
|
||||
}
|
||||
|
||||
func (a *ArangoTaskDetails) UnmarshalJSON(bytes []byte) error {
|
||||
var i interface{}
|
||||
|
||||
if err := json.Unmarshal(bytes, &i); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
d := make([]byte, len(bytes))
|
||||
|
||||
copy(d, bytes)
|
||||
|
||||
*a = d
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a ArangoTaskDetails) Get(i interface{}) error {
|
||||
return json.Unmarshal(a, &i)
|
||||
}
|
||||
|
||||
func (a *ArangoTaskDetails) Set(i interface{}) error {
|
||||
if d, err := json.Marshal(i); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*a = d
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ json.Unmarshaler = &ArangoTaskDetails{}
|
||||
var _ json.Marshaler = ArangoTaskDetails{}
|
||||
|
||||
type ArangoTaskSpec struct {
|
||||
Type ArangoTaskType `json:"type,omitempty"`
|
||||
|
||||
Details ArangoTaskDetails `json:"details,omitempty"`
|
||||
}
|
38
pkg/apis/deployment/v2alpha1/arango_task_status.go
Normal file
38
pkg/apis/deployment/v2alpha1/arango_task_status.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// 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 v2alpha1
|
||||
|
||||
type ArangoTaskState string
|
||||
|
||||
const (
|
||||
ArangoTaskUnknownState ArangoTaskState = ""
|
||||
ArangoTaskPendingState ArangoTaskState = "Pending"
|
||||
ArangoTaskRunningState ArangoTaskState = "Running"
|
||||
ArangoTaskSuccessState ArangoTaskState = "Success"
|
||||
ArangoTaskFailedState ArangoTaskState = "Failed"
|
||||
)
|
||||
|
||||
type ArangoTaskStatus struct {
|
||||
AcceptedSpec *ArangoTaskSpec `json:"acceptedSpec,omitempty"`
|
||||
|
||||
State ArangoTaskState `json:"state,omitempty"`
|
||||
Details ArangoTaskDetails `json:"details,omitempty"`
|
||||
}
|
59
pkg/apis/deployment/v2alpha1/arango_task_test.go
Normal file
59
pkg/apis/deployment/v2alpha1/arango_task_test.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// 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 v2alpha1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_ArangoTask_Details(t *testing.T) {
|
||||
arangoTaskDetails(t, int(5))
|
||||
arangoTaskDetails(t, "test")
|
||||
arangoTaskDetails(t, []interface{}{"data", "two"})
|
||||
arangoTaskDetails(t, map[string]interface{}{
|
||||
"data": "exp",
|
||||
})
|
||||
}
|
||||
func arangoTaskDetails(t *testing.T, obj interface{}) {
|
||||
arangoTaskDetailsExp(t, obj, obj)
|
||||
}
|
||||
|
||||
func arangoTaskDetailsExp(t *testing.T, obj, exp interface{}) {
|
||||
t.Run(reflect.TypeOf(obj).String(), func(t *testing.T) {
|
||||
var d ArangoTaskDetails
|
||||
|
||||
require.NoError(t, d.Set(obj))
|
||||
|
||||
b, err := json.Marshal(d)
|
||||
require.NoError(t, err)
|
||||
|
||||
var n ArangoTaskDetails
|
||||
require.NoError(t, json.Unmarshal(b, &n))
|
||||
|
||||
require.NoError(t, n.Get(&exp))
|
||||
|
||||
require.EqualValues(t, obj, exp)
|
||||
})
|
||||
}
|
|
@ -52,6 +52,8 @@ func addKnownTypes(s *runtime.Scheme) error {
|
|||
&ArangoMemberList{},
|
||||
&ArangoClusterSynchronization{},
|
||||
&ArangoClusterSynchronizationList{},
|
||||
&ArangoTask{},
|
||||
&ArangoTaskList{},
|
||||
)
|
||||
metav1.AddToGroupVersion(s, SchemeGroupVersion)
|
||||
return nil
|
||||
|
|
|
@ -31,14 +31,18 @@ const (
|
|||
)
|
||||
|
||||
type Timeouts struct {
|
||||
// AddMember action timeout
|
||||
AddMember *Timeout `json:"addMember,omitempty"`
|
||||
|
||||
// MaintenanceGracePeriod action timeout
|
||||
MaintenanceGracePeriod *Timeout `json:"maintenanceGracePeriod,omitempty"`
|
||||
|
||||
// RuntimeContainerImageUpdate action timeout
|
||||
RuntimeContainerImageUpdate *Timeout `json:"runtimeContainerImageUpdate,omitempty"`
|
||||
// Actions
|
||||
Actions ActionTimeouts `json:"actions,omitempty"`
|
||||
|
||||
// deprecated
|
||||
AddMember *Timeout `json:"-"`
|
||||
|
||||
// deprecated
|
||||
RuntimeContainerImageUpdate *Timeout `json:"-"`
|
||||
}
|
||||
|
||||
func (t *Timeouts) GetMaintenanceGracePeriod() time.Duration {
|
||||
|
@ -57,6 +61,12 @@ func (t *Timeouts) Get() Timeouts {
|
|||
return *t
|
||||
}
|
||||
|
||||
type ActionTimeouts map[ActionType]Timeout
|
||||
|
||||
func NewTimeout(timeout time.Duration) Timeout {
|
||||
return Timeout(meta.Duration{Duration: timeout})
|
||||
}
|
||||
|
||||
type Timeout meta.Duration
|
||||
|
||||
func (t *Timeout) Get(d time.Duration) time.Duration {
|
||||
|
|
165
pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go
generated
165
pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go
generated
|
@ -62,6 +62,28 @@ func (in *Action) DeepCopy() *Action {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in ActionTimeouts) DeepCopyInto(out *ActionTimeouts) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(ActionTimeouts, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActionTimeouts.
|
||||
func (in ActionTimeouts) DeepCopy() ActionTimeouts {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ActionTimeouts)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoClusterSynchronization) DeepCopyInto(out *ArangoClusterSynchronization) {
|
||||
*out = *in
|
||||
|
@ -545,6 +567,134 @@ func (in *ArangoMemberStatus) DeepCopy() *ArangoMemberStatus {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoTask) DeepCopyInto(out *ArangoTask) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTask.
|
||||
func (in *ArangoTask) DeepCopy() *ArangoTask {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTask)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ArangoTask) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in ArangoTaskDetails) DeepCopyInto(out *ArangoTaskDetails) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(ArangoTaskDetails, len(*in))
|
||||
copy(*out, *in)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTaskDetails.
|
||||
func (in ArangoTaskDetails) DeepCopy() ArangoTaskDetails {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTaskDetails)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoTaskList) DeepCopyInto(out *ArangoTaskList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ArangoTask, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTaskList.
|
||||
func (in *ArangoTaskList) DeepCopy() *ArangoTaskList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTaskList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ArangoTaskList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoTaskSpec) DeepCopyInto(out *ArangoTaskSpec) {
|
||||
*out = *in
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
*out = make(ArangoTaskDetails, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTaskSpec.
|
||||
func (in *ArangoTaskSpec) DeepCopy() *ArangoTaskSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTaskSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoTaskStatus) DeepCopyInto(out *ArangoTaskStatus) {
|
||||
*out = *in
|
||||
if in.AcceptedSpec != nil {
|
||||
in, out := &in.AcceptedSpec, &out.AcceptedSpec
|
||||
*out = new(ArangoTaskSpec)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
*out = make(ArangoTaskDetails, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoTaskStatus.
|
||||
func (in *ArangoTaskStatus) DeepCopy() *ArangoTaskStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoTaskStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *AuthenticationSpec) DeepCopyInto(out *AuthenticationSpec) {
|
||||
*out = *in
|
||||
|
@ -2654,13 +2804,20 @@ func (in *Timeout) DeepCopy() *Timeout {
|
|||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Timeouts) DeepCopyInto(out *Timeouts) {
|
||||
*out = *in
|
||||
if in.AddMember != nil {
|
||||
in, out := &in.AddMember, &out.AddMember
|
||||
if in.MaintenanceGracePeriod != nil {
|
||||
in, out := &in.MaintenanceGracePeriod, &out.MaintenanceGracePeriod
|
||||
*out = new(Timeout)
|
||||
**out = **in
|
||||
}
|
||||
if in.MaintenanceGracePeriod != nil {
|
||||
in, out := &in.MaintenanceGracePeriod, &out.MaintenanceGracePeriod
|
||||
if in.Actions != nil {
|
||||
in, out := &in.Actions, &out.Actions
|
||||
*out = make(ActionTimeouts, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.AddMember != nil {
|
||||
in, out := &in.AddMember, &out.AddMember
|
||||
*out = new(Timeout)
|
||||
**out = **in
|
||||
}
|
||||
|
|
72
pkg/crd/arangotasks.go
Normal file
72
pkg/crd/arangotasks.go
Normal file
|
@ -0,0 +1,72 @@
|
|||
//
|
||||
// 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 crd
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCRDWithPanic("arangotasks.database.arangodb.com", crd{
|
||||
version: "1.0.1",
|
||||
spec: apiextensions.CustomResourceDefinitionSpec{
|
||||
Group: "database.arangodb.com",
|
||||
Names: apiextensions.CustomResourceDefinitionNames{
|
||||
Plural: "arangotasks",
|
||||
Singular: "arangotask",
|
||||
Kind: "ArangoTask",
|
||||
ListKind: "ArangoTaskList",
|
||||
},
|
||||
Scope: apiextensions.NamespaceScoped,
|
||||
Versions: []apiextensions.CustomResourceDefinitionVersion{
|
||||
{
|
||||
Name: "v1",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: true,
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "v2alpha1",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: false,
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -689,6 +689,7 @@ type testCase struct {
|
|||
ArangoMembers map[string]*api.ArangoMember
|
||||
Nodes map[string]*core.Node
|
||||
ACS map[string]*api.ArangoClusterSynchronization
|
||||
AT map[string]*api.ArangoTask
|
||||
VersionInfo driver.Version
|
||||
|
||||
Extender func(t *testing.T, r *Reconciler, c *testCase)
|
||||
|
@ -696,7 +697,7 @@ type testCase struct {
|
|||
|
||||
func (t testCase) Inspector() inspectorInterface.Inspector {
|
||||
return inspector.NewInspectorFromData(t.Pods, t.Secrets, t.PVCS, t.Services, t.ServiceAccounts, t.PDBS,
|
||||
t.ServiceMonitors, t.ArangoMembers, t.Nodes, t.ACS, t.VersionInfo)
|
||||
t.ServiceMonitors, t.ArangoMembers, t.Nodes, t.ACS, t.AT, t.VersionInfo)
|
||||
}
|
||||
|
||||
func TestCreatePlan(t *testing.T) {
|
||||
|
|
|
@ -137,7 +137,7 @@ func arangoClusterSynchronizationsToMap(ctx context.Context, inspector *inspecto
|
|||
return func() error {
|
||||
acss, err := getArangoClusterSynchronizations(ctx, k, namespace, "")
|
||||
if err != nil {
|
||||
if apiErrors.IsUnauthorized(err) {
|
||||
if apiErrors.IsUnauthorized(err) || apiErrors.IsNotFound(err) {
|
||||
inspector.acs = &arangoClusterSynchronizationLoader{
|
||||
accessible: false,
|
||||
}
|
||||
|
|
191
pkg/deployment/resources/inspector/at.go
Normal file
191
pkg/deployment/resources/inspector/at.go
Normal file
|
@ -0,0 +1,191 @@
|
|||
//
|
||||
// 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"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/globals"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
)
|
||||
|
||||
func (i *inspector) GetArangoTasks() (arangotask.Inspector, bool) {
|
||||
i.lock.Lock()
|
||||
defer i.lock.Unlock()
|
||||
|
||||
if i.at == nil {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
return i.at, i.at.accessible
|
||||
}
|
||||
|
||||
type arangoTaskLoader struct {
|
||||
accessible bool
|
||||
|
||||
at map[string]*api.ArangoTask
|
||||
}
|
||||
|
||||
func (a *arangoTaskLoader) FilterArangoTasks(filters ...arangotask.Filter) []*api.ArangoTask {
|
||||
q := make([]*api.ArangoTask, 0, len(a.at))
|
||||
|
||||
for _, obj := range a.at {
|
||||
if a.filterArangoTasks(obj, filters...) {
|
||||
q = append(q, obj)
|
||||
}
|
||||
}
|
||||
|
||||
return q
|
||||
}
|
||||
|
||||
func (a *arangoTaskLoader) filterArangoTasks(obj *api.ArangoTask, filters ...arangotask.Filter) bool {
|
||||
for _, f := range filters {
|
||||
if !f(obj) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func (a *arangoTaskLoader) ArangoTasks() []*api.ArangoTask {
|
||||
var r []*api.ArangoTask
|
||||
for _, at := range a.at {
|
||||
r = append(r, at)
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (a *arangoTaskLoader) ArangoTask(name string) (*api.ArangoTask, bool) {
|
||||
at, ok := a.at[name]
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
return at, true
|
||||
}
|
||||
|
||||
func (a *arangoTaskLoader) IterateArangoTasks(action arangotask.Action, filters ...arangotask.Filter) error {
|
||||
for _, node := range a.ArangoTasks() {
|
||||
if err := a.iterateArangoTask(node, action, filters...); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *arangoTaskLoader) iterateArangoTask(at *api.ArangoTask, action arangotask.Action, filters ...arangotask.Filter) error {
|
||||
for _, filter := range filters {
|
||||
if !filter(at) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return action(at)
|
||||
}
|
||||
|
||||
func (a *arangoTaskLoader) ArangoTaskReadInterface() arangotask.ReadInterface {
|
||||
return &arangoTaskReadInterface{i: a}
|
||||
}
|
||||
|
||||
type arangoTaskReadInterface struct {
|
||||
i *arangoTaskLoader
|
||||
}
|
||||
|
||||
func (a *arangoTaskReadInterface) Get(ctx context.Context, name string, opts meta.GetOptions) (*api.ArangoTask, error) {
|
||||
if s, ok := a.i.ArangoTask(name); !ok {
|
||||
return nil, apiErrors.NewNotFound(schema.GroupResource{
|
||||
Group: deployment.ArangoDeploymentGroupName,
|
||||
Resource: "arangotasks",
|
||||
}, name)
|
||||
} else {
|
||||
return s, nil
|
||||
}
|
||||
}
|
||||
|
||||
func arangoTaskPointer(at api.ArangoTask) *api.ArangoTask {
|
||||
return &at
|
||||
}
|
||||
|
||||
func arangoTasksToMap(ctx context.Context, inspector *inspector, k versioned.Interface, namespace string) func() error {
|
||||
return func() error {
|
||||
ats, err := getArangoTasks(ctx, k, namespace, "")
|
||||
if err != nil {
|
||||
if apiErrors.IsUnauthorized(err) || apiErrors.IsNotFound(err) {
|
||||
inspector.at = &arangoTaskLoader{
|
||||
accessible: false,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
atsMap := map[string]*api.ArangoTask{}
|
||||
|
||||
for _, at := range ats {
|
||||
_, exists := atsMap[at.GetName()]
|
||||
if exists {
|
||||
return errors.Newf("ArangoMember %s already exists in map, error received", at.GetName())
|
||||
}
|
||||
|
||||
atsMap[at.GetName()] = arangoTaskPointer(at)
|
||||
}
|
||||
|
||||
inspector.at = &arangoTaskLoader{
|
||||
accessible: true,
|
||||
at: atsMap,
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func getArangoTasks(ctx context.Context, k versioned.Interface, namespace, cont string) ([]api.ArangoTask, error) {
|
||||
ctxChild, cancel := globals.GetGlobalTimeouts().Kubernetes().WithTimeout(ctx)
|
||||
defer cancel()
|
||||
ats, err := k.DatabaseV1().ArangoTasks(namespace).List(ctxChild, meta.ListOptions{
|
||||
Limit: globals.GetGlobals().Kubernetes().RequestBatchSize().Get(),
|
||||
Continue: cont,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if ats.Continue != "" {
|
||||
newATLoader, err := getArangoTasks(ctx, k, namespace, ats.Continue)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return append(ats.Items, newATLoader...), nil
|
||||
}
|
||||
|
||||
return ats.Items, nil
|
||||
}
|
|
@ -72,6 +72,7 @@ func newInspector(ctx context.Context, client kclient.Client, namespace string)
|
|||
arangoMembersToMap(ctx, &i, client.Arango(), namespace),
|
||||
nodesToMap(ctx, &i, client.Kubernetes()),
|
||||
arangoClusterSynchronizationsToMap(ctx, &i, client.Arango(), namespace),
|
||||
arangoTasksToMap(ctx, &i, client.Arango(), namespace),
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ func newInspector(ctx context.Context, client kclient.Client, namespace string)
|
|||
}
|
||||
|
||||
func NewEmptyInspector() inspectorInterface.Inspector {
|
||||
return NewInspectorFromData(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, "")
|
||||
return NewInspectorFromData(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, "")
|
||||
}
|
||||
|
||||
func NewInspectorFromData(pods map[string]*core.Pod,
|
||||
|
@ -93,6 +94,7 @@ func NewInspectorFromData(pods map[string]*core.Pod,
|
|||
arangoMembers map[string]*api.ArangoMember,
|
||||
nodes map[string]*core.Node,
|
||||
acs map[string]*api.ArangoClusterSynchronization,
|
||||
at map[string]*api.ArangoTask,
|
||||
version driver.Version) inspectorInterface.Inspector {
|
||||
i := &inspector{
|
||||
pods: pods,
|
||||
|
@ -130,6 +132,18 @@ func NewInspectorFromData(pods map[string]*core.Pod,
|
|||
}
|
||||
}
|
||||
|
||||
if at == nil {
|
||||
i.at = &arangoTaskLoader{
|
||||
accessible: false,
|
||||
at: nil,
|
||||
}
|
||||
} else {
|
||||
i.at = &arangoTaskLoader{
|
||||
accessible: true,
|
||||
at: at,
|
||||
}
|
||||
}
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
|
@ -150,6 +164,7 @@ type inspector struct {
|
|||
arangoMembers map[string]*api.ArangoMember
|
||||
nodes *nodeLoader
|
||||
acs *arangoClusterSynchronizationLoader
|
||||
at *arangoTaskLoader
|
||||
versionInfo driver.Version
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ func (i inspectorMockStruct) AddService(t *testing.T, svc ...*core.Service) insp
|
|||
}
|
||||
|
||||
func (i inspectorMockStruct) Get(t *testing.T) inspectorInterface.Inspector {
|
||||
return inspector.NewInspectorFromData(nil, nil, nil, i.services, nil, nil, nil, nil, nil, nil, "")
|
||||
return inspector.NewInspectorFromData(nil, nil, nil, i.services, nil, nil, nil, nil, nil, nil, nil, "")
|
||||
}
|
||||
|
||||
// TestCreateArangodArgsAgent tests createArangodArgs for agent.
|
||||
|
|
199
pkg/generated/clientset/versioned/typed/deployment/v1/arangotask.go
generated
Normal file
199
pkg/generated/clientset/versioned/typed/deployment/v1/arangotask.go
generated
Normal file
|
@ -0,0 +1,199 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
scheme "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/scheme"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ArangoTasksGetter has a method to return a ArangoTaskInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ArangoTasksGetter interface {
|
||||
ArangoTasks(namespace string) ArangoTaskInterface
|
||||
}
|
||||
|
||||
// ArangoTaskInterface has methods to work with ArangoTask resources.
|
||||
type ArangoTaskInterface interface {
|
||||
Create(ctx context.Context, arangoTask *v1.ArangoTask, opts metav1.CreateOptions) (*v1.ArangoTask, error)
|
||||
Update(ctx context.Context, arangoTask *v1.ArangoTask, opts metav1.UpdateOptions) (*v1.ArangoTask, error)
|
||||
UpdateStatus(ctx context.Context, arangoTask *v1.ArangoTask, opts metav1.UpdateOptions) (*v1.ArangoTask, error)
|
||||
Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.ArangoTask, error)
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1.ArangoTaskList, error)
|
||||
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ArangoTask, err error)
|
||||
ArangoTaskExpansion
|
||||
}
|
||||
|
||||
// arangoTasks implements ArangoTaskInterface
|
||||
type arangoTasks struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newArangoTasks returns a ArangoTasks
|
||||
func newArangoTasks(c *DatabaseV1Client, namespace string) *arangoTasks {
|
||||
return &arangoTasks{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the arangoTask, and returns the corresponding arangoTask object, and an error if there is any.
|
||||
func (c *arangoTasks) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ArangoTask, err error) {
|
||||
result = &v1.ArangoTask{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ArangoTasks that match those selectors.
|
||||
func (c *arangoTasks) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ArangoTaskList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v1.ArangoTaskList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested arangoTasks.
|
||||
func (c *arangoTasks) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a arangoTask and creates it. Returns the server's representation of the arangoTask, and an error, if there is any.
|
||||
func (c *arangoTasks) Create(ctx context.Context, arangoTask *v1.ArangoTask, opts metav1.CreateOptions) (result *v1.ArangoTask, err error) {
|
||||
result = &v1.ArangoTask{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(arangoTask).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a arangoTask and updates it. Returns the server's representation of the arangoTask, and an error, if there is any.
|
||||
func (c *arangoTasks) Update(ctx context.Context, arangoTask *v1.ArangoTask, opts metav1.UpdateOptions) (result *v1.ArangoTask, err error) {
|
||||
result = &v1.ArangoTask{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(arangoTask.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(arangoTask).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *arangoTasks) UpdateStatus(ctx context.Context, arangoTask *v1.ArangoTask, opts metav1.UpdateOptions) (result *v1.ArangoTask, err error) {
|
||||
result = &v1.ArangoTask{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(arangoTask.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(arangoTask).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the arangoTask and deletes it. Returns an error if one occurs.
|
||||
func (c *arangoTasks) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *arangoTasks) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched arangoTask.
|
||||
func (c *arangoTasks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ArangoTask, err error) {
|
||||
result = &v1.ArangoTask{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -33,6 +33,7 @@ type DatabaseV1Interface interface {
|
|||
ArangoClusterSynchronizationsGetter
|
||||
ArangoDeploymentsGetter
|
||||
ArangoMembersGetter
|
||||
ArangoTasksGetter
|
||||
}
|
||||
|
||||
// DatabaseV1Client is used to interact with features provided by the database.arangodb.com group.
|
||||
|
@ -52,6 +53,10 @@ func (c *DatabaseV1Client) ArangoMembers(namespace string) ArangoMemberInterface
|
|||
return newArangoMembers(c, namespace)
|
||||
}
|
||||
|
||||
func (c *DatabaseV1Client) ArangoTasks(namespace string) ArangoTaskInterface {
|
||||
return newArangoTasks(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new DatabaseV1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*DatabaseV1Client, error) {
|
||||
config := *c
|
||||
|
|
146
pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_arangotask.go
generated
Normal file
146
pkg/generated/clientset/versioned/typed/deployment/v1/fake/fake_arangotask.go
generated
Normal file
|
@ -0,0 +1,146 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeArangoTasks implements ArangoTaskInterface
|
||||
type FakeArangoTasks struct {
|
||||
Fake *FakeDatabaseV1
|
||||
ns string
|
||||
}
|
||||
|
||||
var arangotasksResource = schema.GroupVersionResource{Group: "database.arangodb.com", Version: "v1", Resource: "arangotasks"}
|
||||
|
||||
var arangotasksKind = schema.GroupVersionKind{Group: "database.arangodb.com", Version: "v1", Kind: "ArangoTask"}
|
||||
|
||||
// Get takes name of the arangoTask, and returns the corresponding arangoTask object, and an error if there is any.
|
||||
func (c *FakeArangoTasks) Get(ctx context.Context, name string, options v1.GetOptions) (result *deploymentv1.ArangoTask, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(arangotasksResource, c.ns, name), &deploymentv1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*deploymentv1.ArangoTask), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ArangoTasks that match those selectors.
|
||||
func (c *FakeArangoTasks) List(ctx context.Context, opts v1.ListOptions) (result *deploymentv1.ArangoTaskList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(arangotasksResource, arangotasksKind, c.ns, opts), &deploymentv1.ArangoTaskList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &deploymentv1.ArangoTaskList{ListMeta: obj.(*deploymentv1.ArangoTaskList).ListMeta}
|
||||
for _, item := range obj.(*deploymentv1.ArangoTaskList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested arangoTasks.
|
||||
func (c *FakeArangoTasks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(arangotasksResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a arangoTask and creates it. Returns the server's representation of the arangoTask, and an error, if there is any.
|
||||
func (c *FakeArangoTasks) Create(ctx context.Context, arangoTask *deploymentv1.ArangoTask, opts v1.CreateOptions) (result *deploymentv1.ArangoTask, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(arangotasksResource, c.ns, arangoTask), &deploymentv1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*deploymentv1.ArangoTask), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a arangoTask and updates it. Returns the server's representation of the arangoTask, and an error, if there is any.
|
||||
func (c *FakeArangoTasks) Update(ctx context.Context, arangoTask *deploymentv1.ArangoTask, opts v1.UpdateOptions) (result *deploymentv1.ArangoTask, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(arangotasksResource, c.ns, arangoTask), &deploymentv1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*deploymentv1.ArangoTask), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeArangoTasks) UpdateStatus(ctx context.Context, arangoTask *deploymentv1.ArangoTask, opts v1.UpdateOptions) (*deploymentv1.ArangoTask, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(arangotasksResource, "status", c.ns, arangoTask), &deploymentv1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*deploymentv1.ArangoTask), err
|
||||
}
|
||||
|
||||
// Delete takes name of the arangoTask and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeArangoTasks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(arangotasksResource, c.ns, name), &deploymentv1.ArangoTask{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeArangoTasks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(arangotasksResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &deploymentv1.ArangoTaskList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched arangoTask.
|
||||
func (c *FakeArangoTasks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *deploymentv1.ArangoTask, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(arangotasksResource, c.ns, name, pt, data, subresources...), &deploymentv1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*deploymentv1.ArangoTask), err
|
||||
}
|
|
@ -44,6 +44,10 @@ func (c *FakeDatabaseV1) ArangoMembers(namespace string) v1.ArangoMemberInterfac
|
|||
return &FakeArangoMembers{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeDatabaseV1) ArangoTasks(namespace string) v1.ArangoTaskInterface {
|
||||
return &FakeArangoTasks{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeDatabaseV1) RESTClient() rest.Interface {
|
||||
|
|
|
@ -27,3 +27,5 @@ type ArangoClusterSynchronizationExpansion interface{}
|
|||
type ArangoDeploymentExpansion interface{}
|
||||
|
||||
type ArangoMemberExpansion interface{}
|
||||
|
||||
type ArangoTaskExpansion interface{}
|
||||
|
|
199
pkg/generated/clientset/versioned/typed/deployment/v2alpha1/arangotask.go
generated
Normal file
199
pkg/generated/clientset/versioned/typed/deployment/v2alpha1/arangotask.go
generated
Normal file
|
@ -0,0 +1,199 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package v2alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
|
||||
scheme "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/scheme"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ArangoTasksGetter has a method to return a ArangoTaskInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ArangoTasksGetter interface {
|
||||
ArangoTasks(namespace string) ArangoTaskInterface
|
||||
}
|
||||
|
||||
// ArangoTaskInterface has methods to work with ArangoTask resources.
|
||||
type ArangoTaskInterface interface {
|
||||
Create(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.CreateOptions) (*v2alpha1.ArangoTask, error)
|
||||
Update(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.UpdateOptions) (*v2alpha1.ArangoTask, error)
|
||||
UpdateStatus(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.UpdateOptions) (*v2alpha1.ArangoTask, error)
|
||||
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
|
||||
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
|
||||
Get(ctx context.Context, name string, opts v1.GetOptions) (*v2alpha1.ArangoTask, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.ArangoTaskList, error)
|
||||
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoTask, err error)
|
||||
ArangoTaskExpansion
|
||||
}
|
||||
|
||||
// arangoTasks implements ArangoTaskInterface
|
||||
type arangoTasks struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newArangoTasks returns a ArangoTasks
|
||||
func newArangoTasks(c *DatabaseV2alpha1Client, namespace string) *arangoTasks {
|
||||
return &arangoTasks{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
||||
|
||||
// Get takes name of the arangoTask, and returns the corresponding arangoTask object, and an error if there is any.
|
||||
func (c *arangoTasks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ArangoTask, err error) {
|
||||
result = &v2alpha1.ArangoTask{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(name).
|
||||
VersionedParams(&options, scheme.ParameterCodec).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ArangoTasks that match those selectors.
|
||||
func (c *arangoTasks) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ArangoTaskList, err error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
result = &v2alpha1.ArangoTaskList{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested arangoTasks.
|
||||
func (c *arangoTasks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
var timeout time.Duration
|
||||
if opts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
opts.Watch = true
|
||||
return c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Watch(ctx)
|
||||
}
|
||||
|
||||
// Create takes the representation of a arangoTask and creates it. Returns the server's representation of the arangoTask, and an error, if there is any.
|
||||
func (c *arangoTasks) Create(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.CreateOptions) (result *v2alpha1.ArangoTask, err error) {
|
||||
result = &v2alpha1.ArangoTask{}
|
||||
err = c.client.Post().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(arangoTask).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Update takes the representation of a arangoTask and updates it. Returns the server's representation of the arangoTask, and an error, if there is any.
|
||||
func (c *arangoTasks) Update(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.UpdateOptions) (result *v2alpha1.ArangoTask, err error) {
|
||||
result = &v2alpha1.ArangoTask{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(arangoTask.Name).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(arangoTask).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *arangoTasks) UpdateStatus(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.UpdateOptions) (result *v2alpha1.ArangoTask, err error) {
|
||||
result = &v2alpha1.ArangoTask{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(arangoTask.Name).
|
||||
SubResource("status").
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(arangoTask).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete takes name of the arangoTask and deletes it. Returns an error if one occurs.
|
||||
func (c *arangoTasks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(name).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *arangoTasks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
var timeout time.Duration
|
||||
if listOpts.TimeoutSeconds != nil {
|
||||
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
|
||||
}
|
||||
return c.client.Delete().
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
VersionedParams(&listOpts, scheme.ParameterCodec).
|
||||
Timeout(timeout).
|
||||
Body(&opts).
|
||||
Do(ctx).
|
||||
Error()
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched arangoTask.
|
||||
func (c *arangoTasks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoTask, err error) {
|
||||
result = &v2alpha1.ArangoTask{}
|
||||
err = c.client.Patch(pt).
|
||||
Namespace(c.ns).
|
||||
Resource("arangotasks").
|
||||
Name(name).
|
||||
SubResource(subresources...).
|
||||
VersionedParams(&opts, scheme.ParameterCodec).
|
||||
Body(data).
|
||||
Do(ctx).
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -33,6 +33,7 @@ type DatabaseV2alpha1Interface interface {
|
|||
ArangoClusterSynchronizationsGetter
|
||||
ArangoDeploymentsGetter
|
||||
ArangoMembersGetter
|
||||
ArangoTasksGetter
|
||||
}
|
||||
|
||||
// DatabaseV2alpha1Client is used to interact with features provided by the database.arangodb.com group.
|
||||
|
@ -52,6 +53,10 @@ func (c *DatabaseV2alpha1Client) ArangoMembers(namespace string) ArangoMemberInt
|
|||
return newArangoMembers(c, namespace)
|
||||
}
|
||||
|
||||
func (c *DatabaseV2alpha1Client) ArangoTasks(namespace string) ArangoTaskInterface {
|
||||
return newArangoTasks(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new DatabaseV2alpha1Client for the given config.
|
||||
func NewForConfig(c *rest.Config) (*DatabaseV2alpha1Client, error) {
|
||||
config := *c
|
||||
|
|
146
pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_arangotask.go
generated
Normal file
146
pkg/generated/clientset/versioned/typed/deployment/v2alpha1/fake/fake_arangotask.go
generated
Normal file
|
@ -0,0 +1,146 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// Code generated by client-gen. DO NOT EDIT.
|
||||
|
||||
package fake
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
)
|
||||
|
||||
// FakeArangoTasks implements ArangoTaskInterface
|
||||
type FakeArangoTasks struct {
|
||||
Fake *FakeDatabaseV2alpha1
|
||||
ns string
|
||||
}
|
||||
|
||||
var arangotasksResource = schema.GroupVersionResource{Group: "database.arangodb.com", Version: "v2alpha1", Resource: "arangotasks"}
|
||||
|
||||
var arangotasksKind = schema.GroupVersionKind{Group: "database.arangodb.com", Version: "v2alpha1", Kind: "ArangoTask"}
|
||||
|
||||
// Get takes name of the arangoTask, and returns the corresponding arangoTask object, and an error if there is any.
|
||||
func (c *FakeArangoTasks) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ArangoTask, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetAction(arangotasksResource, c.ns, name), &v2alpha1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2alpha1.ArangoTask), err
|
||||
}
|
||||
|
||||
// List takes label and field selectors, and returns the list of ArangoTasks that match those selectors.
|
||||
func (c *FakeArangoTasks) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ArangoTaskList, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewListAction(arangotasksResource, arangotasksKind, c.ns, opts), &v2alpha1.ArangoTaskList{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
label, _, _ := testing.ExtractFromListOptions(opts)
|
||||
if label == nil {
|
||||
label = labels.Everything()
|
||||
}
|
||||
list := &v2alpha1.ArangoTaskList{ListMeta: obj.(*v2alpha1.ArangoTaskList).ListMeta}
|
||||
for _, item := range obj.(*v2alpha1.ArangoTaskList).Items {
|
||||
if label.Matches(labels.Set(item.Labels)) {
|
||||
list.Items = append(list.Items, item)
|
||||
}
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// Watch returns a watch.Interface that watches the requested arangoTasks.
|
||||
func (c *FakeArangoTasks) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
return c.Fake.
|
||||
InvokesWatch(testing.NewWatchAction(arangotasksResource, c.ns, opts))
|
||||
|
||||
}
|
||||
|
||||
// Create takes the representation of a arangoTask and creates it. Returns the server's representation of the arangoTask, and an error, if there is any.
|
||||
func (c *FakeArangoTasks) Create(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.CreateOptions) (result *v2alpha1.ArangoTask, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewCreateAction(arangotasksResource, c.ns, arangoTask), &v2alpha1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2alpha1.ArangoTask), err
|
||||
}
|
||||
|
||||
// Update takes the representation of a arangoTask and updates it. Returns the server's representation of the arangoTask, and an error, if there is any.
|
||||
func (c *FakeArangoTasks) Update(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.UpdateOptions) (result *v2alpha1.ArangoTask, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateAction(arangotasksResource, c.ns, arangoTask), &v2alpha1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2alpha1.ArangoTask), err
|
||||
}
|
||||
|
||||
// UpdateStatus was generated because the type contains a Status member.
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
func (c *FakeArangoTasks) UpdateStatus(ctx context.Context, arangoTask *v2alpha1.ArangoTask, opts v1.UpdateOptions) (*v2alpha1.ArangoTask, error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(arangotasksResource, "status", c.ns, arangoTask), &v2alpha1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2alpha1.ArangoTask), err
|
||||
}
|
||||
|
||||
// Delete takes name of the arangoTask and deletes it. Returns an error if one occurs.
|
||||
func (c *FakeArangoTasks) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
|
||||
_, err := c.Fake.
|
||||
Invokes(testing.NewDeleteAction(arangotasksResource, c.ns, name), &v2alpha1.ArangoTask{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteCollection deletes a collection of objects.
|
||||
func (c *FakeArangoTasks) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
|
||||
action := testing.NewDeleteCollectionAction(arangotasksResource, c.ns, listOpts)
|
||||
|
||||
_, err := c.Fake.Invokes(action, &v2alpha1.ArangoTaskList{})
|
||||
return err
|
||||
}
|
||||
|
||||
// Patch applies the patch and returns the patched arangoTask.
|
||||
func (c *FakeArangoTasks) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoTask, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewPatchSubresourceAction(arangotasksResource, c.ns, name, pt, data, subresources...), &v2alpha1.ArangoTask{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*v2alpha1.ArangoTask), err
|
||||
}
|
|
@ -44,6 +44,10 @@ func (c *FakeDatabaseV2alpha1) ArangoMembers(namespace string) v2alpha1.ArangoMe
|
|||
return &FakeArangoMembers{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeDatabaseV2alpha1) ArangoTasks(namespace string) v2alpha1.ArangoTaskInterface {
|
||||
return &FakeArangoTasks{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeDatabaseV2alpha1) RESTClient() rest.Interface {
|
||||
|
|
|
@ -27,3 +27,5 @@ type ArangoClusterSynchronizationExpansion interface{}
|
|||
type ArangoDeploymentExpansion interface{}
|
||||
|
||||
type ArangoMemberExpansion interface{}
|
||||
|
||||
type ArangoTaskExpansion interface{}
|
||||
|
|
94
pkg/generated/informers/externalversions/deployment/v1/arangotask.go
generated
Normal file
94
pkg/generated/informers/externalversions/deployment/v1/arangotask.go
generated
Normal file
|
@ -0,0 +1,94 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
|
||||
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/deployment/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ArangoTaskInformer provides access to a shared informer and lister for
|
||||
// ArangoTasks.
|
||||
type ArangoTaskInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v1.ArangoTaskLister
|
||||
}
|
||||
|
||||
type arangoTaskInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewArangoTaskInformer constructs a new informer for ArangoTask type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewArangoTaskInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredArangoTaskInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredArangoTaskInformer constructs a new informer for ArangoTask type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredArangoTaskInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DatabaseV1().ArangoTasks(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DatabaseV1().ArangoTasks(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&deploymentv1.ArangoTask{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *arangoTaskInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredArangoTaskInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *arangoTaskInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&deploymentv1.ArangoTask{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *arangoTaskInformer) Lister() v1.ArangoTaskLister {
|
||||
return v1.NewArangoTaskLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -34,6 +34,8 @@ type Interface interface {
|
|||
ArangoDeployments() ArangoDeploymentInformer
|
||||
// ArangoMembers returns a ArangoMemberInformer.
|
||||
ArangoMembers() ArangoMemberInformer
|
||||
// ArangoTasks returns a ArangoTaskInformer.
|
||||
ArangoTasks() ArangoTaskInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
|
@ -61,3 +63,8 @@ func (v *version) ArangoDeployments() ArangoDeploymentInformer {
|
|||
func (v *version) ArangoMembers() ArangoMemberInformer {
|
||||
return &arangoMemberInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ArangoTasks returns a ArangoTaskInformer.
|
||||
func (v *version) ArangoTasks() ArangoTaskInformer {
|
||||
return &arangoTaskInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
|
94
pkg/generated/informers/externalversions/deployment/v2alpha1/arangotask.go
generated
Normal file
94
pkg/generated/informers/externalversions/deployment/v2alpha1/arangotask.go
generated
Normal file
|
@ -0,0 +1,94 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// Code generated by informer-gen. DO NOT EDIT.
|
||||
|
||||
package v2alpha1
|
||||
|
||||
import (
|
||||
"context"
|
||||
time "time"
|
||||
|
||||
deploymentv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
|
||||
versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
|
||||
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
|
||||
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/deployment/v2alpha1"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ArangoTaskInformer provides access to a shared informer and lister for
|
||||
// ArangoTasks.
|
||||
type ArangoTaskInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() v2alpha1.ArangoTaskLister
|
||||
}
|
||||
|
||||
type arangoTaskInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
namespace string
|
||||
}
|
||||
|
||||
// NewArangoTaskInformer constructs a new informer for ArangoTask type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewArangoTaskInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewFilteredArangoTaskInformer(client, namespace, resyncPeriod, indexers, nil)
|
||||
}
|
||||
|
||||
// NewFilteredArangoTaskInformer constructs a new informer for ArangoTask type.
|
||||
// Always prefer using an informer factory to get a shared informer instead of getting an independent
|
||||
// one. This reduces memory footprint and number of connections to the server.
|
||||
func NewFilteredArangoTaskInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return cache.NewSharedIndexInformer(
|
||||
&cache.ListWatch{
|
||||
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DatabaseV2alpha1().ArangoTasks(namespace).List(context.TODO(), options)
|
||||
},
|
||||
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&options)
|
||||
}
|
||||
return client.DatabaseV2alpha1().ArangoTasks(namespace).Watch(context.TODO(), options)
|
||||
},
|
||||
},
|
||||
&deploymentv2alpha1.ArangoTask{},
|
||||
resyncPeriod,
|
||||
indexers,
|
||||
)
|
||||
}
|
||||
|
||||
func (f *arangoTaskInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewFilteredArangoTaskInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
|
||||
}
|
||||
|
||||
func (f *arangoTaskInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&deploymentv2alpha1.ArangoTask{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *arangoTaskInformer) Lister() v2alpha1.ArangoTaskLister {
|
||||
return v2alpha1.NewArangoTaskLister(f.Informer().GetIndexer())
|
||||
}
|
|
@ -34,6 +34,8 @@ type Interface interface {
|
|||
ArangoDeployments() ArangoDeploymentInformer
|
||||
// ArangoMembers returns a ArangoMemberInformer.
|
||||
ArangoMembers() ArangoMemberInformer
|
||||
// ArangoTasks returns a ArangoTaskInformer.
|
||||
ArangoTasks() ArangoTaskInformer
|
||||
}
|
||||
|
||||
type version struct {
|
||||
|
@ -61,3 +63,8 @@ func (v *version) ArangoDeployments() ArangoDeploymentInformer {
|
|||
func (v *version) ArangoMembers() ArangoMemberInformer {
|
||||
return &arangoMemberInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ArangoTasks returns a ArangoTaskInformer.
|
||||
func (v *version) ArangoTasks() ArangoTaskInformer {
|
||||
return &arangoTaskInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||
return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V1().ArangoDeployments().Informer()}, nil
|
||||
case deploymentv1.SchemeGroupVersion.WithResource("arangomembers"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V1().ArangoMembers().Informer()}, nil
|
||||
case deploymentv1.SchemeGroupVersion.WithResource("arangotasks"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V1().ArangoTasks().Informer()}, nil
|
||||
|
||||
// Group=database.arangodb.com, Version=v2alpha1
|
||||
case v2alpha1.SchemeGroupVersion.WithResource("arangoclustersynchronizations"):
|
||||
|
@ -87,6 +89,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||
return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V2alpha1().ArangoDeployments().Informer()}, nil
|
||||
case v2alpha1.SchemeGroupVersion.WithResource("arangomembers"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V2alpha1().ArangoMembers().Informer()}, nil
|
||||
case v2alpha1.SchemeGroupVersion.WithResource("arangotasks"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Database().V2alpha1().ArangoTasks().Informer()}, nil
|
||||
|
||||
// Group=replication.database.arangodb.com, Version=v1
|
||||
case replicationv1.SchemeGroupVersion.WithResource("arangodeploymentreplications"):
|
||||
|
|
103
pkg/generated/listers/deployment/v1/arangotask.go
generated
Normal file
103
pkg/generated/listers/deployment/v1/arangotask.go
generated
Normal file
|
@ -0,0 +1,103 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
v1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ArangoTaskLister helps list ArangoTasks.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type ArangoTaskLister interface {
|
||||
// List lists all ArangoTasks in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.ArangoTask, err error)
|
||||
// ArangoTasks returns an object that can list and get ArangoTasks.
|
||||
ArangoTasks(namespace string) ArangoTaskNamespaceLister
|
||||
ArangoTaskListerExpansion
|
||||
}
|
||||
|
||||
// arangoTaskLister implements the ArangoTaskLister interface.
|
||||
type arangoTaskLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewArangoTaskLister returns a new ArangoTaskLister.
|
||||
func NewArangoTaskLister(indexer cache.Indexer) ArangoTaskLister {
|
||||
return &arangoTaskLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all ArangoTasks in the indexer.
|
||||
func (s *arangoTaskLister) List(selector labels.Selector) (ret []*v1.ArangoTask, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.ArangoTask))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// ArangoTasks returns an object that can list and get ArangoTasks.
|
||||
func (s *arangoTaskLister) ArangoTasks(namespace string) ArangoTaskNamespaceLister {
|
||||
return arangoTaskNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// ArangoTaskNamespaceLister helps list and get ArangoTasks.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type ArangoTaskNamespaceLister interface {
|
||||
// List lists all ArangoTasks in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v1.ArangoTask, err error)
|
||||
// Get retrieves the ArangoTask from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v1.ArangoTask, error)
|
||||
ArangoTaskNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// arangoTaskNamespaceLister implements the ArangoTaskNamespaceLister
|
||||
// interface.
|
||||
type arangoTaskNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all ArangoTasks in the indexer for a given namespace.
|
||||
func (s arangoTaskNamespaceLister) List(selector labels.Selector) (ret []*v1.ArangoTask, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v1.ArangoTask))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the ArangoTask from the indexer for a given namespace and name.
|
||||
func (s arangoTaskNamespaceLister) Get(name string) (*v1.ArangoTask, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v1.Resource("arangotask"), name)
|
||||
}
|
||||
return obj.(*v1.ArangoTask), nil
|
||||
}
|
|
@ -45,3 +45,11 @@ type ArangoMemberListerExpansion interface{}
|
|||
// ArangoMemberNamespaceListerExpansion allows custom methods to be added to
|
||||
// ArangoMemberNamespaceLister.
|
||||
type ArangoMemberNamespaceListerExpansion interface{}
|
||||
|
||||
// ArangoTaskListerExpansion allows custom methods to be added to
|
||||
// ArangoTaskLister.
|
||||
type ArangoTaskListerExpansion interface{}
|
||||
|
||||
// ArangoTaskNamespaceListerExpansion allows custom methods to be added to
|
||||
// ArangoTaskNamespaceLister.
|
||||
type ArangoTaskNamespaceListerExpansion interface{}
|
||||
|
|
103
pkg/generated/listers/deployment/v2alpha1/arangotask.go
generated
Normal file
103
pkg/generated/listers/deployment/v2alpha1/arangotask.go
generated
Normal file
|
@ -0,0 +1,103 @@
|
|||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// Code generated by lister-gen. DO NOT EDIT.
|
||||
|
||||
package v2alpha1
|
||||
|
||||
import (
|
||||
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// ArangoTaskLister helps list ArangoTasks.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type ArangoTaskLister interface {
|
||||
// List lists all ArangoTasks in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v2alpha1.ArangoTask, err error)
|
||||
// ArangoTasks returns an object that can list and get ArangoTasks.
|
||||
ArangoTasks(namespace string) ArangoTaskNamespaceLister
|
||||
ArangoTaskListerExpansion
|
||||
}
|
||||
|
||||
// arangoTaskLister implements the ArangoTaskLister interface.
|
||||
type arangoTaskLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewArangoTaskLister returns a new ArangoTaskLister.
|
||||
func NewArangoTaskLister(indexer cache.Indexer) ArangoTaskLister {
|
||||
return &arangoTaskLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all ArangoTasks in the indexer.
|
||||
func (s *arangoTaskLister) List(selector labels.Selector) (ret []*v2alpha1.ArangoTask, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v2alpha1.ArangoTask))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// ArangoTasks returns an object that can list and get ArangoTasks.
|
||||
func (s *arangoTaskLister) ArangoTasks(namespace string) ArangoTaskNamespaceLister {
|
||||
return arangoTaskNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// ArangoTaskNamespaceLister helps list and get ArangoTasks.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type ArangoTaskNamespaceLister interface {
|
||||
// List lists all ArangoTasks in the indexer for a given namespace.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*v2alpha1.ArangoTask, err error)
|
||||
// Get retrieves the ArangoTask from the indexer for a given namespace and name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*v2alpha1.ArangoTask, error)
|
||||
ArangoTaskNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// arangoTaskNamespaceLister implements the ArangoTaskNamespaceLister
|
||||
// interface.
|
||||
type arangoTaskNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all ArangoTasks in the indexer for a given namespace.
|
||||
func (s arangoTaskNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.ArangoTask, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*v2alpha1.ArangoTask))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the ArangoTask from the indexer for a given namespace and name.
|
||||
func (s arangoTaskNamespaceLister) Get(name string) (*v2alpha1.ArangoTask, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(v2alpha1.Resource("arangotask"), name)
|
||||
}
|
||||
return obj.(*v2alpha1.ArangoTask), nil
|
||||
}
|
|
@ -45,3 +45,11 @@ type ArangoMemberListerExpansion interface{}
|
|||
// ArangoMemberNamespaceListerExpansion allows custom methods to be added to
|
||||
// ArangoMemberNamespaceLister.
|
||||
type ArangoMemberNamespaceListerExpansion interface{}
|
||||
|
||||
// ArangoTaskListerExpansion allows custom methods to be added to
|
||||
// ArangoTaskLister.
|
||||
type ArangoTaskListerExpansion interface{}
|
||||
|
||||
// ArangoTaskNamespaceListerExpansion allows custom methods to be added to
|
||||
// ArangoTaskNamespaceLister.
|
||||
type ArangoTaskNamespaceListerExpansion interface{}
|
||||
|
|
40
pkg/util/k8sutil/inspector/arangotask/loader.go
Normal file
40
pkg/util/k8sutil/inspector/arangotask/loader.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
//
|
||||
// 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 arangotask
|
||||
|
||||
import (
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
)
|
||||
|
||||
type Loader interface {
|
||||
GetArangoTasks() (Inspector, bool)
|
||||
}
|
||||
|
||||
type Inspector interface {
|
||||
ArangoTasks() []*api.ArangoTask
|
||||
ArangoTask(name string) (*api.ArangoTask, bool)
|
||||
FilterArangoTasks(filters ...Filter) []*api.ArangoTask
|
||||
IterateArangoTasks(action Action, filters ...Filter) error
|
||||
ArangoTaskReadInterface() ReadInterface
|
||||
}
|
||||
|
||||
type Filter func(acs *api.ArangoTask) bool
|
||||
type Action func(acs *api.ArangoTask) error
|
38
pkg/util/k8sutil/inspector/arangotask/reader.go
Normal file
38
pkg/util/k8sutil/inspector/arangotask/reader.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// 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 arangotask
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// Interface has methods to work with Node resources.
|
||||
type Interface interface {
|
||||
ReadInterface
|
||||
}
|
||||
|
||||
// ReadInterface has methods to work with Node resources with ReadOnly mode.
|
||||
type ReadInterface interface {
|
||||
Get(ctx context.Context, name string, opts meta.GetOptions) (*api.ArangoTask, error)
|
||||
}
|
|
@ -27,6 +27,7 @@ import (
|
|||
|
||||
"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"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/persistentvolumeclaim"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/pod"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget"
|
||||
|
@ -50,4 +51,5 @@ type Inspector interface {
|
|||
|
||||
node.Loader
|
||||
arangoclustersynchronization.Loader
|
||||
arangotask.Loader
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue