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

[Feature] Switch k8s to 1.19 (#701)

This commit is contained in:
Adam Janikowski 2021-03-23 16:47:28 +01:00 committed by GitHub
parent c65c909757
commit 73d178e4a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
173 changed files with 1389 additions and 1788 deletions

View file

@ -1,6 +1,7 @@
# Change Log
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
- Bump Kubernetes Dependencies to 1.19.x
## [1.1.6](https://github.com/arangodb/kube-arangodb/tree/1.1.6) (2021-03-02)
- Add ArangoMember Resource and required RBAC rules

View file

@ -229,7 +229,7 @@ endif
.PHONY: update-vendor
update-vendor:
@rm -Rf $(VENDORDIR)/k8s.io/code-generator
@git clone --branch kubernetes-1.16.15 https://github.com/kubernetes/code-generator.git $(VENDORDIR)/k8s.io/code-generator
@git clone --branch kubernetes-1.19.8 https://github.com/kubernetes/code-generator.git $(VENDORDIR)/k8s.io/code-generator
@rm -Rf $(VENDORDIR)/k8s.io/code-generator/.git

50
go.mod
View file

@ -4,21 +4,22 @@ go 1.13
replace (
github.com/arangodb/go-driver => github.com/arangodb/go-driver v0.0.0-20200617115956-9dac4c7fed22
github.com/coreos/prometheus-operator => github.com/coreos/prometheus-operator v0.37.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring => github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.46.0
github.com/prometheus-operator/prometheus-operator/pkg/client => github.com/prometheus-operator/prometheus-operator/pkg/client v0.46.0
github.com/stretchr/testify => github.com/stretchr/testify v1.5.1
github.com/ugorji/go => github.com/ugorji/go v0.0.0-20181209151446-772ced7fd4c2
k8s.io/api => k8s.io/api v0.16.15
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.16.15
k8s.io/apimachinery => k8s.io/apimachinery v0.16.15
k8s.io/apiserver => k8s.io/apiserver v0.16.15
k8s.io/client-go => k8s.io/client-go v0.16.15
k8s.io/cloud-provider => k8s.io/cloud-provider v0.16.15
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.16.15
k8s.io/api => k8s.io/api v0.19.8
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.19.8
k8s.io/apimachinery => k8s.io/apimachinery v0.19.8
k8s.io/apiserver => k8s.io/apiserver v0.19.8
k8s.io/client-go => k8s.io/client-go v0.19.8
k8s.io/cloud-provider => k8s.io/cloud-provider v0.19.8
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.19.8
k8s.io/code-generator => ./deps/k8s.io/code-generator
k8s.io/component-base => k8s.io/component-base v0.16.15
k8s.io/kubernetes => k8s.io/kubernetes v0.16.15
k8s.io/metrics => k8s.io/metrics v0.16.15
k8s.io/component-base => k8s.io/component-base v0.19.8
k8s.io/kubernetes => k8s.io/kubernetes v0.19.8
k8s.io/metrics => k8s.io/metrics v0.19.8
)
require (
@ -28,37 +29,38 @@ require (
github.com/arangodb/go-upgrade-rules v0.0.0-20180809110947-031b4774ff21
github.com/cenkalti/backoff v2.1.1+incompatible
github.com/coreos/go-semver v0.3.0
github.com/coreos/prometheus-operator v0.37.0
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/ghodss/yaml v1.0.0
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3 // indirect
github.com/gin-gonic/gin v1.3.0
github.com/google/addlicense v0.0.0-20200906110928-a0294312aa76 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/jessevdk/go-assets v0.0.0-20160921144138-4f4301a06e15
github.com/jessevdk/go-assets-builder v0.0.0-20130903091706-b8483521738f
github.com/jessevdk/go-flags v1.4.0 // indirect
github.com/julienschmidt/httprouter v1.3.0
github.com/magiconair/properties v1.8.0
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v1.2.1
github.com/onsi/gomega v1.7.1 // indirect
github.com/pkg/errors v0.9.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.44.1
github.com/prometheus-operator/prometheus-operator/pkg/client v0.0.0-00010101000000-000000000000
github.com/prometheus/client_golang v1.7.1
github.com/robfig/cron v1.2.0
github.com/rs/zerolog v1.14.3
github.com/spf13/cobra v0.0.5
github.com/spf13/cobra v1.0.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.5.1
github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2 // indirect
golang.org/x/mod v0.4.1 // indirect
golang.org/x/net v0.0.0-20201021035429-f5854403a974
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210223085322-b80eb88b80d2
golang.org/x/tools v0.1.0 // indirect
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
k8s.io/api v0.17.3
k8s.io/apiextensions-apiserver v0.17.3
k8s.io/apimachinery v0.17.3
k8s.io/api v0.19.8
k8s.io/apiextensions-apiserver v0.18.3
k8s.io/apimachinery v0.19.8
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog v1.0.0
)

604
go.sum

File diff suppressed because it is too large Load diff

View file

@ -23,6 +23,7 @@
package main
import (
"context"
"io"
"os"
"path/filepath"
@ -90,7 +91,7 @@ func cmdLifecyclePreStopRun(cmd *cobra.Command, args []string) {
pods := kubecli.CoreV1().Pods(namespace)
recentErrors := 0
for {
p, err := pods.Get(name, metav1.GetOptions{})
p, err := pods.Get(context.Background(), name, metav1.GetOptions{})
if k8sutil.IsNotFound(err) {
cliLog.Warn().Msg("Pod not found")
return

View file

@ -23,6 +23,7 @@
package main
import (
"context"
goflag "flag"
"fmt"
"net"
@ -345,7 +346,7 @@ func newOperatorConfigAndDeps(id, namespace, name string) (operator.Config, oper
func getMyPodInfo(kubecli kubernetes.Interface, namespace, name string) (string, string, error) {
var image, sa string
op := func() error {
pod, err := kubecli.CoreV1().Pods(namespace).Get(name, metav1.GetOptions{})
pod, err := kubecli.CoreV1().Pods(namespace).Get(context.Background(), name, metav1.GetOptions{})
if err != nil {
cliLog.Error().
Err(err).

View file

@ -23,6 +23,7 @@
package backup
import (
"context"
"fmt"
"testing"
@ -133,13 +134,13 @@ func newArangoBackup(objectRef, namespace, name string, state state.State) *back
func createArangoBackup(t *testing.T, h *handler, backups ...*backupApi.ArangoBackup) {
for _, backup := range backups {
_, err := h.client.BackupV1().ArangoBackups(backup.Namespace).Create(backup)
_, err := h.client.BackupV1().ArangoBackups(backup.Namespace).Create(context.Background(), backup, meta.CreateOptions{})
require.NoError(t, err)
}
}
func refreshArangoBackup(t *testing.T, h *handler, backup *backupApi.ArangoBackup) *backupApi.ArangoBackup {
obj, err := h.client.BackupV1().ArangoBackups(backup.Namespace).Get(backup.Name, meta.GetOptions{})
obj, err := h.client.BackupV1().ArangoBackups(backup.Namespace).Get(context.Background(), backup.Name, meta.GetOptions{})
require.NoError(t, err)
return obj
}
@ -165,7 +166,7 @@ func newArangoDeployment(namespace, name string) *database.ArangoDeployment {
func createArangoDeployment(t *testing.T, h *handler, deployments ...*database.ArangoDeployment) {
for _, deployment := range deployments {
_, err := h.client.DatabaseV1().ArangoDeployments(deployment.Namespace).Create(deployment)
_, err := h.client.DatabaseV1().ArangoDeployments(deployment.Namespace).Create(context.Background(), deployment, meta.CreateOptions{})
require.NoError(t, err)
}
}

View file

@ -23,6 +23,8 @@
package backup
import (
"context"
"github.com/arangodb/go-driver"
backupApi "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"
"github.com/arangodb/kube-arangodb/pkg/backup/utils"
@ -61,7 +63,7 @@ func (h *handler) finalize(backup *backupApi.ArangoBackup) error {
i)
}
if _, err := h.client.BackupV1().ArangoBackups(backup.Namespace).Update(backup); err != nil {
if _, err := h.client.BackupV1().ArangoBackups(backup.Namespace).Update(context.Background(), backup, meta.UpdateOptions{}); err != nil {
return err
}
@ -94,7 +96,7 @@ func (h *handler) finalizeBackup(backup *backupApi.ArangoBackup) error {
return err
}
backups, err := h.client.BackupV1().ArangoBackups(backup.Namespace).List(meta.ListOptions{})
backups, err := h.client.BackupV1().ArangoBackups(backup.Namespace).List(context.Background(), meta.ListOptions{})
if err != nil {
return err
}

View file

@ -23,6 +23,7 @@
package backup
import (
"context"
"fmt"
"sync"
"time"
@ -103,7 +104,7 @@ func (h *handler) start(stopCh <-chan struct{}) {
}
func (h *handler) refresh() error {
deployments, err := h.client.DatabaseV1().ArangoDeployments(h.operator.Namespace()).List(meta.ListOptions{})
deployments, err := h.client.DatabaseV1().ArangoDeployments(h.operator.Namespace()).List(context.Background(), meta.ListOptions{})
if err != nil {
return err
}
@ -127,7 +128,7 @@ func (h *handler) refreshDeployment(deployment *database.ArangoDeployment) error
return err
}
backups, err := h.client.BackupV1().ArangoBackups(deployment.Namespace).List(meta.ListOptions{})
backups, err := h.client.BackupV1().ArangoBackups(deployment.Namespace).List(context.Background(), meta.ListOptions{})
if err != nil {
return err
}
@ -176,7 +177,7 @@ func (h *handler) refreshDeploymentBackup(deployment *database.ArangoDeployment,
},
}
_, err := h.client.BackupV1().ArangoBackups(backup.Namespace).Create(backup)
_, err := h.client.BackupV1().ArangoBackups(backup.Namespace).Create(context.Background(), backup, meta.CreateOptions{})
if err != nil {
return err
}
@ -202,14 +203,14 @@ func (h *handler) Name() string {
func (h *handler) updateBackupStatus(b *backupApi.ArangoBackup) error {
return utils.Retry(retryCount, retryDelay, func() error {
backup, err := h.client.BackupV1().ArangoBackups(b.Namespace).Get(b.Name, meta.GetOptions{})
backup, err := h.client.BackupV1().ArangoBackups(b.Namespace).Get(context.Background(), b.Name, meta.GetOptions{})
if err != nil {
return err
}
backup.Status = b.Status
_, err = h.client.BackupV1().ArangoBackups(b.Namespace).UpdateStatus(backup)
_, err = h.client.BackupV1().ArangoBackups(b.Namespace).UpdateStatus(context.Background(), backup, meta.UpdateOptions{})
return err
})
}
@ -233,7 +234,7 @@ func (h *handler) getDeploymentMutex(namespace, deployment string) *sync.Mutex {
func (h *handler) Handle(item operation.Item) error {
// Get Backup object. It also cover NotFound case
b, err := h.client.BackupV1().ArangoBackups(item.Namespace).Get(item.Name, meta.GetOptions{})
b, err := h.client.BackupV1().ArangoBackups(item.Namespace).Get(context.Background(), item.Name, meta.GetOptions{})
if err != nil {
if apiErrors.IsNotFound(err) {
return nil
@ -260,7 +261,7 @@ func (h *handler) Handle(item operation.Item) error {
item.Namespace,
item.Name)
if _, err = h.client.BackupV1().ArangoBackups(item.Namespace).Update(b); err != nil {
if _, err = h.client.BackupV1().ArangoBackups(item.Namespace).Update(context.Background(), b, meta.UpdateOptions{}); err != nil {
return err
}
@ -274,18 +275,18 @@ func (h *handler) Handle(item operation.Item) error {
// Add owner reference
if b.OwnerReferences == nil || len(b.OwnerReferences) == 0 {
deployment, err := h.client.DatabaseV1().ArangoDeployments(b.Namespace).Get(b.Spec.Deployment.Name, meta.GetOptions{})
deployment, err := h.client.DatabaseV1().ArangoDeployments(b.Namespace).Get(context.Background(), b.Spec.Deployment.Name, meta.GetOptions{})
if err == nil {
b.OwnerReferences = []meta.OwnerReference{
deployment.AsOwner(),
}
if _, err = h.client.BackupV1().ArangoBackups(item.Namespace).Update(b); err != nil {
if _, err = h.client.BackupV1().ArangoBackups(item.Namespace).Update(context.Background(), b, meta.UpdateOptions{}); err != nil {
return err
}
}
b, err = h.client.BackupV1().ArangoBackups(item.Namespace).Get(item.Name, meta.GetOptions{})
b, err = h.client.BackupV1().ArangoBackups(item.Namespace).Get(context.Background(), item.Name, meta.GetOptions{})
if err != nil {
if apiErrors.IsNotFound(err) {
return nil
@ -388,7 +389,7 @@ func (h *handler) getArangoDeploymentObject(backup *backupApi.ArangoBackup) (*da
return nil, newFatalErrorf("deployment ref is not specified for backup %s/%s", backup.Namespace, backup.Name)
}
obj, err := h.client.DatabaseV1().ArangoDeployments(backup.Namespace).Get(backup.Spec.Deployment.Name, meta.GetOptions{})
obj, err := h.client.DatabaseV1().ArangoDeployments(backup.Namespace).Get(context.Background(), backup.Spec.Deployment.Name, meta.GetOptions{})
if err == nil {
return obj, nil
}

View file

@ -23,6 +23,7 @@
package backup
import (
"context"
"time"
"github.com/arangodb/kube-arangodb/pkg/apis/backup"
@ -44,7 +45,7 @@ func (h *handler) LifecyclePreStart() error {
}()
for {
_, err := h.client.BackupV1().ArangoBackups(h.operator.Namespace()).List(meta.ListOptions{})
_, err := h.client.BackupV1().ArangoBackups(h.operator.Namespace()).List(context.Background(), meta.ListOptions{})
if err != nil {
log.Warn().Err(err).Msgf("CR for %s not found", backup.ArangoBackupResourceKind)

View file

@ -23,6 +23,7 @@
package backup
import (
"context"
"strings"
clientBackup "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/backup/v1"
@ -55,7 +56,7 @@ func inProgress(backup *backupApi.ArangoBackup) bool {
}
func isBackupRunning(backup *backupApi.ArangoBackup, client clientBackup.ArangoBackupInterface) (bool, error) {
backups, err := client.List(meta.ListOptions{})
backups, err := client.List(context.Background(), meta.ListOptions{})
if err != nil {
return false, newTemporaryError(err)

View file

@ -23,6 +23,7 @@
package policy
import (
"context"
"fmt"
"reflect"
"time"
@ -68,7 +69,7 @@ func (h *handler) Handle(item operation.Item) error {
}
// Get Backup object. It also cover NotFound case
policy, err := h.client.BackupV1().ArangoBackupPolicies(item.Namespace).Get(item.Name, meta.GetOptions{})
policy, err := h.client.BackupV1().ArangoBackupPolicies(item.Namespace).Get(context.Background(), item.Name, meta.GetOptions{})
if err != nil {
return err
}
@ -86,7 +87,7 @@ func (h *handler) Handle(item operation.Item) error {
policy.Status = status
// Update status on object
if _, err = h.client.BackupV1().ArangoBackupPolicies(item.Namespace).UpdateStatus(policy); err != nil {
if _, err = h.client.BackupV1().ArangoBackupPolicies(item.Namespace).UpdateStatus(context.Background(), policy, meta.UpdateOptions{}); err != nil {
return err
}
@ -150,7 +151,7 @@ func (h *handler) processBackupPolicy(policy *backupApi.ArangoBackupPolicy) (bac
listOptions.LabelSelector = meta.FormatLabelSelector(policy.Spec.DeploymentSelector)
}
deployments, err := h.client.DatabaseV1().ArangoDeployments(policy.Namespace).List(listOptions)
deployments, err := h.client.DatabaseV1().ArangoDeployments(policy.Namespace).List(context.Background(), listOptions)
if err != nil {
h.eventRecorder.Warning(policy, policyError, "Policy Error: %s", err.Error())
@ -164,7 +165,7 @@ func (h *handler) processBackupPolicy(policy *backupApi.ArangoBackupPolicy) (bac
for _, deployment := range deployments.Items {
b := policy.NewBackup(deployment.DeepCopy())
if _, err := h.client.BackupV1().ArangoBackups(b.Namespace).Create(b); err != nil {
if _, err := h.client.BackupV1().ArangoBackups(b.Namespace).Create(context.Background(), b, meta.CreateOptions{}); err != nil {
h.eventRecorder.Warning(policy, policyError, "Policy Error: %s", err.Error())
return backupApi.ArangoBackupPolicyStatus{

View file

@ -23,6 +23,7 @@
package policy
import (
"context"
"fmt"
"testing"
@ -99,7 +100,7 @@ func newArangoBackupPolicy(schedule, namespace, name string, selector map[string
}
func refreshArangoBackupPolicy(t *testing.T, h *handler, policy *backupApi.ArangoBackupPolicy) *backupApi.ArangoBackupPolicy {
newPolicy, err := h.client.BackupV1().ArangoBackupPolicies(policy.Namespace).Get(policy.Name, meta.GetOptions{})
newPolicy, err := h.client.BackupV1().ArangoBackupPolicies(policy.Namespace).Get(context.Background(), policy.Name, meta.GetOptions{})
require.NoError(t, err)
return newPolicy
@ -107,14 +108,14 @@ func refreshArangoBackupPolicy(t *testing.T, h *handler, policy *backupApi.Arang
func createArangoBackupPolicy(t *testing.T, h *handler, policies ...*backupApi.ArangoBackupPolicy) {
for _, policy := range policies {
_, err := h.client.BackupV1().ArangoBackupPolicies(policy.Namespace).Create(policy)
_, err := h.client.BackupV1().ArangoBackupPolicies(policy.Namespace).Create(context.Background(), policy, meta.CreateOptions{})
require.NoError(t, err)
}
}
func updateArangoBackupPolicy(t *testing.T, h *handler, policies ...*backupApi.ArangoBackupPolicy) {
for _, policy := range policies {
_, err := h.client.BackupV1().ArangoBackupPolicies(policy.Namespace).Update(policy)
_, err := h.client.BackupV1().ArangoBackupPolicies(policy.Namespace).Update(context.Background(), policy, meta.UpdateOptions{})
require.NoError(t, err)
}
}
@ -142,13 +143,13 @@ func newArangoDeployment(namespace string, labels map[string]string) *database.A
func createArangoDeployment(t *testing.T, h *handler, deployments ...*database.ArangoDeployment) {
for _, deployment := range deployments {
_, err := h.client.DatabaseV1().ArangoDeployments(deployment.Namespace).Create(deployment)
_, err := h.client.DatabaseV1().ArangoDeployments(deployment.Namespace).Create(context.Background(), deployment, meta.CreateOptions{})
require.NoError(t, err)
}
}
func listArangoBackups(t *testing.T, handler *handler, namespace string) []backupApi.ArangoBackup {
result, err := handler.client.BackupV1().ArangoBackups(namespace).List(meta.ListOptions{})
result, err := handler.client.BackupV1().ArangoBackups(namespace).List(context.Background(), meta.ListOptions{})
require.NoError(t, err)
return result.Items

View file

@ -23,6 +23,7 @@
package policy
import (
"context"
"time"
"github.com/arangodb/kube-arangodb/pkg/apis/backup"
@ -44,7 +45,7 @@ func (h *handler) LifecyclePreStart() error {
}()
for {
_, err := h.client.BackupV1().ArangoBackupPolicies(h.operator.Namespace()).List(meta.ListOptions{})
_, err := h.client.BackupV1().ArangoBackupPolicies(h.operator.Namespace()).List(context.Background(), meta.ListOptions{})
if err != nil {
log.Warn().Err(err).Msgf("CR for %s not found", backup.ArangoBackupPolicyResourceKind)

View file

@ -23,6 +23,7 @@
package event
import (
"context"
"fmt"
"github.com/rs/zerolog/log"
@ -87,7 +88,7 @@ func (e *eventRecorder) newObjectReference(group, version, kind string, object m
}
func (e *eventRecorder) event(group, version, kind string, object meta.Object, eventType, reason, message string) {
_, err := e.kubeClientSet.CoreV1().Events(object.GetNamespace()).Create(e.newEvent(group, version, kind, object, eventType, reason, message))
_, err := e.kubeClientSet.CoreV1().Events(object.GetNamespace()).Create(context.Background(), e.newEvent(group, version, kind, object, eventType, reason, message), meta.CreateOptions{})
if err != nil {
log.Warn().Err(err).
Str("APIVersion", fmt.Sprintf("%s/%s", group, version)).

View file

@ -23,6 +23,7 @@
package event
import (
"context"
"fmt"
"testing"
@ -70,7 +71,7 @@ func Test_Event_Handler(t *testing.T) {
call(p, reason, message)
// Assert
events, err := c.CoreV1().Events(namespace).List(meta.ListOptions{})
events, err := c.CoreV1().Events(namespace).List(context.Background(), meta.ListOptions{})
require.NoError(t, err)
require.Len(t, events.Items, 1)
@ -85,7 +86,7 @@ func Test_Event_Handler(t *testing.T) {
assert.Equal(t, namespace, event.InvolvedObject.Namespace)
assert.Equal(t, name, event.InvolvedObject.Name)
require.NoError(t, c.CoreV1().Events(namespace).Delete(event.Name, &meta.DeleteOptions{}))
require.NoError(t, c.CoreV1().Events(namespace).Delete(context.Background(), event.Name, meta.DeleteOptions{}))
})
}
}

View file

@ -23,6 +23,7 @@
package operator
import (
"context"
"time"
"github.com/arangodb/kube-arangodb/pkg/backup/operator/operation"
@ -65,7 +66,7 @@ func Test_Operator_InformerProcessing(t *testing.T) {
require.NoError(t, o.Start(4, stopCh))
for _, name := range objects {
_, err := client.CoreV1().Pods("test").Create(&core.Pod{
_, err := client.CoreV1().Pods("test").Create(context.Background(), &core.Pod{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Pod",
@ -73,7 +74,7 @@ func Test_Operator_InformerProcessing(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
}
@ -115,7 +116,7 @@ func Test_Operator_MultipleInformers(t *testing.T) {
require.NoError(t, o.Start(4, stopCh))
for _, name := range objects {
_, err := client.CoreV1().Pods("test").Create(&core.Pod{
_, err := client.CoreV1().Pods("test").Create(context.Background(), &core.Pod{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Pod",
@ -123,10 +124,10 @@ func Test_Operator_MultipleInformers(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
_, err = client.CoreV1().Nodes().Create(&core.Node{
_, err = client.CoreV1().Nodes().Create(context.Background(), &core.Node{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Node",
@ -134,7 +135,7 @@ func Test_Operator_MultipleInformers(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
}
@ -175,7 +176,7 @@ func Test_Operator_MultipleInformers_IgnoredTypes(t *testing.T) {
require.NoError(t, o.Start(4, stopCh))
for _, name := range objects {
_, err := client.CoreV1().Pods("test").Create(&core.Pod{
_, err := client.CoreV1().Pods("test").Create(context.Background(), &core.Pod{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Pod",
@ -183,10 +184,10 @@ func Test_Operator_MultipleInformers_IgnoredTypes(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
_, err = client.CoreV1().Nodes().Create(&core.Node{
_, err = client.CoreV1().Nodes().Create(context.Background(), &core.Node{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Node",
@ -194,7 +195,7 @@ func Test_Operator_MultipleInformers_IgnoredTypes(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
}
@ -253,7 +254,7 @@ func Test_Operator_MultipleInformers_MultipleHandlers(t *testing.T) {
require.NoError(t, o.Start(4, stopCh))
for _, name := range objects {
_, err := client.CoreV1().Pods("test").Create(&core.Pod{
_, err := client.CoreV1().Pods("test").Create(context.Background(), &core.Pod{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Pod",
@ -261,10 +262,10 @@ func Test_Operator_MultipleInformers_MultipleHandlers(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
_, err = client.CoreV1().Nodes().Create(&core.Node{
_, err = client.CoreV1().Nodes().Create(context.Background(), &core.Node{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Node",
@ -272,10 +273,10 @@ func Test_Operator_MultipleInformers_MultipleHandlers(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
_, err = client.CoreV1().Services("test").Create(&core.Service{
_, err = client.CoreV1().Services("test").Create(context.Background(), &core.Service{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Service",
@ -283,10 +284,10 @@ func Test_Operator_MultipleInformers_MultipleHandlers(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
_, err = client.CoreV1().ServiceAccounts("test").Create(&core.ServiceAccount{
_, err = client.CoreV1().ServiceAccounts("test").Create(context.Background(), &core.ServiceAccount{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "ServiceAccount",
@ -294,7 +295,7 @@ func Test_Operator_MultipleInformers_MultipleHandlers(t *testing.T) {
ObjectMeta: meta.ObjectMeta{
Name: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
}
@ -343,7 +344,7 @@ func Test_Operator_InformerProcessing_Namespaced(t *testing.T) {
require.NoError(t, o.Start(4, stopCh))
for _, name := range objects {
_, err := client.CoreV1().Pods(name).Create(&core.Pod{
_, err := client.CoreV1().Pods(name).Create(context.Background(), &core.Pod{
TypeMeta: meta.TypeMeta{
APIVersion: "v1",
Kind: "Pod",
@ -352,7 +353,7 @@ func Test_Operator_InformerProcessing_Namespaced(t *testing.T) {
Name: name,
Namespace: name,
},
})
}, meta.CreateOptions{})
require.NoError(t, err)
}

View file

@ -23,6 +23,7 @@
package deployment
import (
"context"
"strings"
"time"
@ -65,7 +66,7 @@ func (d *Deployment) createAccessPackages() error {
}
// Remove all access packages that we did build, but are no longer needed
secretList, err := secrets.List(metav1.ListOptions{})
secretList, err := secrets.List(context.Background(), metav1.ListOptions{})
if err != nil {
log.Debug().Err(err).Msg("Failed to list secrets")
return errors.WithStack(err)
@ -76,7 +77,7 @@ func (d *Deployment) createAccessPackages() error {
// Secret is an access package
if _, wanted := apNameMap[secret.GetName()]; !wanted {
// We found an obsolete access package secret. Remove it.
if err := secrets.Delete(secret.GetName(), &metav1.DeleteOptions{
if err := secrets.Delete(context.Background(), secret.GetName(), metav1.DeleteOptions{
Preconditions: &metav1.Preconditions{UID: &secret.UID},
}); err != nil && !k8sutil.IsNotFound(err) {
// Not serious enough to stop everything now, just log and create an event
@ -103,7 +104,7 @@ func (d *Deployment) ensureAccessPackage(apSecretName string) error {
secrets := d.deps.KubeCli.CoreV1().Secrets(ns)
spec := d.apiObject.Spec
if _, err := secrets.Get(apSecretName, metav1.GetOptions{}); err == nil {
if _, err := secrets.Get(context.Background(), apSecretName, metav1.GetOptions{}); err == nil {
// Secret already exists
return nil
}
@ -204,7 +205,7 @@ func (d *Deployment) ensureAccessPackage(apSecretName string) error {
}
// Attach secret to owner
secret.SetOwnerReferences(append(secret.GetOwnerReferences(), d.apiObject.AsOwner()))
if _, err := secrets.Create(secret); err != nil {
if _, err := secrets.Create(context.Background(), secret, metav1.CreateOptions{}); err != nil {
// Failed to create secret
log.Debug().Err(err).Str("secret-name", apSecretName).Msg("Failed to create access package Secret")
return errors.WithStack(err)

View file

@ -23,6 +23,8 @@
package deployment
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/deployment/resources/inspector"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
@ -42,7 +44,7 @@ func (d *Deployment) removePodFinalizers(cachedStatus inspectorInterface.Inspect
return err
}
if err := kubecli.CoreV1().Pods(pod.GetNamespace()).Delete(pod.GetName(), &meta.DeleteOptions{
if err := kubecli.CoreV1().Pods(pod.GetNamespace()).Delete(context.Background(), pod.GetName(), meta.DeleteOptions{
GracePeriodSeconds: util.NewInt64(1),
}); err != nil {
if !k8sutil.IsNotFound(err) {

View file

@ -191,7 +191,7 @@ func (ci *clusterScalingIntegration) inspectCluster(ctx context.Context, expectS
}
// Let's update the spec
apiObject := ci.depl.apiObject
current, err := ci.depl.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(apiObject.Namespace).Get(apiObject.Name, metav1.GetOptions{})
current, err := ci.depl.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(apiObject.Namespace).Get(context.Background(), apiObject.Name, metav1.GetOptions{})
if err != nil {
return errors.WithStack(err)
}

View file

@ -40,7 +40,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/operator/scope"
monitoringClient "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
monitoringClient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
"github.com/arangodb/kube-arangodb/pkg/deployment/features"
@ -68,7 +68,7 @@ import (
// GetBackup receives information about a backup resource
func (d *Deployment) GetBackup(backup string) (*backupApi.ArangoBackup, error) {
return d.deps.DatabaseCRCli.BackupV1().ArangoBackups(d.Namespace()).Get(backup, meta.GetOptions{})
return d.deps.DatabaseCRCli.BackupV1().ArangoBackups(d.Namespace()).Get(context.Background(), backup, meta.GetOptions{})
}
// GetAPIObject returns the deployment as k8s object.
@ -276,7 +276,7 @@ func (d *Deployment) getAuth() (driver.Authentication, error) {
var secret string
if i := d.apiObject.Status.CurrentImage; i == nil || !features.JWTRotation().Supported(i.ArangoDBVersion, i.Enterprise) {
s, err := secrets.Get(d.apiObject.Spec.Authentication.GetJWTSecretName(), meta.GetOptions{})
s, err := secrets.Get(context.Background(), d.apiObject.Spec.Authentication.GetJWTSecretName(), meta.GetOptions{})
if err != nil {
return nil, errors.Newf("JWT Secret is missing")
}
@ -288,7 +288,7 @@ func (d *Deployment) getAuth() (driver.Authentication, error) {
secret = string(jwt)
} else {
s, err := secrets.Get(pod.JWTSecretFolder(d.apiObject.GetName()), meta.GetOptions{})
s, err := secrets.Get(context.Background(), pod.JWTSecretFolder(d.apiObject.GetName()), meta.GetOptions{})
if err != nil {
d.deps.Log.Error().Err(err).Msgf("Unable to get secret")
return nil, errors.Newf("JWT Folder Secret is missing")
@ -379,7 +379,7 @@ func (d *Deployment) CreateMember(group api.ServerGroup, id string) (string, err
func (d *Deployment) DeletePod(podName string) error {
log := d.deps.Log
ns := d.apiObject.GetNamespace()
if err := d.deps.KubeCli.CoreV1().Pods(ns).Delete(podName, &meta.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
if err := d.deps.KubeCli.CoreV1().Pods(ns).Delete(context.Background(), podName, meta.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
log.Debug().Err(err).Str("pod", podName).Msg("Failed to remove pod")
return errors.WithStack(err)
}
@ -394,7 +394,7 @@ func (d *Deployment) CleanupPod(p *v1.Pod) error {
ns := p.GetNamespace()
options := meta.NewDeleteOptions(0)
options.Preconditions = meta.NewUIDPreconditions(string(p.GetUID()))
if err := d.deps.KubeCli.CoreV1().Pods(ns).Delete(podName, options); err != nil && !k8sutil.IsNotFound(err) {
if err := d.deps.KubeCli.CoreV1().Pods(ns).Delete(context.Background(), podName, *options); err != nil && !k8sutil.IsNotFound(err) {
log.Debug().Err(err).Str("pod", podName).Msg("Failed to cleanup pod")
return errors.WithStack(err)
}
@ -407,7 +407,7 @@ func (d *Deployment) RemovePodFinalizers(podName string) error {
log := d.deps.Log
ns := d.GetNamespace()
kubecli := d.deps.KubeCli
p, err := kubecli.CoreV1().Pods(ns).Get(podName, meta.GetOptions{})
p, err := kubecli.CoreV1().Pods(ns).Get(context.Background(), podName, meta.GetOptions{})
if err != nil {
if k8sutil.IsNotFound(err) {
return nil
@ -425,7 +425,7 @@ func (d *Deployment) RemovePodFinalizers(podName string) error {
func (d *Deployment) DeletePvc(pvcName string) error {
log := d.deps.Log
ns := d.apiObject.GetNamespace()
if err := d.deps.KubeCli.CoreV1().PersistentVolumeClaims(ns).Delete(pvcName, &meta.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
if err := d.deps.KubeCli.CoreV1().PersistentVolumeClaims(ns).Delete(context.Background(), pvcName, meta.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
log.Debug().Err(err).Str("pvc", pvcName).Msg("Failed to remove pvc")
return errors.WithStack(err)
}
@ -435,7 +435,7 @@ func (d *Deployment) DeletePvc(pvcName string) error {
// UpdatePvc updated a persistent volume claim in the namespace
// of the deployment. If the pvc does not exist, the error is ignored.
func (d *Deployment) UpdatePvc(pvc *v1.PersistentVolumeClaim) error {
_, err := d.GetKubeCli().CoreV1().PersistentVolumeClaims(d.GetNamespace()).Update(pvc)
_, err := d.GetKubeCli().CoreV1().PersistentVolumeClaims(d.GetNamespace()).Update(context.Background(), pvc, meta.UpdateOptions{})
if err == nil {
return nil
}
@ -451,7 +451,7 @@ func (d *Deployment) UpdatePvc(pvc *v1.PersistentVolumeClaim) error {
func (d *Deployment) GetOwnedPVCs() ([]v1.PersistentVolumeClaim, error) {
// Get all current PVCs
log := d.deps.Log
pvcs, err := d.deps.KubeCli.CoreV1().PersistentVolumeClaims(d.apiObject.GetNamespace()).List(k8sutil.DeploymentListOpt(d.apiObject.GetName()))
pvcs, err := d.deps.KubeCli.CoreV1().PersistentVolumeClaims(d.apiObject.GetNamespace()).List(context.Background(), k8sutil.DeploymentListOpt(d.apiObject.GetName()))
if err != nil {
log.Debug().Err(err).Msg("Failed to list PVCs")
return nil, errors.WithStack(err)
@ -467,7 +467,7 @@ func (d *Deployment) GetOwnedPVCs() ([]v1.PersistentVolumeClaim, error) {
// GetPvc gets a PVC by the given name, in the samespace of the deployment.
func (d *Deployment) GetPvc(pvcName string) (*v1.PersistentVolumeClaim, error) {
pvc, err := d.deps.KubeCli.CoreV1().PersistentVolumeClaims(d.apiObject.GetNamespace()).Get(pvcName, meta.GetOptions{})
pvc, err := d.deps.KubeCli.CoreV1().PersistentVolumeClaims(d.apiObject.GetNamespace()).Get(context.Background(), pvcName, meta.GetOptions{})
if err != nil {
log.Debug().Err(err).Str("pvc-name", pvcName).Msg("Failed to get PVC")
return nil, errors.WithStack(err)
@ -493,7 +493,7 @@ func (d *Deployment) GetTLSKeyfile(group api.ServerGroup, member api.MemberStatu
func (d *Deployment) DeleteTLSKeyfile(group api.ServerGroup, member api.MemberStatus) error {
secretName := k8sutil.CreateTLSKeyfileSecretName(d.apiObject.GetName(), group.AsRole(), member.ID)
ns := d.apiObject.GetNamespace()
if err := d.deps.KubeCli.CoreV1().Secrets(ns).Delete(secretName, &meta.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
if err := d.deps.KubeCli.CoreV1().Secrets(ns).Delete(context.Background(), secretName, meta.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
return errors.WithStack(err)
}
return nil
@ -503,7 +503,7 @@ func (d *Deployment) DeleteTLSKeyfile(group api.ServerGroup, member api.MemberSt
// If the secret does not exist, the error is ignored.
func (d *Deployment) DeleteSecret(secretName string) error {
ns := d.apiObject.GetNamespace()
if err := d.deps.KubeCli.CoreV1().Secrets(ns).Delete(secretName, &meta.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
if err := d.deps.KubeCli.CoreV1().Secrets(ns).Delete(context.Background(), secretName, meta.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
return errors.WithStack(err)
}
return nil
@ -581,7 +581,7 @@ func (d *Deployment) GetName() string {
}
func (d *Deployment) GetOwnedPods() ([]v1.Pod, error) {
pods, err := d.GetKubeCli().CoreV1().Pods(d.apiObject.GetNamespace()).List(meta.ListOptions{})
pods, err := d.GetKubeCli().CoreV1().Pods(d.apiObject.GetNamespace()).List(context.Background(), meta.ListOptions{})
if err != nil {
return nil, err
}

View file

@ -38,7 +38,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/operator/scope"
monitoringClient "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
monitoringClient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
"github.com/arangodb/kube-arangodb/pkg/util/arangod/conn"
@ -302,7 +302,7 @@ func (d *Deployment) handleArangoDeploymentUpdatedEvent() error {
log := d.deps.Log.With().Str("deployment", d.apiObject.GetName()).Logger()
// Get the most recent version of the deployment from the API server
current, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(d.apiObject.GetNamespace()).Get(d.apiObject.GetName(), metav1.GetOptions{})
current, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(d.apiObject.GetNamespace()).Get(context.Background(), d.apiObject.GetName(), metav1.GetOptions{})
if err != nil {
log.Debug().Err(err).Msg("Failed to get current version of deployment from API server")
if k8sutil.IsNotFound(err) {
@ -396,7 +396,7 @@ func (d *Deployment) updateCRStatus(force ...bool) error {
if update.GetDeletionTimestamp() == nil {
ensureFinalizers(update)
}
newAPIObject, err := depls.Update(update)
newAPIObject, err := depls.Update(context.Background(), update, metav1.UpdateOptions{})
if err == nil {
// Update internal object
d.apiObject = newAPIObject
@ -406,7 +406,7 @@ func (d *Deployment) updateCRStatus(force ...bool) error {
// API object may have been changed already,
// Reload api object and try again
var current *api.ArangoDeployment
current, err = depls.Get(update.GetName(), metav1.GetOptions{})
current, err = depls.Get(context.Background(), update.GetName(), metav1.GetOptions{})
if err == nil {
update = current.DeepCopy()
continue
@ -440,7 +440,7 @@ func (d *Deployment) updateCRSpec(newSpec api.DeploymentSpec, force ...bool) err
update.Spec = newSpec
update.Status = d.status.last
ns := d.apiObject.GetNamespace()
newAPIObject, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(ns).Update(update)
newAPIObject, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(ns).Update(context.Background(), update, metav1.UpdateOptions{})
if err == nil {
// Update internal object
d.apiObject = newAPIObject
@ -450,7 +450,7 @@ func (d *Deployment) updateCRSpec(newSpec api.DeploymentSpec, force ...bool) err
// API object may have been changed already,
// Reload api object and try again
var current *api.ArangoDeployment
current, err = d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(ns).Get(update.GetName(), metav1.GetOptions{})
current, err = d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(ns).Get(context.Background(), update.GetName(), metav1.GetOptions{})
if err == nil {
update = current.DeepCopy()
continue
@ -479,9 +479,9 @@ func (d *Deployment) isOwnerOf(obj metav1.Object) bool {
func (d *Deployment) lookForServiceMonitorCRD() {
var err error
if d.GetScope().IsNamespaced() {
_, err = d.deps.KubeMonitoringCli.ServiceMonitors(d.GetNamespace()).List(metav1.ListOptions{})
_, err = d.deps.KubeMonitoringCli.ServiceMonitors(d.GetNamespace()).List(context.Background(), metav1.ListOptions{})
} else {
_, err = d.deps.KubeExtCli.ApiextensionsV1beta1().CustomResourceDefinitions().Get("servicemonitors.monitoring.coreos.com", metav1.GetOptions{})
_, err = d.deps.KubeExtCli.ApiextensionsV1beta1().CustomResourceDefinitions().Get(context.Background(), "servicemonitors.monitoring.coreos.com", metav1.GetOptions{})
}
log := d.deps.Log
log.Debug().Msgf("Looking for ServiceMonitor CRD...")
@ -530,7 +530,7 @@ func (d *Deployment) ApplyPatch(p ...patch.Item) error {
c := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(d.apiObject.GetNamespace())
depl, err := c.Patch(d.apiObject.GetName(), types.JSONPatchType, data)
depl, err := c.Patch(context.Background(), d.apiObject.GetName(), types.JSONPatchType, data, metav1.PatchOptions{})
if err != nil {
return err
}

View file

@ -56,7 +56,7 @@ func (d *Deployment) runDeploymentFinalizers(ctx context.Context, cachedStatus i
var removalList []string
depls := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(d.GetNamespace())
updated, err := depls.Get(d.apiObject.GetName(), metav1.GetOptions{})
updated, err := depls.Get(context.Background(), d.apiObject.GetName(), metav1.GetOptions{})
if err != nil {
return errors.WithStack(err)
}
@ -98,7 +98,7 @@ func (d *Deployment) inspectRemoveChildFinalizers(ctx context.Context, log zerol
func removeDeploymentFinalizers(log zerolog.Logger, cli versioned.Interface, depl *api.ArangoDeployment, finalizers []string) error {
depls := cli.DatabaseV1().ArangoDeployments(depl.GetNamespace())
getFunc := func() (metav1.Object, error) {
result, err := depls.Get(depl.GetName(), metav1.GetOptions{})
result, err := depls.Get(context.Background(), depl.GetName(), metav1.GetOptions{})
if err != nil {
return nil, errors.WithStack(err)
}
@ -106,7 +106,7 @@ func removeDeploymentFinalizers(log zerolog.Logger, cli versioned.Interface, dep
}
updateFunc := func(updated metav1.Object) error {
updatedDepl := updated.(*api.ArangoDeployment)
result, err := depls.Update(updatedDepl)
result, err := depls.Update(context.Background(), updatedDepl, metav1.UpdateOptions{})
if err != nil {
return errors.WithStack(err)
}

View file

@ -76,7 +76,7 @@ func (d *Deployment) inspectDeployment(lastInterval util.Interval) util.Interval
}
// Check deployment still exists
updated, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(d.apiObject.GetNamespace()).Get(deploymentName, metav1.GetOptions{})
updated, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(d.apiObject.GetNamespace()).Get(context.Background(), deploymentName, metav1.GetOptions{})
if k8sutil.IsNotFound(err) {
// Deployment is gone
log.Info().Msg("Deployment is gone")

View file

@ -23,6 +23,7 @@
package deployment
import (
"context"
"testing"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
@ -99,7 +100,7 @@ func TestEnsurePod_Sync_Error(t *testing.T) {
}
secretName := testCase.ArangoDeployment.Spec.Sync.Monitoring.GetTokenSecretName()
err := deployment.GetKubeCli().CoreV1().Secrets(testNamespace).Delete(secretName, &metav1.DeleteOptions{})
err := deployment.GetKubeCli().CoreV1().Secrets(testNamespace).Delete(context.Background(), secretName, metav1.DeleteOptions{})
require.NoError(t, err)
},
ExpectedError: errors.New("Monitoring token secret validation failed: secrets \"" +
@ -133,7 +134,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
}
secretName := testCase.ArangoDeployment.Spec.Sync.TLS.GetCASecretName()
err := deployment.GetKubeCli().CoreV1().Secrets(testNamespace).Delete(secretName, &metav1.DeleteOptions{})
err := deployment.GetKubeCli().CoreV1().Secrets(testNamespace).Delete(context.Background(), secretName, metav1.DeleteOptions{})
require.NoError(t, err)
},
ExpectedError: errors.New("Failed to create TLS keyfile secret: secrets \"" +
@ -161,7 +162,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
}
secretName := testCase.ArangoDeployment.Spec.Authentication.GetJWTSecretName()
err := deployment.GetKubeCli().CoreV1().Secrets(testNamespace).Delete(secretName, &metav1.DeleteOptions{})
err := deployment.GetKubeCli().CoreV1().Secrets(testNamespace).Delete(context.Background(), secretName, metav1.DeleteOptions{})
require.NoError(t, err)
},
ExpectedError: errors.New("Cluster JWT secret validation failed: secrets \"" +
@ -189,7 +190,7 @@ func TestEnsurePod_Sync_Master(t *testing.T) {
}
secretName := testCase.ArangoDeployment.Spec.Sync.Authentication.GetClientCASecretName()
err := deployment.GetKubeCli().CoreV1().Secrets(testNamespace).Delete(secretName, &metav1.DeleteOptions{})
err := deployment.GetKubeCli().CoreV1().Secrets(testNamespace).Delete(context.Background(), secretName, metav1.DeleteOptions{})
require.NoError(t, err)
},
ExpectedError: errors.New("Client authentication CA certificate secret validation failed: " +

View file

@ -23,6 +23,7 @@
package deployment
import (
"context"
"fmt"
"testing"
@ -51,7 +52,7 @@ func createTLSSNISecret(t *testing.T, client kubernetes.Interface, name, namespa
secret.Data[key] = []byte(value)
}
_, err := client.CoreV1().Secrets(namespace).Create(&secret)
_, err := client.CoreV1().Secrets(namespace).Create(context.Background(), &secret, meta.CreateOptions{})
require.NoError(t, err)
}

View file

@ -23,6 +23,7 @@
package deployment
import (
"context"
"encoding/json"
"fmt"
"testing"
@ -88,7 +89,7 @@ func runTestCase(t *testing.T, testCase testCaseStruct) {
}
// Create custom resource in the fake kubernetes API
_, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(testNamespace).Create(d.apiObject)
_, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(testNamespace).Create(context.Background(), d.apiObject, metav1.CreateOptions{})
require.NoError(t, err)
if testCase.Resources != nil {
@ -110,7 +111,7 @@ func runTestCase(t *testing.T, testCase testCaseStruct) {
}
c := d.GetArangoCli()
if _, err := c.DatabaseV1().ArangoMembers(member.GetNamespace()).Create(&member); err != nil {
if _, err := c.DatabaseV1().ArangoMembers(member.GetNamespace()).Create(context.Background(), &member, metav1.CreateOptions{}); err != nil {
return err
}
@ -122,7 +123,7 @@ func runTestCase(t *testing.T, testCase testCaseStruct) {
}
k := d.GetKubeCli()
if _, err := k.CoreV1().Services(member.GetNamespace()).Create(&s); err != nil {
if _, err := k.CoreV1().Services(member.GetNamespace()).Create(context.Background(), &s, metav1.CreateOptions{}); err != nil {
return err
}
}
@ -154,7 +155,7 @@ func runTestCase(t *testing.T, testCase testCaseStruct) {
}
require.NoError(t, err)
pods, err := d.deps.KubeCli.CoreV1().Pods(testNamespace).List(metav1.ListOptions{})
pods, err := d.deps.KubeCli.CoreV1().Pods(testNamespace).List(context.Background(), metav1.ListOptions{})
require.NoError(t, err)
require.Len(t, pods.Items, 1)
if util.BoolOrDefault(testCase.CompareChecksum, true) {

View file

@ -31,7 +31,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/deployment/client"
monitoringFakeClient "github.com/coreos/prometheus-operator/pkg/client/versioned/fake"
monitoringFakeClient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/fake"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/probes"

View file

@ -134,12 +134,12 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, ima
Logger()
// Check if pod exists
if pod, err := ib.KubeCli.CoreV1().Pods(ns).Get(podName, metav1.GetOptions{}); err == nil {
if pod, err := ib.KubeCli.CoreV1().Pods(ns).Get(context.Background(), podName, metav1.GetOptions{}); err == nil {
// Pod found
if k8sutil.IsPodFailed(pod) {
// Wait some time before deleting the pod
if time.Now().After(pod.GetCreationTimestamp().Add(30 * time.Second)) {
if err := ib.KubeCli.CoreV1().Pods(ns).Delete(podName, nil); err != nil && !k8sutil.IsNotFound(err) {
if err := ib.KubeCli.CoreV1().Pods(ns).Delete(context.Background(), podName, metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
log.Warn().Err(err).Msg("Failed to delete Image ID Pod")
return false, nil
}
@ -176,7 +176,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, ima
enterprise := strings.ToLower(v.License) == "enterprise"
// We have all the info we need now, kill the pod and store the image info.
if err := ib.KubeCli.CoreV1().Pods(ns).Delete(podName, nil); err != nil && !k8sutil.IsNotFound(err) {
if err := ib.KubeCli.CoreV1().Pods(ns).Delete(context.Background(), podName, metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
log.Warn().Err(err).Msg("Failed to delete Image ID Pod")
return true, nil
}

View file

@ -23,6 +23,7 @@
package deployment
import (
"context"
"crypto/sha1"
"fmt"
"testing"
@ -180,11 +181,11 @@ func TestEnsureImages(t *testing.T) {
},
}
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(&pod)
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(context.Background(), &pod, metav1.CreateOptions{})
require.NoError(t, err)
},
After: func(t *testing.T, deployment *Deployment) {
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(metav1.ListOptions{})
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(context.Background(), metav1.ListOptions{})
require.NoError(t, err)
require.Len(t, pods.Items, 1)
},
@ -205,11 +206,11 @@ func TestEnsureImages(t *testing.T) {
Phase: v1.PodFailed,
},
}
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(&pod)
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(context.Background(), &pod, metav1.CreateOptions{})
require.NoError(t, err)
},
After: func(t *testing.T, deployment *Deployment) {
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(metav1.ListOptions{})
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(context.Background(), metav1.ListOptions{})
require.NoError(t, err)
require.Len(t, pods.Items, 0)
},
@ -235,11 +236,11 @@ func TestEnsureImages(t *testing.T) {
},
},
}
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(&pod)
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(context.Background(), &pod, metav1.CreateOptions{})
require.NoError(t, err)
},
After: func(t *testing.T, deployment *Deployment) {
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(metav1.ListOptions{})
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(context.Background(), metav1.ListOptions{})
require.NoError(t, err)
require.Len(t, pods.Items, 1)
},
@ -266,11 +267,11 @@ func TestEnsureImages(t *testing.T) {
},
},
}
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(&pod)
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(context.Background(), &pod, metav1.CreateOptions{})
require.NoError(t, err)
},
After: func(t *testing.T, deployment *Deployment) {
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(metav1.ListOptions{})
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(context.Background(), metav1.ListOptions{})
require.NoError(t, err)
require.Len(t, pods.Items, 1)
},
@ -300,11 +301,11 @@ func TestEnsureImages(t *testing.T) {
},
},
}
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(&pod)
_, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).Create(context.Background(), &pod, metav1.CreateOptions{})
require.NoError(t, err)
},
After: func(t *testing.T, deployment *Deployment) {
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(metav1.ListOptions{})
pods, err := deployment.GetKubeCli().CoreV1().Pods(testNamespace).List(context.Background(), metav1.ListOptions{})
require.NoError(t, err)
require.Len(t, pods.Items, 1)
},
@ -326,7 +327,7 @@ func TestEnsureImages(t *testing.T) {
}
// Create custom resource in the fake kubernetes API
_, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(testNamespace).Create(d.apiObject)
_, err := d.deps.DatabaseCRCli.DatabaseV1().ArangoDeployments(testNamespace).Create(context.Background(), d.apiObject, metav1.CreateOptions{})
require.NoError(t, err)
// Act
@ -342,7 +343,7 @@ func TestEnsureImages(t *testing.T) {
require.NoError(t, err)
if len(testCase.ExpectedPod.Spec.Containers) > 0 {
pods, err := d.deps.KubeCli.CoreV1().Pods(testNamespace).List(metav1.ListOptions{})
pods, err := d.deps.KubeCli.CoreV1().Pods(testNamespace).List(context.Background(), metav1.ListOptions{})
require.NoError(t, err)
require.Len(t, pods.Items, 1)
require.Equal(t, testCase.ExpectedPod.Spec, pods.Items[0].Spec)

View file

@ -23,6 +23,7 @@
package pod
import (
"context"
"crypto/sha256"
"fmt"
"path/filepath"
@ -67,7 +68,7 @@ func GroupEncryptionSupported(mode api.DeploymentMode, group api.ServerGroup) bo
}
func GetEncryptionKey(secrets k8sutil.SecretInterface, name string) (string, []byte, bool, error) {
keyfile, err := secrets.Get(name, meta.GetOptions{})
keyfile, err := secrets.Get(context.Background(), name, meta.GetOptions{})
if err != nil {
if k8sutil.IsNotFound(err) {
return "", nil, false, nil

View file

@ -26,6 +26,8 @@ import (
"context"
"encoding/base64"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/deployment/features"
@ -102,7 +104,7 @@ func (a *encryptionKeyAddAction) Start(ctx context.Context) (bool, error) {
return true, nil
}
_, err = a.actionCtx.SecretsInterface().Patch(pod.GetEncryptionFolderSecretName(a.actionCtx.GetAPIObject().GetName()), types.JSONPatchType, patch)
_, err = a.actionCtx.SecretsInterface().Patch(ctx, pod.GetEncryptionFolderSecretName(a.actionCtx.GetAPIObject().GetName()), types.JSONPatchType, patch, meta.PatchOptions{})
if err != nil {
return false, err
}

View file

@ -54,7 +54,7 @@ func (a *encryptionKeyRefreshAction) Start(ctx context.Context) (bool, error) {
}
func (a *encryptionKeyRefreshAction) CheckProgress(ctx context.Context) (bool, bool, error) {
keyfolder, err := a.actionCtx.SecretsInterface().Get(pod.GetEncryptionFolderSecretName(a.actionCtx.GetName()), meta.GetOptions{})
keyfolder, err := a.actionCtx.SecretsInterface().Get(ctx, pod.GetEncryptionFolderSecretName(a.actionCtx.GetName()), meta.GetOptions{})
if err != nil {
a.log.Err(err).Msgf("Unable to fetch encryption folder")
return true, false, nil

View file

@ -25,6 +25,8 @@ package reconcile
import (
"context"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/deployment/patch"
@ -79,7 +81,7 @@ func (a *encryptionKeyRemoveAction) Start(ctx context.Context) (bool, error) {
return true, nil
}
_, err = a.actionCtx.SecretsInterface().Patch(pod.GetEncryptionFolderSecretName(a.actionCtx.GetAPIObject().GetName()), types.JSONPatchType, patch)
_, err = a.actionCtx.SecretsInterface().Patch(ctx, pod.GetEncryptionFolderSecretName(a.actionCtx.GetAPIObject().GetName()), types.JSONPatchType, patch, meta.PatchOptions{})
if err != nil {
if !k8sutil.IsInvalid(err) {
return false, errors.Wrapf(err, "Unable to update secret: %s", string(patch))

View file

@ -57,7 +57,7 @@ func (a *encryptionKeyStatusUpdateAction) Start(ctx context.Context) (bool, erro
return true, nil
}
f, err := a.actionCtx.SecretsInterface().Get(pod.GetEncryptionFolderSecretName(a.actionCtx.GetAPIObject().GetName()), meta.GetOptions{})
f, err := a.actionCtx.SecretsInterface().Get(ctx, pod.GetEncryptionFolderSecretName(a.actionCtx.GetAPIObject().GetName()), meta.GetOptions{})
if err != nil {
a.log.Error().Err(err).Msgf("Unable to get folder info")
return true, nil

View file

@ -26,6 +26,8 @@ import (
"context"
"encoding/base64"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
@ -114,7 +116,7 @@ func (a *jwtAddAction) Start(ctx context.Context) (bool, error) {
return true, nil
}
_, err = a.actionCtx.SecretsInterface().Patch(pod.JWTSecretFolder(a.actionCtx.GetName()), types.JSONPatchType, patch)
_, err = a.actionCtx.SecretsInterface().Patch(ctx, pod.JWTSecretFolder(a.actionCtx.GetName()), types.JSONPatchType, patch, meta.PatchOptions{})
if err != nil {
if !k8sutil.IsInvalid(err) {
return false, errors.Wrapf(err, "Unable to update secret: %s", pod.JWTSecretFolder(a.actionCtx.GetName()))

View file

@ -25,6 +25,8 @@ package reconcile
import (
"context"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
@ -105,7 +107,7 @@ func (a *jwtCleanAction) Start(ctx context.Context) (bool, error) {
return true, nil
}
_, err = a.actionCtx.SecretsInterface().Patch(pod.JWTSecretFolder(a.actionCtx.GetName()), types.JSONPatchType, patch)
_, err = a.actionCtx.SecretsInterface().Patch(ctx, pod.JWTSecretFolder(a.actionCtx.GetName()), types.JSONPatchType, patch, meta.PatchOptions{})
if err != nil {
if !k8sutil.IsInvalid(err) {
return false, errors.Wrapf(err, "Unable to update secret: %s", pod.JWTSecretFolder(a.actionCtx.GetName()))

View file

@ -26,6 +26,8 @@ import (
"context"
"encoding/base64"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
@ -116,7 +118,7 @@ func (a *jwtSetActiveAction) Start(ctx context.Context) (bool, error) {
return true, nil
}
_, err = a.actionCtx.SecretsInterface().Patch(pod.JWTSecretFolder(a.actionCtx.GetName()), types.JSONPatchType, patch)
_, err = a.actionCtx.SecretsInterface().Patch(ctx, pod.JWTSecretFolder(a.actionCtx.GetName()), types.JSONPatchType, patch, meta.PatchOptions{})
if err != nil {
if !k8sutil.IsInvalid(err) {
return false, errors.Wrapf(err, "Unable to update secret: %s", pod.JWTSecretFolder(a.actionCtx.GetName()))

View file

@ -26,6 +26,8 @@ import (
"context"
"encoding/base64"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/deployment/patch"
@ -113,7 +115,7 @@ func (a *appendTLSCACertificateAction) Start(ctx context.Context) (bool, error)
return true, nil
}
_, err = a.actionCtx.SecretsInterface().Patch(resources.GetCASecretName(a.actionCtx.GetAPIObject()), types.JSONPatchType, patch)
_, err = a.actionCtx.SecretsInterface().Patch(ctx, resources.GetCASecretName(a.actionCtx.GetAPIObject()), types.JSONPatchType, patch, meta.PatchOptions{})
if err != nil {
if !k8sutil.IsInvalid(err) {
return false, errors.Wrapf(err, "Unable to update secret: %s", string(patch))

View file

@ -25,6 +25,8 @@ package reconcile
import (
"context"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/deployment/patch"
@ -115,7 +117,7 @@ func (a *cleanTLSCACertificateAction) Start(ctx context.Context) (bool, error) {
}
a.log.Info().Msgf("Removing key %s from truststore", certChecksum)
_, err = a.actionCtx.SecretsInterface().Patch(resources.GetCASecretName(a.actionCtx.GetAPIObject()), types.JSONPatchType, patch)
_, err = a.actionCtx.SecretsInterface().Patch(ctx, resources.GetCASecretName(a.actionCtx.GetAPIObject()), types.JSONPatchType, patch, meta.PatchOptions{})
if err != nil {
if !k8sutil.IsInvalid(err) {
return false, errors.Wrapf(err, "Unable to update secret: %s", string(patch))

View file

@ -55,7 +55,7 @@ func (a *renewTLSCACertificateAction) Start(ctx context.Context) (bool, error) {
}
s := a.actionCtx.SecretsInterface()
if err := s.Delete(a.actionCtx.GetSpec().TLS.GetCASecretName(), &meta.DeleteOptions{}); err != nil {
if err := s.Delete(ctx, a.actionCtx.GetSpec().TLS.GetCASecretName(), meta.DeleteOptions{}); err != nil {
if !k8sutil.IsNotFound(err) {
a.log.Warn().Err(err).Msgf("Unable to clean cert %s", a.actionCtx.GetSpec().TLS.GetCASecretName())
return true, nil

View file

@ -56,7 +56,7 @@ func (a *tlsKeyStatusUpdateAction) Start(ctx context.Context) (bool, error) {
return true, nil
}
f, err := a.actionCtx.SecretsInterface().Get(resources.GetCASecretName(a.actionCtx.GetAPIObject()), meta.GetOptions{})
f, err := a.actionCtx.SecretsInterface().Get(ctx, resources.GetCASecretName(a.actionCtx.GetAPIObject()), meta.GetOptions{})
if err != nil {
a.log.Error().Err(err).Msgf("Unable to get folder info")
return true, nil

View file

@ -33,7 +33,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/arangod/conn"
monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
policy "k8s.io/api/policy/v1beta1"

View file

@ -23,11 +23,13 @@
package resources
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/deployment/patch"
"github.com/arangodb/kube-arangodb/pkg/util/collection"
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
monitoringTypedClient "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
monitoringTypedClient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
"k8s.io/apimachinery/pkg/types"
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
@ -117,7 +119,7 @@ func (r *Resources) EnsureAnnotations(cachedStatus inspectorInterface.Inspector)
func ensureSecretsAnnotations(client typedCore.SecretInterface, cachedStatus inspectorInterface.Inspector, kind, name, namespace string, spec api.DeploymentSpec) error {
if err := cachedStatus.IterateSecrets(func(secret *core.Secret) error {
ensureAnnotationsMap(secret.Kind, secret, spec, func(name string, d []byte) error {
_, err := client.Patch(name, types.JSONPatchType, d)
_, err := client.Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
})
return nil
@ -133,7 +135,7 @@ func ensureSecretsAnnotations(client typedCore.SecretInterface, cachedStatus ins
func ensureServiceAccountsAnnotations(client typedCore.ServiceAccountInterface, cachedStatus inspectorInterface.Inspector, kind, name, namespace string, spec api.DeploymentSpec) error {
if err := cachedStatus.IterateServiceAccounts(func(serviceAccount *core.ServiceAccount) error {
ensureAnnotationsMap(serviceAccount.Kind, serviceAccount, spec, func(name string, d []byte) error {
_, err := client.Patch(name, types.JSONPatchType, d)
_, err := client.Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
})
return nil
@ -149,7 +151,7 @@ func ensureServiceAccountsAnnotations(client typedCore.ServiceAccountInterface,
func ensureServicesAnnotations(client typedCore.ServiceInterface, cachedStatus inspectorInterface.Inspector, kind, name, namespace string, spec api.DeploymentSpec) error {
if err := cachedStatus.IterateServices(func(service *core.Service) error {
ensureAnnotationsMap(service.Kind, service, spec, func(name string, d []byte) error {
_, err := client.Patch(name, types.JSONPatchType, d)
_, err := client.Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
})
return nil
@ -165,7 +167,7 @@ func ensureServicesAnnotations(client typedCore.ServiceInterface, cachedStatus i
func ensurePdbsAnnotations(client policyTyped.PodDisruptionBudgetInterface, cachedStatus inspectorInterface.Inspector, kind, name, namespace string, spec api.DeploymentSpec) error {
if err := cachedStatus.IteratePodDisruptionBudgets(func(podDisruptionBudget *policy.PodDisruptionBudget) error {
ensureAnnotationsMap(podDisruptionBudget.Kind, podDisruptionBudget, spec, func(name string, d []byte) error {
_, err := client.Patch(name, types.JSONPatchType, d)
_, err := client.Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
})
return nil
@ -181,7 +183,7 @@ func ensurePdbsAnnotations(client policyTyped.PodDisruptionBudgetInterface, cach
func ensurePvcsAnnotations(client typedCore.PersistentVolumeClaimInterface, cachedStatus inspectorInterface.Inspector, kind, name, namespace string, spec api.DeploymentSpec) error {
if err := cachedStatus.IteratePersistentVolumeClaims(func(persistentVolumeClaim *core.PersistentVolumeClaim) error {
ensureGroupAnnotationsMap(persistentVolumeClaim.Kind, persistentVolumeClaim, spec, func(name string, d []byte) error {
_, err := client.Patch(name, types.JSONPatchType, d)
_, err := client.Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
})
return nil
@ -197,7 +199,7 @@ func ensurePvcsAnnotations(client typedCore.PersistentVolumeClaimInterface, cach
func ensureServiceMonitorsAnnotations(client monitoringTypedClient.ServiceMonitorInterface, cachedStatus inspectorInterface.Inspector, kind, name, namespace string, spec api.DeploymentSpec) error {
if err := cachedStatus.IterateServiceMonitors(func(serviceMonitor *monitoring.ServiceMonitor) error {
ensureAnnotationsMap(serviceMonitor.Kind, serviceMonitor, spec, func(name string, d []byte) error {
_, err := client.Patch(name, types.JSONPatchType, d)
_, err := client.Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
})
return nil
@ -227,7 +229,7 @@ func getObjectGroup(obj meta.Object) api.ServerGroup {
func ensurePodsAnnotations(client typedCore.PodInterface, cachedStatus inspectorInterface.Inspector, kind, name, namespace string, annotations map[string]string, spec api.DeploymentSpec) error {
if err := cachedStatus.IteratePods(func(pod *core.Pod) error {
ensureGroupAnnotationsMap(pod.Kind, pod, spec, func(name string, d []byte) error {
_, err := client.Patch(name, types.JSONPatchType, d)
_, err := client.Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
})
return nil

View file

@ -29,7 +29,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/operator/scope"
monitoringClient "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
monitoringClient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
backupApi "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"

View file

@ -23,20 +23,28 @@
package inspector
import (
"context"
"sync"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
monitoringClient "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
monitoringClient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
core "k8s.io/api/core/v1"
policy "k8s.io/api/policy/v1beta1"
"k8s.io/client-go/kubernetes"
)
// SecretReadInterface has methods to work with Secret resources with ReadOnly mode.
type SecretReadInterface interface {
Get(ctx context.Context, name string, opts meta.GetOptions) (*core.Secret, error)
}
func NewInspector(k kubernetes.Interface, m monitoringClient.MonitoringV1Interface, c versioned.Interface, namespace string) (inspectorInterface.Inspector, error) {
pods, err := podsToMap(k, namespace)
if err != nil {

View file

@ -23,6 +23,8 @@
package inspector
import (
"context"
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"
@ -98,7 +100,7 @@ func arangoMemberPointer(pod api.ArangoMember) *api.ArangoMember {
}
func getArangoMembers(k versioned.Interface, namespace, cont string) ([]api.ArangoMember, error) {
arangoMembers, err := k.DatabaseV1().ArangoMembers(namespace).List(meta.ListOptions{
arangoMembers, err := k.DatabaseV1().ArangoMembers(namespace).List(context.Background(), meta.ListOptions{
Limit: 128,
Continue: cont,
})

View file

@ -23,6 +23,8 @@
package inspector
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/poddisruptionbudget"
policy "k8s.io/api/policy/v1beta1"
@ -98,7 +100,7 @@ func podDisruptionBudgetPointer(podDisruptionBudget policy.PodDisruptionBudget)
}
func getPodDisruptionBudgets(k kubernetes.Interface, namespace, cont string) ([]policy.PodDisruptionBudget, error) {
podDisruptionBudgets, err := k.PolicyV1beta1().PodDisruptionBudgets(namespace).List(meta.ListOptions{
podDisruptionBudgets, err := k.PolicyV1beta1().PodDisruptionBudgets(namespace).List(context.Background(), meta.ListOptions{
Limit: 128,
Continue: cont,
})

View file

@ -23,6 +23,8 @@
package inspector
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/pod"
core "k8s.io/api/core/v1"
@ -98,7 +100,7 @@ func podPointer(pod core.Pod) *core.Pod {
}
func getPods(k kubernetes.Interface, namespace, cont string) ([]core.Pod, error) {
pods, err := k.CoreV1().Pods(namespace).List(meta.ListOptions{
pods, err := k.CoreV1().Pods(namespace).List(context.Background(), meta.ListOptions{
Limit: 128,
Continue: cont,
})

View file

@ -23,6 +23,8 @@
package inspector
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/persistentvolumeclaim"
core "k8s.io/api/core/v1"
@ -98,7 +100,7 @@ func pvcPointer(pvc core.PersistentVolumeClaim) *core.PersistentVolumeClaim {
}
func getPersistentVolumeClaims(k kubernetes.Interface, namespace, cont string) ([]core.PersistentVolumeClaim, error) {
pvcs, err := k.CoreV1().PersistentVolumeClaims(namespace).List(meta.ListOptions{
pvcs, err := k.CoreV1().PersistentVolumeClaims(namespace).List(context.Background(), meta.ListOptions{
Limit: 128,
Continue: cont,
})

View file

@ -23,6 +23,8 @@
package inspector
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/serviceaccount"
core "k8s.io/api/core/v1"
@ -98,7 +100,7 @@ func serviceAccountPointer(serviceAccount core.ServiceAccount) *core.ServiceAcco
}
func getServiceAccounts(k kubernetes.Interface, namespace, cont string) ([]core.ServiceAccount, error) {
serviceAccounts, err := k.CoreV1().ServiceAccounts(namespace).List(meta.ListOptions{
serviceAccounts, err := k.CoreV1().ServiceAccounts(namespace).List(context.Background(), meta.ListOptions{
Limit: 128,
Continue: cont,
})

View file

@ -23,6 +23,8 @@
package inspector
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/secret"
core "k8s.io/api/core/v1"
@ -83,7 +85,7 @@ type secretReadInterface struct {
i *inspector
}
func (s secretReadInterface) Get(name string, options meta.GetOptions) (*core.Secret, error) {
func (s secretReadInterface) Get(ctx context.Context, name string, opts meta.GetOptions) (*core.Secret, error) {
if s, ok := s.i.Secret(name); !ok {
return nil, apiErrors.NewNotFound(schema.GroupResource{
Group: core.GroupName,
@ -119,7 +121,7 @@ func secretPointer(pod core.Secret) *core.Secret {
}
func getSecrets(k kubernetes.Interface, namespace, cont string) ([]core.Secret, error) {
secrets, err := k.CoreV1().Secrets(namespace).List(meta.ListOptions{
secrets, err := k.CoreV1().Secrets(namespace).List(context.Background(), meta.ListOptions{
Limit: 128,
Continue: cont,
})

View file

@ -23,6 +23,8 @@
package inspector
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/service"
core "k8s.io/api/core/v1"
@ -98,7 +100,7 @@ func servicePointer(pod core.Service) *core.Service {
}
func getServices(k kubernetes.Interface, namespace, cont string) ([]core.Service, error) {
services, err := k.CoreV1().Services(namespace).List(meta.ListOptions{
services, err := k.CoreV1().Services(namespace).List(context.Background(), meta.ListOptions{
Limit: 128,
Continue: cont,
})

View file

@ -23,10 +23,12 @@
package inspector
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/servicemonitor"
monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
monitoringClient "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
monitoringClient "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -94,7 +96,7 @@ func serviceMonitorsToMap(m monitoringClient.MonitoringV1Interface, namespace st
}
func getServiceMonitors(m monitoringClient.MonitoringV1Interface, namespace, cont string) ([]*monitoring.ServiceMonitor, error) {
serviceMonitors, err := m.ServiceMonitors(namespace).List(meta.ListOptions{
serviceMonitors, err := m.ServiceMonitors(namespace).List(context.Background(), meta.ListOptions{
Limit: 128,
Continue: cont,
})

View file

@ -23,9 +23,12 @@
package resources
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
monitoring "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
core "k8s.io/api/core/v1"
policy "k8s.io/api/policy/v1beta1"
@ -70,7 +73,7 @@ func (r *Resources) EnsureSecretLabels(cachedStatus inspectorInterface.Inspector
changed := false
if err := cachedStatus.IterateSecrets(func(secret *core.Secret) error {
if ensureLabelsMap(secret.Kind, secret, r.context.GetSpec(), func(name string, d []byte) error {
_, err := r.context.GetKubeCli().CoreV1().Secrets(r.context.GetAPIObject().GetNamespace()).Patch(name, types.JSONPatchType, d)
_, err := r.context.GetKubeCli().CoreV1().Secrets(r.context.GetAPIObject().GetNamespace()).Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
}) {
changed = true
@ -94,7 +97,7 @@ func (r *Resources) EnsureServiceAccountsLabels(cachedStatus inspectorInterface.
changed := false
if err := cachedStatus.IterateServiceAccounts(func(serviceAccount *core.ServiceAccount) error {
if ensureLabelsMap(serviceAccount.Kind, serviceAccount, r.context.GetSpec(), func(name string, d []byte) error {
_, err := r.context.GetKubeCli().CoreV1().ServiceAccounts(r.context.GetAPIObject().GetNamespace()).Patch(name, types.JSONPatchType, d)
_, err := r.context.GetKubeCli().CoreV1().ServiceAccounts(r.context.GetAPIObject().GetNamespace()).Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
}) {
changed = true
@ -118,7 +121,7 @@ func (r *Resources) EnsureServicesLabels(cachedStatus inspectorInterface.Inspect
changed := false
if err := cachedStatus.IterateServices(func(service *core.Service) error {
if ensureLabelsMap(service.Kind, service, r.context.GetSpec(), func(name string, d []byte) error {
_, err := r.context.GetKubeCli().CoreV1().Services(r.context.GetAPIObject().GetNamespace()).Patch(name, types.JSONPatchType, d)
_, err := r.context.GetKubeCli().CoreV1().Services(r.context.GetAPIObject().GetNamespace()).Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
}) {
changed = true
@ -142,7 +145,7 @@ func (r *Resources) EnsureServiceMonitorsLabels(cachedStatus inspectorInterface.
changed := false
if err := cachedStatus.IterateServiceMonitors(func(serviceMonitor *monitoring.ServiceMonitor) error {
if ensureLabelsMap(serviceMonitor.Kind, serviceMonitor, r.context.GetSpec(), func(name string, d []byte) error {
_, err := r.context.GetMonitoringV1Cli().ServiceMonitors(r.context.GetAPIObject().GetNamespace()).Patch(name, types.JSONPatchType, d)
_, err := r.context.GetMonitoringV1Cli().ServiceMonitors(r.context.GetAPIObject().GetNamespace()).Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
}) {
changed = true
@ -166,7 +169,7 @@ func (r *Resources) EnsurePodsLabels(cachedStatus inspectorInterface.Inspector)
changed := false
if err := cachedStatus.IteratePods(func(pod *core.Pod) error {
if ensureGroupLabelsMap(pod.Kind, pod, r.context.GetSpec(), func(name string, d []byte) error {
_, err := r.context.GetKubeCli().CoreV1().Pods(r.context.GetAPIObject().GetNamespace()).Patch(name, types.JSONPatchType, d)
_, err := r.context.GetKubeCli().CoreV1().Pods(r.context.GetAPIObject().GetNamespace()).Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
}) {
changed = true
@ -190,7 +193,7 @@ func (r *Resources) EnsurePersistentVolumeClaimsLabels(cachedStatus inspectorInt
changed := false
if err := cachedStatus.IteratePersistentVolumeClaims(func(persistentVolumeClaim *core.PersistentVolumeClaim) error {
if ensureGroupLabelsMap(persistentVolumeClaim.Kind, persistentVolumeClaim, r.context.GetSpec(), func(name string, d []byte) error {
_, err := r.context.GetKubeCli().CoreV1().PersistentVolumeClaims(r.context.GetAPIObject().GetNamespace()).Patch(name, types.JSONPatchType, d)
_, err := r.context.GetKubeCli().CoreV1().PersistentVolumeClaims(r.context.GetAPIObject().GetNamespace()).Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
}) {
changed = true
@ -214,7 +217,7 @@ func (r *Resources) EnsurePodDisruptionBudgetsLabels(cachedStatus inspectorInter
changed := false
if err := cachedStatus.IteratePodDisruptionBudgets(func(budget *policy.PodDisruptionBudget) error {
if ensureLabelsMap(budget.Kind, budget, r.context.GetSpec(), func(name string, d []byte) error {
_, err := r.context.GetKubeCli().PolicyV1beta1().PodDisruptionBudgets(r.context.GetAPIObject().GetNamespace()).Patch(name, types.JSONPatchType, d)
_, err := r.context.GetKubeCli().PolicyV1beta1().PodDisruptionBudgets(r.context.GetAPIObject().GetNamespace()).Patch(context.Background(), name, types.JSONPatchType, d, meta.PatchOptions{})
return err
}) {
changed = true

View file

@ -23,6 +23,7 @@
package resources
import (
"context"
"time"
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
@ -186,7 +187,7 @@ func (r *Resources) EnsureArangoMembers(cachedStatus inspectorInterface.Inspecto
},
}
if _, err := r.context.GetArangoCli().DatabaseV1().ArangoMembers(obj.GetNamespace()).Create(&a); err != nil {
if _, err := r.context.GetArangoCli().DatabaseV1().ArangoMembers(obj.GetNamespace()).Create(context.Background(), &a, metav1.CreateOptions{}); err != nil {
return err
}
@ -204,7 +205,7 @@ func (r *Resources) EnsureArangoMembers(cachedStatus inspectorInterface.Inspecto
if !ok || g != member.Spec.Group {
// Remove member
if err := r.context.GetArangoCli().DatabaseV1().ArangoMembers(obj.GetNamespace()).Delete(member.GetName(), &metav1.DeleteOptions{}); err != nil {
if err := r.context.GetArangoCli().DatabaseV1().ArangoMembers(obj.GetNamespace()).Delete(context.Background(), member.GetName(), metav1.DeleteOptions{}); err != nil {
if !k8sutil.IsNotFound(err) {
return err
}

View file

@ -115,13 +115,13 @@ func (r *Resources) ensurePDBForGroup(group api.ServerGroup, wantedMinAvail int)
defer cancel()
for {
pdb, err := pdbcli.Get(pdbname, metav1.GetOptions{})
pdb, err := pdbcli.Get(context.Background(), pdbname, metav1.GetOptions{})
if k8sutil.IsNotFound(err) {
if wantedMinAvail != 0 {
// No PDB found - create new
pdb := newPDB(wantedMinAvail, deplname, group, r.context.GetAPIObject().AsOwner())
log.Debug().Msg("Creating new PDB")
if _, err := pdbcli.Create(pdb); err != nil {
if _, err := pdbcli.Create(context.Background(), pdb, metav1.CreateOptions{}); err != nil {
log.Error().Err(err).Msg("failed to create PDB")
return errors.WithStack(err)
}
@ -142,7 +142,7 @@ func (r *Resources) ensurePDBForGroup(group api.ServerGroup, wantedMinAvail int)
// Trigger deletion only if not already deleted
if pdb.GetDeletionTimestamp() == nil {
// Update the PDB
if err := pdbcli.Delete(pdbname, &metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
if err := pdbcli.Delete(context.Background(), pdbname, metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
log.Error().Err(err).Msg("PDB deletion failed")
return errors.WithStack(err)
}

View file

@ -100,7 +100,7 @@ func (r *Resources) inspectFinalizerPodAgencyServing(ctx context.Context, log ze
// of the agent, also remove the PVC
if memberStatus.Conditions.IsTrue(api.ConditionTypeAgentRecoveryNeeded) {
pvcs := r.context.GetKubeCli().CoreV1().PersistentVolumeClaims(r.context.GetNamespace())
if err := pvcs.Delete(memberStatus.PersistentVolumeClaimName, &metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
if err := pvcs.Delete(context.Background(), memberStatus.PersistentVolumeClaimName, metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
log.Warn().Err(err).Msg("Failed to delete PVC for member")
return errors.WithStack(err)
}
@ -127,7 +127,7 @@ func (r *Resources) inspectFinalizerPodDrainDBServer(ctx context.Context, log ze
// If this DBServer is cleaned out, we need to remove the PVC.
if memberStatus.Conditions.IsTrue(api.ConditionTypeCleanedOut) || memberStatus.Phase == api.MemberPhaseDrain {
pvcs := r.context.GetKubeCli().CoreV1().PersistentVolumeClaims(r.context.GetNamespace())
if err := pvcs.Delete(memberStatus.PersistentVolumeClaimName, &metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
if err := pvcs.Delete(context.Background(), memberStatus.PersistentVolumeClaimName, metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
log.Warn().Err(err).Msg("Failed to delete PVC for member")
return errors.WithStack(err)
}

View file

@ -58,7 +58,7 @@ func (r *Resources) prepareAgencyPodTermination(ctx context.Context, log zerolog
// Check node the pod is scheduled on. Only if not in namespaced scope
agentDataWillBeGone := false
if !r.context.GetScope().IsNamespaced() && p.Spec.NodeName != "" {
node, err := r.context.GetKubeCli().CoreV1().Nodes().Get(p.Spec.NodeName, metav1.GetOptions{})
node, err := r.context.GetKubeCli().CoreV1().Nodes().Get(context.Background(), p.Spec.NodeName, metav1.GetOptions{})
if k8sutil.IsNotFound(err) {
log.Warn().Msg("Node not found")
} else if err != nil {
@ -71,7 +71,7 @@ func (r *Resources) prepareAgencyPodTermination(ctx context.Context, log zerolog
// Check PVC
pvcs := r.context.GetKubeCli().CoreV1().PersistentVolumeClaims(apiObject.GetNamespace())
pvc, err := pvcs.Get(memberStatus.PersistentVolumeClaimName, metav1.GetOptions{})
pvc, err := pvcs.Get(context.Background(), memberStatus.PersistentVolumeClaimName, metav1.GetOptions{})
if err != nil {
log.Warn().Err(err).Msg("Failed to get PVC for member")
return errors.WithStack(err)
@ -152,7 +152,7 @@ func (r *Resources) prepareDBServerPodTermination(ctx context.Context, log zerol
// Check node the pod is scheduled on
dbserverDataWillBeGone := false
if !r.context.GetScope().IsNamespaced() && p.Spec.NodeName != "" {
node, err := r.context.GetKubeCli().CoreV1().Nodes().Get(p.Spec.NodeName, metav1.GetOptions{})
node, err := r.context.GetKubeCli().CoreV1().Nodes().Get(context.Background(), p.Spec.NodeName, metav1.GetOptions{})
if k8sutil.IsNotFound(err) {
log.Warn().Msg("Node not found")
} else if err != nil {
@ -167,7 +167,7 @@ func (r *Resources) prepareDBServerPodTermination(ctx context.Context, log zerol
// Check PVC
pvcs := r.context.GetKubeCli().CoreV1().PersistentVolumeClaims(apiObject.GetNamespace())
pvc, err := pvcs.Get(memberStatus.PersistentVolumeClaimName, metav1.GetOptions{})
pvc, err := pvcs.Get(context.Background(), memberStatus.PersistentVolumeClaimName, metav1.GetOptions{})
if err != nil {
log.Warn().Err(err).Msg("Failed to get PVC for member")
return errors.WithStack(err)

View file

@ -105,7 +105,7 @@ func (r *Resources) inspectFinalizerPVCMemberExists(ctx context.Context, log zer
if memberStatus.PodName != "" {
log.Info().Msg("Removing Pod of member, because PVC is being removed")
pods := r.context.GetKubeCli().CoreV1().Pods(apiObject.GetNamespace())
if err := pods.Delete(memberStatus.PodName, &metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
if err := pods.Delete(context.Background(), memberStatus.PodName, metav1.DeleteOptions{}); err != nil && !k8sutil.IsNotFound(err) {
log.Debug().Err(err).Msg("Failed to delete pod")
return errors.WithStack(err)
}

View file

@ -28,7 +28,7 @@ import (
driver "github.com/arangodb/go-driver"
"github.com/arangodb/kube-arangodb/pkg/util/trigger"
clientv1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
clientv1 "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
"github.com/rs/zerolog"
)

View file

@ -23,6 +23,7 @@
package resources
import (
"context"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
@ -236,7 +237,7 @@ func (r *Resources) ensureTokenSecretFolder(cachedStatus inspectorInterface.Insp
f.Data[pod.ActiveJWTKey] = token
f.Data[constants.SecretKeyToken] = token
if _, err := secrets.Update(f); err != nil {
if _, err := secrets.Update(context.Background(), f, meta.UpdateOptions{}); err != nil {
return err
}
@ -257,7 +258,7 @@ func (r *Resources) ensureTokenSecretFolder(cachedStatus inspectorInterface.Insp
return err
}
if _, err := secrets.Patch(folderSecretName, types.JSONPatchType, pdata); err != nil {
if _, err := secrets.Patch(context.Background(), folderSecretName, types.JSONPatchType, pdata, meta.PatchOptions{}); err != nil {
return err
}
}
@ -276,7 +277,7 @@ func (r *Resources) ensureTokenSecretFolder(cachedStatus inspectorInterface.Insp
return err
}
if _, err := secrets.Patch(folderSecretName, types.JSONPatchType, pdata); err != nil {
if _, err := secrets.Patch(context.Background(), folderSecretName, types.JSONPatchType, pdata, meta.PatchOptions{}); err != nil {
return err
}
}
@ -331,7 +332,7 @@ func (r *Resources) createSecret(secrets k8sutil.SecretInterface, secretName str
// Attach secret to owner
owner := r.context.GetAPIObject().AsOwner()
k8sutil.AddOwnerRefToObject(secret, &owner)
if _, err := secrets.Create(secret); err != nil {
if _, err := secrets.Create(context.Background(), secret, meta.CreateOptions{}); err != nil {
// Failed to create secret
return errors.WithStack(err)
}
@ -369,7 +370,7 @@ func (r *Resources) createSecretWithMod(secrets k8sutil.SecretInterface, secretN
f(secret)
if _, err := secrets.Create(secret); err != nil {
if _, err := secrets.Create(context.Background(), secret, meta.CreateOptions{}); err != nil {
// Failed to create secret
return errors.WithStack(err)
}
@ -449,7 +450,7 @@ func AppendKeyfileToKeyfolder(cachedStatus inspectorInterface.Inspector, secrets
}
// Attach secret to owner
k8sutil.AddOwnerRefToObject(secret, ownerRef)
if _, err := secrets.Create(secret); err != nil {
if _, err := secrets.Create(context.Background(), secret, meta.CreateOptions{}); err != nil {
// Failed to create secret
return errors.WithStack(err)
}

View file

@ -23,6 +23,8 @@
package resources
import (
"context"
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
deploymentApi "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
@ -32,8 +34,8 @@ import (
apiErrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime/schema"
coreosv1 "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
clientv1 "github.com/coreos/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
coreosv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
clientv1 "github.com/prometheus-operator/prometheus-operator/pkg/client/versioned/typed/monitoring/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/rest"
)
@ -82,8 +84,10 @@ func (r *Resources) makeEndpoint(isSecure bool) coreosv1.Endpoint {
Interval: "10s",
Scheme: "https",
TLSConfig: &coreosv1.TLSConfig{
SafeTLSConfig: coreosv1.SafeTLSConfig{
InsecureSkipVerify: true,
},
},
}
} else {
return coreosv1.Endpoint{
@ -153,7 +157,7 @@ func (r *Resources) EnsureServiceMonitor() error {
// Check if ServiceMonitor already exists
serviceMonitors := mClient.ServiceMonitors(ns)
servMon, err := serviceMonitors.Get(serviceMonitorName, metav1.GetOptions{})
servMon, err := serviceMonitors.Get(context.Background(), serviceMonitorName, metav1.GetOptions{})
if err != nil {
if k8sutil.IsNotFound(err) {
if !wantMetrics {
@ -174,7 +178,7 @@ func (r *Resources) EnsureServiceMonitor() error {
},
Spec: spec,
}
smon, err = serviceMonitors.Create(smon)
smon, err = serviceMonitors.Create(context.Background(), smon, metav1.CreateOptions{})
if err != nil {
log.Error().Err(err).Msgf("Failed to create ServiceMonitor %s", serviceMonitorName)
return errors.WithStack(err)
@ -216,7 +220,7 @@ func (r *Resources) EnsureServiceMonitor() error {
servMon.Spec = spec
_, err = serviceMonitors.Update(servMon)
_, err = serviceMonitors.Update(context.Background(), servMon, metav1.UpdateOptions{})
if err != nil {
return err
}
@ -224,7 +228,7 @@ func (r *Resources) EnsureServiceMonitor() error {
return nil
}
// Need to get rid of the ServiceMonitor:
err = serviceMonitors.Delete(serviceMonitorName, &metav1.DeleteOptions{})
err = serviceMonitors.Delete(context.Background(), serviceMonitorName, metav1.DeleteOptions{})
if err == nil {
log.Debug().Msgf("Deleted ServiceMonitor %s", serviceMonitorName)
return nil

View file

@ -23,6 +23,7 @@
package resources
import (
"context"
"strings"
"time"
@ -95,7 +96,7 @@ func (r *Resources) EnsureServices(cachedStatus inspectorInterface.Inspector) er
},
}
if _, err := svcs.Create(s); err != nil {
if _, err := svcs.Create(context.Background(), s, metav1.CreateOptions{}); err != nil {
if !k8sutil.IsConflict(err) {
return err
}
@ -120,7 +121,7 @@ func (r *Resources) EnsureServices(cachedStatus inspectorInterface.Inspector) er
if !equality.Semantic.DeepDerivative(*spec, s.Spec) {
s.Spec = *spec
if _, err := svcs.Update(s); err != nil {
if _, err := svcs.Update(context.Background(), s, metav1.UpdateOptions{}); err != nil {
return err
}
@ -271,7 +272,7 @@ func (r *Resources) ensureExternalAccessServices(cachedStatus inspectorInterface
}
}
if updateExternalAccessService && !createExternalAccessService && !deleteExternalAccessService {
if _, err := svcs.Update(existing); err != nil {
if _, err := svcs.Update(context.Background(), existing, metav1.UpdateOptions{}); err != nil {
log.Debug().Err(err).Msgf("Failed to update %s external access service", title)
return errors.WithStack(err)
}
@ -285,7 +286,7 @@ func (r *Resources) ensureExternalAccessServices(cachedStatus inspectorInterface
if deleteExternalAccessService {
log.Info().Str("service", eaServiceName).Msgf("Removing obsolete %s external access service", title)
if err := svcs.Delete(eaServiceName, &metav1.DeleteOptions{}); err != nil {
if err := svcs.Delete(context.Background(), eaServiceName, metav1.DeleteOptions{}); err != nil {
log.Debug().Err(err).Msgf("Failed to remove %s external access service", title)
return errors.WithStack(err)
}

View file

@ -23,6 +23,7 @@
package deployment
import (
"context"
"sort"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
@ -192,7 +193,7 @@ func (d *Deployment) StorageClasses() []string {
func (d *Deployment) DatabaseURL() string {
eaSvcName := k8sutil.CreateDatabaseExternalAccessServiceName(d.Name())
ns := d.apiObject.Namespace
svc, err := d.deps.KubeCli.CoreV1().Services(ns).Get(eaSvcName, metav1.GetOptions{})
svc, err := d.deps.KubeCli.CoreV1().Services(ns).Get(context.Background(), eaSvcName, metav1.GetOptions{})
if err != nil {
return ""
}
@ -201,7 +202,7 @@ func (d *Deployment) DatabaseURL() string {
scheme = "http"
}
nodeFetcher := func() (v1.NodeList, error) {
result, err := d.deps.KubeCli.CoreV1().Nodes().List(metav1.ListOptions{})
result, err := d.deps.KubeCli.CoreV1().Nodes().List(context.Background(), metav1.ListOptions{})
if err != nil {
return v1.NodeList{}, errors.WithStack(err)
}

View file

@ -23,6 +23,8 @@
package deployment
import (
"context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
@ -62,7 +64,7 @@ func (m member) PVCName() string {
func (m member) PVName() string {
if status, found := m.status(); found && status.PersistentVolumeClaimName != "" {
pvcs := m.d.deps.KubeCli.CoreV1().PersistentVolumeClaims(m.d.Namespace())
if pvc, err := pvcs.Get(status.PersistentVolumeClaimName, metav1.GetOptions{}); err == nil {
if pvc, err := pvcs.Get(context.Background(), status.PersistentVolumeClaimName, metav1.GetOptions{}); err == nil {
return pvc.Spec.VolumeName
}
}

View file

@ -103,7 +103,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("Burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
}
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}

View file

@ -38,7 +38,7 @@ import (
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var parameterCodec = runtime.NewParameterCodec(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
backupv1.AddToScheme,
databasev1.AddToScheme,

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
"time"
v1 "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"
@ -41,15 +42,15 @@ type ArangoBackupsGetter interface {
// ArangoBackupInterface has methods to work with ArangoBackup resources.
type ArangoBackupInterface interface {
Create(*v1.ArangoBackup) (*v1.ArangoBackup, error)
Update(*v1.ArangoBackup) (*v1.ArangoBackup, error)
UpdateStatus(*v1.ArangoBackup) (*v1.ArangoBackup, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.ArangoBackup, error)
List(opts metav1.ListOptions) (*v1.ArangoBackupList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoBackup, err error)
Create(ctx context.Context, arangoBackup *v1.ArangoBackup, opts metav1.CreateOptions) (*v1.ArangoBackup, error)
Update(ctx context.Context, arangoBackup *v1.ArangoBackup, opts metav1.UpdateOptions) (*v1.ArangoBackup, error)
UpdateStatus(ctx context.Context, arangoBackup *v1.ArangoBackup, opts metav1.UpdateOptions) (*v1.ArangoBackup, 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.ArangoBackup, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ArangoBackupList, 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.ArangoBackup, err error)
ArangoBackupExpansion
}
@ -68,20 +69,20 @@ func newArangoBackups(c *BackupV1Client, namespace string) *arangoBackups {
}
// Get takes name of the arangoBackup, and returns the corresponding arangoBackup object, and an error if there is any.
func (c *arangoBackups) Get(name string, options metav1.GetOptions) (result *v1.ArangoBackup, err error) {
func (c *arangoBackups) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ArangoBackup, err error) {
result = &v1.ArangoBackup{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangobackups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoBackups that match those selectors.
func (c *arangoBackups) List(opts metav1.ListOptions) (result *v1.ArangoBackupList, err error) {
func (c *arangoBackups) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ArangoBackupList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -92,13 +93,13 @@ func (c *arangoBackups) List(opts metav1.ListOptions) (result *v1.ArangoBackupLi
Resource("arangobackups").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoBackups.
func (c *arangoBackups) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *arangoBackups) 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
@ -109,87 +110,90 @@ func (c *arangoBackups) Watch(opts metav1.ListOptions) (watch.Interface, error)
Resource("arangobackups").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoBackup and creates it. Returns the server's representation of the arangoBackup, and an error, if there is any.
func (c *arangoBackups) Create(arangoBackup *v1.ArangoBackup) (result *v1.ArangoBackup, err error) {
func (c *arangoBackups) Create(ctx context.Context, arangoBackup *v1.ArangoBackup, opts metav1.CreateOptions) (result *v1.ArangoBackup, err error) {
result = &v1.ArangoBackup{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangobackups").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoBackup).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoBackup and updates it. Returns the server's representation of the arangoBackup, and an error, if there is any.
func (c *arangoBackups) Update(arangoBackup *v1.ArangoBackup) (result *v1.ArangoBackup, err error) {
func (c *arangoBackups) Update(ctx context.Context, arangoBackup *v1.ArangoBackup, opts metav1.UpdateOptions) (result *v1.ArangoBackup, err error) {
result = &v1.ArangoBackup{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangobackups").
Name(arangoBackup.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoBackup).
Do().
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 *arangoBackups) UpdateStatus(arangoBackup *v1.ArangoBackup) (result *v1.ArangoBackup, err error) {
func (c *arangoBackups) UpdateStatus(ctx context.Context, arangoBackup *v1.ArangoBackup, opts metav1.UpdateOptions) (result *v1.ArangoBackup, err error) {
result = &v1.ArangoBackup{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangobackups").
Name(arangoBackup.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoBackup).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoBackup and deletes it. Returns an error if one occurs.
func (c *arangoBackups) Delete(name string, options *metav1.DeleteOptions) error {
func (c *arangoBackups) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangobackups").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoBackups) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *arangoBackups) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangobackups").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoBackup.
func (c *arangoBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoBackup, err error) {
func (c *arangoBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ArangoBackup, err error) {
result = &v1.ArangoBackup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangobackups").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
"time"
v1 "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"
@ -41,15 +42,15 @@ type ArangoBackupPoliciesGetter interface {
// ArangoBackupPolicyInterface has methods to work with ArangoBackupPolicy resources.
type ArangoBackupPolicyInterface interface {
Create(*v1.ArangoBackupPolicy) (*v1.ArangoBackupPolicy, error)
Update(*v1.ArangoBackupPolicy) (*v1.ArangoBackupPolicy, error)
UpdateStatus(*v1.ArangoBackupPolicy) (*v1.ArangoBackupPolicy, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.ArangoBackupPolicy, error)
List(opts metav1.ListOptions) (*v1.ArangoBackupPolicyList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoBackupPolicy, err error)
Create(ctx context.Context, arangoBackupPolicy *v1.ArangoBackupPolicy, opts metav1.CreateOptions) (*v1.ArangoBackupPolicy, error)
Update(ctx context.Context, arangoBackupPolicy *v1.ArangoBackupPolicy, opts metav1.UpdateOptions) (*v1.ArangoBackupPolicy, error)
UpdateStatus(ctx context.Context, arangoBackupPolicy *v1.ArangoBackupPolicy, opts metav1.UpdateOptions) (*v1.ArangoBackupPolicy, 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.ArangoBackupPolicy, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ArangoBackupPolicyList, 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.ArangoBackupPolicy, err error)
ArangoBackupPolicyExpansion
}
@ -68,20 +69,20 @@ func newArangoBackupPolicies(c *BackupV1Client, namespace string) *arangoBackupP
}
// Get takes name of the arangoBackupPolicy, and returns the corresponding arangoBackupPolicy object, and an error if there is any.
func (c *arangoBackupPolicies) Get(name string, options metav1.GetOptions) (result *v1.ArangoBackupPolicy, err error) {
func (c *arangoBackupPolicies) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ArangoBackupPolicy, err error) {
result = &v1.ArangoBackupPolicy{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangobackuppolicies").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoBackupPolicies that match those selectors.
func (c *arangoBackupPolicies) List(opts metav1.ListOptions) (result *v1.ArangoBackupPolicyList, err error) {
func (c *arangoBackupPolicies) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ArangoBackupPolicyList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -92,13 +93,13 @@ func (c *arangoBackupPolicies) List(opts metav1.ListOptions) (result *v1.ArangoB
Resource("arangobackuppolicies").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoBackupPolicies.
func (c *arangoBackupPolicies) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *arangoBackupPolicies) 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
@ -109,87 +110,90 @@ func (c *arangoBackupPolicies) Watch(opts metav1.ListOptions) (watch.Interface,
Resource("arangobackuppolicies").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoBackupPolicy and creates it. Returns the server's representation of the arangoBackupPolicy, and an error, if there is any.
func (c *arangoBackupPolicies) Create(arangoBackupPolicy *v1.ArangoBackupPolicy) (result *v1.ArangoBackupPolicy, err error) {
func (c *arangoBackupPolicies) Create(ctx context.Context, arangoBackupPolicy *v1.ArangoBackupPolicy, opts metav1.CreateOptions) (result *v1.ArangoBackupPolicy, err error) {
result = &v1.ArangoBackupPolicy{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangobackuppolicies").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoBackupPolicy).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoBackupPolicy and updates it. Returns the server's representation of the arangoBackupPolicy, and an error, if there is any.
func (c *arangoBackupPolicies) Update(arangoBackupPolicy *v1.ArangoBackupPolicy) (result *v1.ArangoBackupPolicy, err error) {
func (c *arangoBackupPolicies) Update(ctx context.Context, arangoBackupPolicy *v1.ArangoBackupPolicy, opts metav1.UpdateOptions) (result *v1.ArangoBackupPolicy, err error) {
result = &v1.ArangoBackupPolicy{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangobackuppolicies").
Name(arangoBackupPolicy.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoBackupPolicy).
Do().
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 *arangoBackupPolicies) UpdateStatus(arangoBackupPolicy *v1.ArangoBackupPolicy) (result *v1.ArangoBackupPolicy, err error) {
func (c *arangoBackupPolicies) UpdateStatus(ctx context.Context, arangoBackupPolicy *v1.ArangoBackupPolicy, opts metav1.UpdateOptions) (result *v1.ArangoBackupPolicy, err error) {
result = &v1.ArangoBackupPolicy{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangobackuppolicies").
Name(arangoBackupPolicy.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoBackupPolicy).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoBackupPolicy and deletes it. Returns an error if one occurs.
func (c *arangoBackupPolicies) Delete(name string, options *metav1.DeleteOptions) error {
func (c *arangoBackupPolicies) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangobackuppolicies").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoBackupPolicies) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *arangoBackupPolicies) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangobackuppolicies").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoBackupPolicy.
func (c *arangoBackupPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoBackupPolicy, err error) {
func (c *arangoBackupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ArangoBackupPolicy, err error) {
result = &v1.ArangoBackupPolicy{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangobackuppolicies").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,8 @@
package fake
import (
"context"
backupv1 "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
@ -43,7 +45,7 @@ var arangobackupsResource = schema.GroupVersionResource{Group: "backup.arangodb.
var arangobackupsKind = schema.GroupVersionKind{Group: "backup.arangodb.com", Version: "v1", Kind: "ArangoBackup"}
// Get takes name of the arangoBackup, and returns the corresponding arangoBackup object, and an error if there is any.
func (c *FakeArangoBackups) Get(name string, options v1.GetOptions) (result *backupv1.ArangoBackup, err error) {
func (c *FakeArangoBackups) Get(ctx context.Context, name string, options v1.GetOptions) (result *backupv1.ArangoBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangobackupsResource, c.ns, name), &backupv1.ArangoBackup{})
@ -54,7 +56,7 @@ func (c *FakeArangoBackups) Get(name string, options v1.GetOptions) (result *bac
}
// List takes label and field selectors, and returns the list of ArangoBackups that match those selectors.
func (c *FakeArangoBackups) List(opts v1.ListOptions) (result *backupv1.ArangoBackupList, err error) {
func (c *FakeArangoBackups) List(ctx context.Context, opts v1.ListOptions) (result *backupv1.ArangoBackupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangobackupsResource, arangobackupsKind, c.ns, opts), &backupv1.ArangoBackupList{})
@ -76,14 +78,14 @@ func (c *FakeArangoBackups) List(opts v1.ListOptions) (result *backupv1.ArangoBa
}
// Watch returns a watch.Interface that watches the requested arangoBackups.
func (c *FakeArangoBackups) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoBackups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangobackupsResource, c.ns, opts))
}
// Create takes the representation of a arangoBackup and creates it. Returns the server's representation of the arangoBackup, and an error, if there is any.
func (c *FakeArangoBackups) Create(arangoBackup *backupv1.ArangoBackup) (result *backupv1.ArangoBackup, err error) {
func (c *FakeArangoBackups) Create(ctx context.Context, arangoBackup *backupv1.ArangoBackup, opts v1.CreateOptions) (result *backupv1.ArangoBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangobackupsResource, c.ns, arangoBackup), &backupv1.ArangoBackup{})
@ -94,7 +96,7 @@ func (c *FakeArangoBackups) Create(arangoBackup *backupv1.ArangoBackup) (result
}
// Update takes the representation of a arangoBackup and updates it. Returns the server's representation of the arangoBackup, and an error, if there is any.
func (c *FakeArangoBackups) Update(arangoBackup *backupv1.ArangoBackup) (result *backupv1.ArangoBackup, err error) {
func (c *FakeArangoBackups) Update(ctx context.Context, arangoBackup *backupv1.ArangoBackup, opts v1.UpdateOptions) (result *backupv1.ArangoBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangobackupsResource, c.ns, arangoBackup), &backupv1.ArangoBackup{})
@ -106,7 +108,7 @@ func (c *FakeArangoBackups) Update(arangoBackup *backupv1.ArangoBackup) (result
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoBackups) UpdateStatus(arangoBackup *backupv1.ArangoBackup) (*backupv1.ArangoBackup, error) {
func (c *FakeArangoBackups) UpdateStatus(ctx context.Context, arangoBackup *backupv1.ArangoBackup, opts v1.UpdateOptions) (*backupv1.ArangoBackup, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangobackupsResource, "status", c.ns, arangoBackup), &backupv1.ArangoBackup{})
@ -117,7 +119,7 @@ func (c *FakeArangoBackups) UpdateStatus(arangoBackup *backupv1.ArangoBackup) (*
}
// Delete takes name of the arangoBackup and deletes it. Returns an error if one occurs.
func (c *FakeArangoBackups) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoBackups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(arangobackupsResource, c.ns, name), &backupv1.ArangoBackup{})
@ -125,15 +127,15 @@ func (c *FakeArangoBackups) Delete(name string, options *v1.DeleteOptions) error
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoBackups) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangobackupsResource, c.ns, listOptions)
func (c *FakeArangoBackups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangobackupsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &backupv1.ArangoBackupList{})
return err
}
// Patch applies the patch and returns the patched arangoBackup.
func (c *FakeArangoBackups) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *backupv1.ArangoBackup, err error) {
func (c *FakeArangoBackups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *backupv1.ArangoBackup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangobackupsResource, c.ns, name, pt, data, subresources...), &backupv1.ArangoBackup{})

View file

@ -23,6 +23,8 @@
package fake
import (
"context"
backupv1 "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
@ -43,7 +45,7 @@ var arangobackuppoliciesResource = schema.GroupVersionResource{Group: "backup.ar
var arangobackuppoliciesKind = schema.GroupVersionKind{Group: "backup.arangodb.com", Version: "v1", Kind: "ArangoBackupPolicy"}
// Get takes name of the arangoBackupPolicy, and returns the corresponding arangoBackupPolicy object, and an error if there is any.
func (c *FakeArangoBackupPolicies) Get(name string, options v1.GetOptions) (result *backupv1.ArangoBackupPolicy, err error) {
func (c *FakeArangoBackupPolicies) Get(ctx context.Context, name string, options v1.GetOptions) (result *backupv1.ArangoBackupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangobackuppoliciesResource, c.ns, name), &backupv1.ArangoBackupPolicy{})
@ -54,7 +56,7 @@ func (c *FakeArangoBackupPolicies) Get(name string, options v1.GetOptions) (resu
}
// List takes label and field selectors, and returns the list of ArangoBackupPolicies that match those selectors.
func (c *FakeArangoBackupPolicies) List(opts v1.ListOptions) (result *backupv1.ArangoBackupPolicyList, err error) {
func (c *FakeArangoBackupPolicies) List(ctx context.Context, opts v1.ListOptions) (result *backupv1.ArangoBackupPolicyList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangobackuppoliciesResource, arangobackuppoliciesKind, c.ns, opts), &backupv1.ArangoBackupPolicyList{})
@ -76,14 +78,14 @@ func (c *FakeArangoBackupPolicies) List(opts v1.ListOptions) (result *backupv1.A
}
// Watch returns a watch.Interface that watches the requested arangoBackupPolicies.
func (c *FakeArangoBackupPolicies) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoBackupPolicies) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangobackuppoliciesResource, c.ns, opts))
}
// Create takes the representation of a arangoBackupPolicy and creates it. Returns the server's representation of the arangoBackupPolicy, and an error, if there is any.
func (c *FakeArangoBackupPolicies) Create(arangoBackupPolicy *backupv1.ArangoBackupPolicy) (result *backupv1.ArangoBackupPolicy, err error) {
func (c *FakeArangoBackupPolicies) Create(ctx context.Context, arangoBackupPolicy *backupv1.ArangoBackupPolicy, opts v1.CreateOptions) (result *backupv1.ArangoBackupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangobackuppoliciesResource, c.ns, arangoBackupPolicy), &backupv1.ArangoBackupPolicy{})
@ -94,7 +96,7 @@ func (c *FakeArangoBackupPolicies) Create(arangoBackupPolicy *backupv1.ArangoBac
}
// Update takes the representation of a arangoBackupPolicy and updates it. Returns the server's representation of the arangoBackupPolicy, and an error, if there is any.
func (c *FakeArangoBackupPolicies) Update(arangoBackupPolicy *backupv1.ArangoBackupPolicy) (result *backupv1.ArangoBackupPolicy, err error) {
func (c *FakeArangoBackupPolicies) Update(ctx context.Context, arangoBackupPolicy *backupv1.ArangoBackupPolicy, opts v1.UpdateOptions) (result *backupv1.ArangoBackupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangobackuppoliciesResource, c.ns, arangoBackupPolicy), &backupv1.ArangoBackupPolicy{})
@ -106,7 +108,7 @@ func (c *FakeArangoBackupPolicies) Update(arangoBackupPolicy *backupv1.ArangoBac
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoBackupPolicies) UpdateStatus(arangoBackupPolicy *backupv1.ArangoBackupPolicy) (*backupv1.ArangoBackupPolicy, error) {
func (c *FakeArangoBackupPolicies) UpdateStatus(ctx context.Context, arangoBackupPolicy *backupv1.ArangoBackupPolicy, opts v1.UpdateOptions) (*backupv1.ArangoBackupPolicy, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangobackuppoliciesResource, "status", c.ns, arangoBackupPolicy), &backupv1.ArangoBackupPolicy{})
@ -117,7 +119,7 @@ func (c *FakeArangoBackupPolicies) UpdateStatus(arangoBackupPolicy *backupv1.Ara
}
// Delete takes name of the arangoBackupPolicy and deletes it. Returns an error if one occurs.
func (c *FakeArangoBackupPolicies) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoBackupPolicies) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(arangobackuppoliciesResource, c.ns, name), &backupv1.ArangoBackupPolicy{})
@ -125,15 +127,15 @@ func (c *FakeArangoBackupPolicies) Delete(name string, options *v1.DeleteOptions
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoBackupPolicies) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangobackuppoliciesResource, c.ns, listOptions)
func (c *FakeArangoBackupPolicies) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangobackuppoliciesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &backupv1.ArangoBackupPolicyList{})
return err
}
// Patch applies the patch and returns the patched arangoBackupPolicy.
func (c *FakeArangoBackupPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *backupv1.ArangoBackupPolicy, err error) {
func (c *FakeArangoBackupPolicies) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *backupv1.ArangoBackupPolicy, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangobackuppoliciesResource, c.ns, name, pt, data, subresources...), &backupv1.ArangoBackupPolicy{})

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
"time"
v1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
@ -41,15 +42,15 @@ type ArangoDeploymentsGetter interface {
// ArangoDeploymentInterface has methods to work with ArangoDeployment resources.
type ArangoDeploymentInterface interface {
Create(*v1.ArangoDeployment) (*v1.ArangoDeployment, error)
Update(*v1.ArangoDeployment) (*v1.ArangoDeployment, error)
UpdateStatus(*v1.ArangoDeployment) (*v1.ArangoDeployment, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.ArangoDeployment, error)
List(opts metav1.ListOptions) (*v1.ArangoDeploymentList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoDeployment, err error)
Create(ctx context.Context, arangoDeployment *v1.ArangoDeployment, opts metav1.CreateOptions) (*v1.ArangoDeployment, error)
Update(ctx context.Context, arangoDeployment *v1.ArangoDeployment, opts metav1.UpdateOptions) (*v1.ArangoDeployment, error)
UpdateStatus(ctx context.Context, arangoDeployment *v1.ArangoDeployment, opts metav1.UpdateOptions) (*v1.ArangoDeployment, 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.ArangoDeployment, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ArangoDeploymentList, 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.ArangoDeployment, err error)
ArangoDeploymentExpansion
}
@ -68,20 +69,20 @@ func newArangoDeployments(c *DatabaseV1Client, namespace string) *arangoDeployme
}
// Get takes name of the arangoDeployment, and returns the corresponding arangoDeployment object, and an error if there is any.
func (c *arangoDeployments) Get(name string, options metav1.GetOptions) (result *v1.ArangoDeployment, err error) {
func (c *arangoDeployments) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ArangoDeployment, err error) {
result = &v1.ArangoDeployment{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangodeployments").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoDeployments that match those selectors.
func (c *arangoDeployments) List(opts metav1.ListOptions) (result *v1.ArangoDeploymentList, err error) {
func (c *arangoDeployments) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ArangoDeploymentList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -92,13 +93,13 @@ func (c *arangoDeployments) List(opts metav1.ListOptions) (result *v1.ArangoDepl
Resource("arangodeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoDeployments.
func (c *arangoDeployments) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *arangoDeployments) 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
@ -109,87 +110,90 @@ func (c *arangoDeployments) Watch(opts metav1.ListOptions) (watch.Interface, err
Resource("arangodeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoDeployment and creates it. Returns the server's representation of the arangoDeployment, and an error, if there is any.
func (c *arangoDeployments) Create(arangoDeployment *v1.ArangoDeployment) (result *v1.ArangoDeployment, err error) {
func (c *arangoDeployments) Create(ctx context.Context, arangoDeployment *v1.ArangoDeployment, opts metav1.CreateOptions) (result *v1.ArangoDeployment, err error) {
result = &v1.ArangoDeployment{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangodeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeployment).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoDeployment and updates it. Returns the server's representation of the arangoDeployment, and an error, if there is any.
func (c *arangoDeployments) Update(arangoDeployment *v1.ArangoDeployment) (result *v1.ArangoDeployment, err error) {
func (c *arangoDeployments) Update(ctx context.Context, arangoDeployment *v1.ArangoDeployment, opts metav1.UpdateOptions) (result *v1.ArangoDeployment, err error) {
result = &v1.ArangoDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangodeployments").
Name(arangoDeployment.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeployment).
Do().
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 *arangoDeployments) UpdateStatus(arangoDeployment *v1.ArangoDeployment) (result *v1.ArangoDeployment, err error) {
func (c *arangoDeployments) UpdateStatus(ctx context.Context, arangoDeployment *v1.ArangoDeployment, opts metav1.UpdateOptions) (result *v1.ArangoDeployment, err error) {
result = &v1.ArangoDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangodeployments").
Name(arangoDeployment.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeployment).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoDeployment and deletes it. Returns an error if one occurs.
func (c *arangoDeployments) Delete(name string, options *metav1.DeleteOptions) error {
func (c *arangoDeployments) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangodeployments").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoDeployments) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *arangoDeployments) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangodeployments").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoDeployment.
func (c *arangoDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoDeployment, err error) {
func (c *arangoDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ArangoDeployment, err error) {
result = &v1.ArangoDeployment{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangodeployments").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
"time"
v1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
@ -41,15 +42,15 @@ type ArangoMembersGetter interface {
// ArangoMemberInterface has methods to work with ArangoMember resources.
type ArangoMemberInterface interface {
Create(*v1.ArangoMember) (*v1.ArangoMember, error)
Update(*v1.ArangoMember) (*v1.ArangoMember, error)
UpdateStatus(*v1.ArangoMember) (*v1.ArangoMember, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.ArangoMember, error)
List(opts metav1.ListOptions) (*v1.ArangoMemberList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoMember, err error)
Create(ctx context.Context, arangoMember *v1.ArangoMember, opts metav1.CreateOptions) (*v1.ArangoMember, error)
Update(ctx context.Context, arangoMember *v1.ArangoMember, opts metav1.UpdateOptions) (*v1.ArangoMember, error)
UpdateStatus(ctx context.Context, arangoMember *v1.ArangoMember, opts metav1.UpdateOptions) (*v1.ArangoMember, 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.ArangoMember, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ArangoMemberList, 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.ArangoMember, err error)
ArangoMemberExpansion
}
@ -68,20 +69,20 @@ func newArangoMembers(c *DatabaseV1Client, namespace string) *arangoMembers {
}
// Get takes name of the arangoMember, and returns the corresponding arangoMember object, and an error if there is any.
func (c *arangoMembers) Get(name string, options metav1.GetOptions) (result *v1.ArangoMember, err error) {
func (c *arangoMembers) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ArangoMember, err error) {
result = &v1.ArangoMember{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangomembers").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoMembers that match those selectors.
func (c *arangoMembers) List(opts metav1.ListOptions) (result *v1.ArangoMemberList, err error) {
func (c *arangoMembers) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ArangoMemberList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -92,13 +93,13 @@ func (c *arangoMembers) List(opts metav1.ListOptions) (result *v1.ArangoMemberLi
Resource("arangomembers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoMembers.
func (c *arangoMembers) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *arangoMembers) 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
@ -109,87 +110,90 @@ func (c *arangoMembers) Watch(opts metav1.ListOptions) (watch.Interface, error)
Resource("arangomembers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoMember and creates it. Returns the server's representation of the arangoMember, and an error, if there is any.
func (c *arangoMembers) Create(arangoMember *v1.ArangoMember) (result *v1.ArangoMember, err error) {
func (c *arangoMembers) Create(ctx context.Context, arangoMember *v1.ArangoMember, opts metav1.CreateOptions) (result *v1.ArangoMember, err error) {
result = &v1.ArangoMember{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangomembers").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoMember).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoMember and updates it. Returns the server's representation of the arangoMember, and an error, if there is any.
func (c *arangoMembers) Update(arangoMember *v1.ArangoMember) (result *v1.ArangoMember, err error) {
func (c *arangoMembers) Update(ctx context.Context, arangoMember *v1.ArangoMember, opts metav1.UpdateOptions) (result *v1.ArangoMember, err error) {
result = &v1.ArangoMember{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangomembers").
Name(arangoMember.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoMember).
Do().
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 *arangoMembers) UpdateStatus(arangoMember *v1.ArangoMember) (result *v1.ArangoMember, err error) {
func (c *arangoMembers) UpdateStatus(ctx context.Context, arangoMember *v1.ArangoMember, opts metav1.UpdateOptions) (result *v1.ArangoMember, err error) {
result = &v1.ArangoMember{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangomembers").
Name(arangoMember.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoMember).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoMember and deletes it. Returns an error if one occurs.
func (c *arangoMembers) Delete(name string, options *metav1.DeleteOptions) error {
func (c *arangoMembers) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangomembers").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoMembers) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *arangoMembers) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangomembers").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoMember.
func (c *arangoMembers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoMember, err error) {
func (c *arangoMembers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ArangoMember, err error) {
result = &v1.ArangoMember{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangomembers").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,8 @@
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"
@ -43,7 +45,7 @@ var arangodeploymentsResource = schema.GroupVersionResource{Group: "database.ara
var arangodeploymentsKind = schema.GroupVersionKind{Group: "database.arangodb.com", Version: "v1", Kind: "ArangoDeployment"}
// Get takes name of the arangoDeployment, and returns the corresponding arangoDeployment object, and an error if there is any.
func (c *FakeArangoDeployments) Get(name string, options v1.GetOptions) (result *deploymentv1.ArangoDeployment, err error) {
func (c *FakeArangoDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *deploymentv1.ArangoDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangodeploymentsResource, c.ns, name), &deploymentv1.ArangoDeployment{})
@ -54,7 +56,7 @@ func (c *FakeArangoDeployments) Get(name string, options v1.GetOptions) (result
}
// List takes label and field selectors, and returns the list of ArangoDeployments that match those selectors.
func (c *FakeArangoDeployments) List(opts v1.ListOptions) (result *deploymentv1.ArangoDeploymentList, err error) {
func (c *FakeArangoDeployments) List(ctx context.Context, opts v1.ListOptions) (result *deploymentv1.ArangoDeploymentList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangodeploymentsResource, arangodeploymentsKind, c.ns, opts), &deploymentv1.ArangoDeploymentList{})
@ -76,14 +78,14 @@ func (c *FakeArangoDeployments) List(opts v1.ListOptions) (result *deploymentv1.
}
// Watch returns a watch.Interface that watches the requested arangoDeployments.
func (c *FakeArangoDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangodeploymentsResource, c.ns, opts))
}
// Create takes the representation of a arangoDeployment and creates it. Returns the server's representation of the arangoDeployment, and an error, if there is any.
func (c *FakeArangoDeployments) Create(arangoDeployment *deploymentv1.ArangoDeployment) (result *deploymentv1.ArangoDeployment, err error) {
func (c *FakeArangoDeployments) Create(ctx context.Context, arangoDeployment *deploymentv1.ArangoDeployment, opts v1.CreateOptions) (result *deploymentv1.ArangoDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangodeploymentsResource, c.ns, arangoDeployment), &deploymentv1.ArangoDeployment{})
@ -94,7 +96,7 @@ func (c *FakeArangoDeployments) Create(arangoDeployment *deploymentv1.ArangoDepl
}
// Update takes the representation of a arangoDeployment and updates it. Returns the server's representation of the arangoDeployment, and an error, if there is any.
func (c *FakeArangoDeployments) Update(arangoDeployment *deploymentv1.ArangoDeployment) (result *deploymentv1.ArangoDeployment, err error) {
func (c *FakeArangoDeployments) Update(ctx context.Context, arangoDeployment *deploymentv1.ArangoDeployment, opts v1.UpdateOptions) (result *deploymentv1.ArangoDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangodeploymentsResource, c.ns, arangoDeployment), &deploymentv1.ArangoDeployment{})
@ -106,7 +108,7 @@ func (c *FakeArangoDeployments) Update(arangoDeployment *deploymentv1.ArangoDepl
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoDeployments) UpdateStatus(arangoDeployment *deploymentv1.ArangoDeployment) (*deploymentv1.ArangoDeployment, error) {
func (c *FakeArangoDeployments) UpdateStatus(ctx context.Context, arangoDeployment *deploymentv1.ArangoDeployment, opts v1.UpdateOptions) (*deploymentv1.ArangoDeployment, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangodeploymentsResource, "status", c.ns, arangoDeployment), &deploymentv1.ArangoDeployment{})
@ -117,7 +119,7 @@ func (c *FakeArangoDeployments) UpdateStatus(arangoDeployment *deploymentv1.Aran
}
// Delete takes name of the arangoDeployment and deletes it. Returns an error if one occurs.
func (c *FakeArangoDeployments) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(arangodeploymentsResource, c.ns, name), &deploymentv1.ArangoDeployment{})
@ -125,15 +127,15 @@ func (c *FakeArangoDeployments) Delete(name string, options *v1.DeleteOptions) e
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangodeploymentsResource, c.ns, listOptions)
func (c *FakeArangoDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangodeploymentsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &deploymentv1.ArangoDeploymentList{})
return err
}
// Patch applies the patch and returns the patched arangoDeployment.
func (c *FakeArangoDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *deploymentv1.ArangoDeployment, err error) {
func (c *FakeArangoDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *deploymentv1.ArangoDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangodeploymentsResource, c.ns, name, pt, data, subresources...), &deploymentv1.ArangoDeployment{})

View file

@ -23,6 +23,8 @@
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"
@ -43,7 +45,7 @@ var arangomembersResource = schema.GroupVersionResource{Group: "database.arangod
var arangomembersKind = schema.GroupVersionKind{Group: "database.arangodb.com", Version: "v1", Kind: "ArangoMember"}
// Get takes name of the arangoMember, and returns the corresponding arangoMember object, and an error if there is any.
func (c *FakeArangoMembers) Get(name string, options v1.GetOptions) (result *deploymentv1.ArangoMember, err error) {
func (c *FakeArangoMembers) Get(ctx context.Context, name string, options v1.GetOptions) (result *deploymentv1.ArangoMember, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangomembersResource, c.ns, name), &deploymentv1.ArangoMember{})
@ -54,7 +56,7 @@ func (c *FakeArangoMembers) Get(name string, options v1.GetOptions) (result *dep
}
// List takes label and field selectors, and returns the list of ArangoMembers that match those selectors.
func (c *FakeArangoMembers) List(opts v1.ListOptions) (result *deploymentv1.ArangoMemberList, err error) {
func (c *FakeArangoMembers) List(ctx context.Context, opts v1.ListOptions) (result *deploymentv1.ArangoMemberList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangomembersResource, arangomembersKind, c.ns, opts), &deploymentv1.ArangoMemberList{})
@ -76,14 +78,14 @@ func (c *FakeArangoMembers) List(opts v1.ListOptions) (result *deploymentv1.Aran
}
// Watch returns a watch.Interface that watches the requested arangoMembers.
func (c *FakeArangoMembers) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoMembers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangomembersResource, c.ns, opts))
}
// Create takes the representation of a arangoMember and creates it. Returns the server's representation of the arangoMember, and an error, if there is any.
func (c *FakeArangoMembers) Create(arangoMember *deploymentv1.ArangoMember) (result *deploymentv1.ArangoMember, err error) {
func (c *FakeArangoMembers) Create(ctx context.Context, arangoMember *deploymentv1.ArangoMember, opts v1.CreateOptions) (result *deploymentv1.ArangoMember, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangomembersResource, c.ns, arangoMember), &deploymentv1.ArangoMember{})
@ -94,7 +96,7 @@ func (c *FakeArangoMembers) Create(arangoMember *deploymentv1.ArangoMember) (res
}
// Update takes the representation of a arangoMember and updates it. Returns the server's representation of the arangoMember, and an error, if there is any.
func (c *FakeArangoMembers) Update(arangoMember *deploymentv1.ArangoMember) (result *deploymentv1.ArangoMember, err error) {
func (c *FakeArangoMembers) Update(ctx context.Context, arangoMember *deploymentv1.ArangoMember, opts v1.UpdateOptions) (result *deploymentv1.ArangoMember, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangomembersResource, c.ns, arangoMember), &deploymentv1.ArangoMember{})
@ -106,7 +108,7 @@ func (c *FakeArangoMembers) Update(arangoMember *deploymentv1.ArangoMember) (res
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoMembers) UpdateStatus(arangoMember *deploymentv1.ArangoMember) (*deploymentv1.ArangoMember, error) {
func (c *FakeArangoMembers) UpdateStatus(ctx context.Context, arangoMember *deploymentv1.ArangoMember, opts v1.UpdateOptions) (*deploymentv1.ArangoMember, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangomembersResource, "status", c.ns, arangoMember), &deploymentv1.ArangoMember{})
@ -117,7 +119,7 @@ func (c *FakeArangoMembers) UpdateStatus(arangoMember *deploymentv1.ArangoMember
}
// Delete takes name of the arangoMember and deletes it. Returns an error if one occurs.
func (c *FakeArangoMembers) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoMembers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(arangomembersResource, c.ns, name), &deploymentv1.ArangoMember{})
@ -125,15 +127,15 @@ func (c *FakeArangoMembers) Delete(name string, options *v1.DeleteOptions) error
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoMembers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangomembersResource, c.ns, listOptions)
func (c *FakeArangoMembers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangomembersResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &deploymentv1.ArangoMemberList{})
return err
}
// Patch applies the patch and returns the patched arangoMember.
func (c *FakeArangoMembers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *deploymentv1.ArangoMember, err error) {
func (c *FakeArangoMembers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *deploymentv1.ArangoMember, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangomembersResource, c.ns, name, pt, data, subresources...), &deploymentv1.ArangoMember{})

View file

@ -23,6 +23,7 @@
package v2alpha1
import (
"context"
"time"
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
@ -41,15 +42,15 @@ type ArangoDeploymentsGetter interface {
// ArangoDeploymentInterface has methods to work with ArangoDeployment resources.
type ArangoDeploymentInterface interface {
Create(*v2alpha1.ArangoDeployment) (*v2alpha1.ArangoDeployment, error)
Update(*v2alpha1.ArangoDeployment) (*v2alpha1.ArangoDeployment, error)
UpdateStatus(*v2alpha1.ArangoDeployment) (*v2alpha1.ArangoDeployment, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v2alpha1.ArangoDeployment, error)
List(opts v1.ListOptions) (*v2alpha1.ArangoDeploymentList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoDeployment, err error)
Create(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.CreateOptions) (*v2alpha1.ArangoDeployment, error)
Update(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.UpdateOptions) (*v2alpha1.ArangoDeployment, error)
UpdateStatus(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.UpdateOptions) (*v2alpha1.ArangoDeployment, 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.ArangoDeployment, error)
List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.ArangoDeploymentList, 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.ArangoDeployment, err error)
ArangoDeploymentExpansion
}
@ -68,20 +69,20 @@ func newArangoDeployments(c *DatabaseV2alpha1Client, namespace string) *arangoDe
}
// Get takes name of the arangoDeployment, and returns the corresponding arangoDeployment object, and an error if there is any.
func (c *arangoDeployments) Get(name string, options v1.GetOptions) (result *v2alpha1.ArangoDeployment, err error) {
func (c *arangoDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ArangoDeployment, err error) {
result = &v2alpha1.ArangoDeployment{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangodeployments").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoDeployments that match those selectors.
func (c *arangoDeployments) List(opts v1.ListOptions) (result *v2alpha1.ArangoDeploymentList, err error) {
func (c *arangoDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ArangoDeploymentList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -92,13 +93,13 @@ func (c *arangoDeployments) List(opts v1.ListOptions) (result *v2alpha1.ArangoDe
Resource("arangodeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoDeployments.
func (c *arangoDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *arangoDeployments) 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
@ -109,87 +110,90 @@ func (c *arangoDeployments) Watch(opts v1.ListOptions) (watch.Interface, error)
Resource("arangodeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoDeployment and creates it. Returns the server's representation of the arangoDeployment, and an error, if there is any.
func (c *arangoDeployments) Create(arangoDeployment *v2alpha1.ArangoDeployment) (result *v2alpha1.ArangoDeployment, err error) {
func (c *arangoDeployments) Create(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.CreateOptions) (result *v2alpha1.ArangoDeployment, err error) {
result = &v2alpha1.ArangoDeployment{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangodeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeployment).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoDeployment and updates it. Returns the server's representation of the arangoDeployment, and an error, if there is any.
func (c *arangoDeployments) Update(arangoDeployment *v2alpha1.ArangoDeployment) (result *v2alpha1.ArangoDeployment, err error) {
func (c *arangoDeployments) Update(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.UpdateOptions) (result *v2alpha1.ArangoDeployment, err error) {
result = &v2alpha1.ArangoDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangodeployments").
Name(arangoDeployment.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeployment).
Do().
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 *arangoDeployments) UpdateStatus(arangoDeployment *v2alpha1.ArangoDeployment) (result *v2alpha1.ArangoDeployment, err error) {
func (c *arangoDeployments) UpdateStatus(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.UpdateOptions) (result *v2alpha1.ArangoDeployment, err error) {
result = &v2alpha1.ArangoDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangodeployments").
Name(arangoDeployment.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeployment).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoDeployment and deletes it. Returns an error if one occurs.
func (c *arangoDeployments) Delete(name string, options *v1.DeleteOptions) error {
func (c *arangoDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangodeployments").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
func (c *arangoDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangodeployments").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoDeployment.
func (c *arangoDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoDeployment, err error) {
func (c *arangoDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoDeployment, err error) {
result = &v2alpha1.ArangoDeployment{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangodeployments").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,7 @@
package v2alpha1
import (
"context"
"time"
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
@ -41,15 +42,15 @@ type ArangoMembersGetter interface {
// ArangoMemberInterface has methods to work with ArangoMember resources.
type ArangoMemberInterface interface {
Create(*v2alpha1.ArangoMember) (*v2alpha1.ArangoMember, error)
Update(*v2alpha1.ArangoMember) (*v2alpha1.ArangoMember, error)
UpdateStatus(*v2alpha1.ArangoMember) (*v2alpha1.ArangoMember, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v2alpha1.ArangoMember, error)
List(opts v1.ListOptions) (*v2alpha1.ArangoMemberList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoMember, err error)
Create(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.CreateOptions) (*v2alpha1.ArangoMember, error)
Update(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.UpdateOptions) (*v2alpha1.ArangoMember, error)
UpdateStatus(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.UpdateOptions) (*v2alpha1.ArangoMember, 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.ArangoMember, error)
List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.ArangoMemberList, 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.ArangoMember, err error)
ArangoMemberExpansion
}
@ -68,20 +69,20 @@ func newArangoMembers(c *DatabaseV2alpha1Client, namespace string) *arangoMember
}
// Get takes name of the arangoMember, and returns the corresponding arangoMember object, and an error if there is any.
func (c *arangoMembers) Get(name string, options v1.GetOptions) (result *v2alpha1.ArangoMember, err error) {
func (c *arangoMembers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ArangoMember, err error) {
result = &v2alpha1.ArangoMember{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangomembers").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoMembers that match those selectors.
func (c *arangoMembers) List(opts v1.ListOptions) (result *v2alpha1.ArangoMemberList, err error) {
func (c *arangoMembers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ArangoMemberList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -92,13 +93,13 @@ func (c *arangoMembers) List(opts v1.ListOptions) (result *v2alpha1.ArangoMember
Resource("arangomembers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoMembers.
func (c *arangoMembers) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *arangoMembers) 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
@ -109,87 +110,90 @@ func (c *arangoMembers) Watch(opts v1.ListOptions) (watch.Interface, error) {
Resource("arangomembers").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoMember and creates it. Returns the server's representation of the arangoMember, and an error, if there is any.
func (c *arangoMembers) Create(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) {
func (c *arangoMembers) Create(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.CreateOptions) (result *v2alpha1.ArangoMember, err error) {
result = &v2alpha1.ArangoMember{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangomembers").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoMember).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoMember and updates it. Returns the server's representation of the arangoMember, and an error, if there is any.
func (c *arangoMembers) Update(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) {
func (c *arangoMembers) Update(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.UpdateOptions) (result *v2alpha1.ArangoMember, err error) {
result = &v2alpha1.ArangoMember{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangomembers").
Name(arangoMember.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoMember).
Do().
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 *arangoMembers) UpdateStatus(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) {
func (c *arangoMembers) UpdateStatus(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.UpdateOptions) (result *v2alpha1.ArangoMember, err error) {
result = &v2alpha1.ArangoMember{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangomembers").
Name(arangoMember.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoMember).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoMember and deletes it. Returns an error if one occurs.
func (c *arangoMembers) Delete(name string, options *v1.DeleteOptions) error {
func (c *arangoMembers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangomembers").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoMembers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
func (c *arangoMembers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangomembers").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoMember.
func (c *arangoMembers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoMember, err error) {
func (c *arangoMembers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoMember, err error) {
result = &v2alpha1.ArangoMember{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangomembers").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,8 @@
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"
@ -43,7 +45,7 @@ var arangodeploymentsResource = schema.GroupVersionResource{Group: "database.ara
var arangodeploymentsKind = schema.GroupVersionKind{Group: "database.arangodb.com", Version: "v2alpha1", Kind: "ArangoDeployment"}
// Get takes name of the arangoDeployment, and returns the corresponding arangoDeployment object, and an error if there is any.
func (c *FakeArangoDeployments) Get(name string, options v1.GetOptions) (result *v2alpha1.ArangoDeployment, err error) {
func (c *FakeArangoDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ArangoDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangodeploymentsResource, c.ns, name), &v2alpha1.ArangoDeployment{})
@ -54,7 +56,7 @@ func (c *FakeArangoDeployments) Get(name string, options v1.GetOptions) (result
}
// List takes label and field selectors, and returns the list of ArangoDeployments that match those selectors.
func (c *FakeArangoDeployments) List(opts v1.ListOptions) (result *v2alpha1.ArangoDeploymentList, err error) {
func (c *FakeArangoDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ArangoDeploymentList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangodeploymentsResource, arangodeploymentsKind, c.ns, opts), &v2alpha1.ArangoDeploymentList{})
@ -76,14 +78,14 @@ func (c *FakeArangoDeployments) List(opts v1.ListOptions) (result *v2alpha1.Aran
}
// Watch returns a watch.Interface that watches the requested arangoDeployments.
func (c *FakeArangoDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangodeploymentsResource, c.ns, opts))
}
// Create takes the representation of a arangoDeployment and creates it. Returns the server's representation of the arangoDeployment, and an error, if there is any.
func (c *FakeArangoDeployments) Create(arangoDeployment *v2alpha1.ArangoDeployment) (result *v2alpha1.ArangoDeployment, err error) {
func (c *FakeArangoDeployments) Create(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.CreateOptions) (result *v2alpha1.ArangoDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangodeploymentsResource, c.ns, arangoDeployment), &v2alpha1.ArangoDeployment{})
@ -94,7 +96,7 @@ func (c *FakeArangoDeployments) Create(arangoDeployment *v2alpha1.ArangoDeployme
}
// Update takes the representation of a arangoDeployment and updates it. Returns the server's representation of the arangoDeployment, and an error, if there is any.
func (c *FakeArangoDeployments) Update(arangoDeployment *v2alpha1.ArangoDeployment) (result *v2alpha1.ArangoDeployment, err error) {
func (c *FakeArangoDeployments) Update(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.UpdateOptions) (result *v2alpha1.ArangoDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangodeploymentsResource, c.ns, arangoDeployment), &v2alpha1.ArangoDeployment{})
@ -106,7 +108,7 @@ func (c *FakeArangoDeployments) Update(arangoDeployment *v2alpha1.ArangoDeployme
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoDeployments) UpdateStatus(arangoDeployment *v2alpha1.ArangoDeployment) (*v2alpha1.ArangoDeployment, error) {
func (c *FakeArangoDeployments) UpdateStatus(ctx context.Context, arangoDeployment *v2alpha1.ArangoDeployment, opts v1.UpdateOptions) (*v2alpha1.ArangoDeployment, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangodeploymentsResource, "status", c.ns, arangoDeployment), &v2alpha1.ArangoDeployment{})
@ -117,7 +119,7 @@ func (c *FakeArangoDeployments) UpdateStatus(arangoDeployment *v2alpha1.ArangoDe
}
// Delete takes name of the arangoDeployment and deletes it. Returns an error if one occurs.
func (c *FakeArangoDeployments) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(arangodeploymentsResource, c.ns, name), &v2alpha1.ArangoDeployment{})
@ -125,15 +127,15 @@ func (c *FakeArangoDeployments) Delete(name string, options *v1.DeleteOptions) e
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangodeploymentsResource, c.ns, listOptions)
func (c *FakeArangoDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangodeploymentsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v2alpha1.ArangoDeploymentList{})
return err
}
// Patch applies the patch and returns the patched arangoDeployment.
func (c *FakeArangoDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoDeployment, err error) {
func (c *FakeArangoDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangodeploymentsResource, c.ns, name, pt, data, subresources...), &v2alpha1.ArangoDeployment{})

View file

@ -23,6 +23,8 @@
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"
@ -43,7 +45,7 @@ var arangomembersResource = schema.GroupVersionResource{Group: "database.arangod
var arangomembersKind = schema.GroupVersionKind{Group: "database.arangodb.com", Version: "v2alpha1", Kind: "ArangoMember"}
// Get takes name of the arangoMember, and returns the corresponding arangoMember object, and an error if there is any.
func (c *FakeArangoMembers) Get(name string, options v1.GetOptions) (result *v2alpha1.ArangoMember, err error) {
func (c *FakeArangoMembers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ArangoMember, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangomembersResource, c.ns, name), &v2alpha1.ArangoMember{})
@ -54,7 +56,7 @@ func (c *FakeArangoMembers) Get(name string, options v1.GetOptions) (result *v2a
}
// List takes label and field selectors, and returns the list of ArangoMembers that match those selectors.
func (c *FakeArangoMembers) List(opts v1.ListOptions) (result *v2alpha1.ArangoMemberList, err error) {
func (c *FakeArangoMembers) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ArangoMemberList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangomembersResource, arangomembersKind, c.ns, opts), &v2alpha1.ArangoMemberList{})
@ -76,14 +78,14 @@ func (c *FakeArangoMembers) List(opts v1.ListOptions) (result *v2alpha1.ArangoMe
}
// Watch returns a watch.Interface that watches the requested arangoMembers.
func (c *FakeArangoMembers) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoMembers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangomembersResource, c.ns, opts))
}
// Create takes the representation of a arangoMember and creates it. Returns the server's representation of the arangoMember, and an error, if there is any.
func (c *FakeArangoMembers) Create(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) {
func (c *FakeArangoMembers) Create(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.CreateOptions) (result *v2alpha1.ArangoMember, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangomembersResource, c.ns, arangoMember), &v2alpha1.ArangoMember{})
@ -94,7 +96,7 @@ func (c *FakeArangoMembers) Create(arangoMember *v2alpha1.ArangoMember) (result
}
// Update takes the representation of a arangoMember and updates it. Returns the server's representation of the arangoMember, and an error, if there is any.
func (c *FakeArangoMembers) Update(arangoMember *v2alpha1.ArangoMember) (result *v2alpha1.ArangoMember, err error) {
func (c *FakeArangoMembers) Update(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.UpdateOptions) (result *v2alpha1.ArangoMember, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangomembersResource, c.ns, arangoMember), &v2alpha1.ArangoMember{})
@ -106,7 +108,7 @@ func (c *FakeArangoMembers) Update(arangoMember *v2alpha1.ArangoMember) (result
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoMembers) UpdateStatus(arangoMember *v2alpha1.ArangoMember) (*v2alpha1.ArangoMember, error) {
func (c *FakeArangoMembers) UpdateStatus(ctx context.Context, arangoMember *v2alpha1.ArangoMember, opts v1.UpdateOptions) (*v2alpha1.ArangoMember, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangomembersResource, "status", c.ns, arangoMember), &v2alpha1.ArangoMember{})
@ -117,7 +119,7 @@ func (c *FakeArangoMembers) UpdateStatus(arangoMember *v2alpha1.ArangoMember) (*
}
// Delete takes name of the arangoMember and deletes it. Returns an error if one occurs.
func (c *FakeArangoMembers) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoMembers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(arangomembersResource, c.ns, name), &v2alpha1.ArangoMember{})
@ -125,15 +127,15 @@ func (c *FakeArangoMembers) Delete(name string, options *v1.DeleteOptions) error
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoMembers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangomembersResource, c.ns, listOptions)
func (c *FakeArangoMembers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangomembersResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v2alpha1.ArangoMemberList{})
return err
}
// Patch applies the patch and returns the patched arangoMember.
func (c *FakeArangoMembers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoMember, err error) {
func (c *FakeArangoMembers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoMember, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangomembersResource, c.ns, name, pt, data, subresources...), &v2alpha1.ArangoMember{})

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
"time"
v1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
@ -41,15 +42,15 @@ type ArangoDeploymentReplicationsGetter interface {
// ArangoDeploymentReplicationInterface has methods to work with ArangoDeploymentReplication resources.
type ArangoDeploymentReplicationInterface interface {
Create(*v1.ArangoDeploymentReplication) (*v1.ArangoDeploymentReplication, error)
Update(*v1.ArangoDeploymentReplication) (*v1.ArangoDeploymentReplication, error)
UpdateStatus(*v1.ArangoDeploymentReplication) (*v1.ArangoDeploymentReplication, error)
Delete(name string, options *metav1.DeleteOptions) error
DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error
Get(name string, options metav1.GetOptions) (*v1.ArangoDeploymentReplication, error)
List(opts metav1.ListOptions) (*v1.ArangoDeploymentReplicationList, error)
Watch(opts metav1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoDeploymentReplication, err error)
Create(ctx context.Context, arangoDeploymentReplication *v1.ArangoDeploymentReplication, opts metav1.CreateOptions) (*v1.ArangoDeploymentReplication, error)
Update(ctx context.Context, arangoDeploymentReplication *v1.ArangoDeploymentReplication, opts metav1.UpdateOptions) (*v1.ArangoDeploymentReplication, error)
UpdateStatus(ctx context.Context, arangoDeploymentReplication *v1.ArangoDeploymentReplication, opts metav1.UpdateOptions) (*v1.ArangoDeploymentReplication, 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.ArangoDeploymentReplication, error)
List(ctx context.Context, opts metav1.ListOptions) (*v1.ArangoDeploymentReplicationList, 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.ArangoDeploymentReplication, err error)
ArangoDeploymentReplicationExpansion
}
@ -68,20 +69,20 @@ func newArangoDeploymentReplications(c *ReplicationV1Client, namespace string) *
}
// Get takes name of the arangoDeploymentReplication, and returns the corresponding arangoDeploymentReplication object, and an error if there is any.
func (c *arangoDeploymentReplications) Get(name string, options metav1.GetOptions) (result *v1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.ArangoDeploymentReplication, err error) {
result = &v1.ArangoDeploymentReplication{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangodeploymentreplications").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoDeploymentReplications that match those selectors.
func (c *arangoDeploymentReplications) List(opts metav1.ListOptions) (result *v1.ArangoDeploymentReplicationList, err error) {
func (c *arangoDeploymentReplications) List(ctx context.Context, opts metav1.ListOptions) (result *v1.ArangoDeploymentReplicationList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -92,13 +93,13 @@ func (c *arangoDeploymentReplications) List(opts metav1.ListOptions) (result *v1
Resource("arangodeploymentreplications").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoDeploymentReplications.
func (c *arangoDeploymentReplications) Watch(opts metav1.ListOptions) (watch.Interface, error) {
func (c *arangoDeploymentReplications) 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
@ -109,87 +110,90 @@ func (c *arangoDeploymentReplications) Watch(opts metav1.ListOptions) (watch.Int
Resource("arangodeploymentreplications").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoDeploymentReplication and creates it. Returns the server's representation of the arangoDeploymentReplication, and an error, if there is any.
func (c *arangoDeploymentReplications) Create(arangoDeploymentReplication *v1.ArangoDeploymentReplication) (result *v1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) Create(ctx context.Context, arangoDeploymentReplication *v1.ArangoDeploymentReplication, opts metav1.CreateOptions) (result *v1.ArangoDeploymentReplication, err error) {
result = &v1.ArangoDeploymentReplication{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangodeploymentreplications").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeploymentReplication).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoDeploymentReplication and updates it. Returns the server's representation of the arangoDeploymentReplication, and an error, if there is any.
func (c *arangoDeploymentReplications) Update(arangoDeploymentReplication *v1.ArangoDeploymentReplication) (result *v1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) Update(ctx context.Context, arangoDeploymentReplication *v1.ArangoDeploymentReplication, opts metav1.UpdateOptions) (result *v1.ArangoDeploymentReplication, err error) {
result = &v1.ArangoDeploymentReplication{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangodeploymentreplications").
Name(arangoDeploymentReplication.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeploymentReplication).
Do().
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 *arangoDeploymentReplications) UpdateStatus(arangoDeploymentReplication *v1.ArangoDeploymentReplication) (result *v1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) UpdateStatus(ctx context.Context, arangoDeploymentReplication *v1.ArangoDeploymentReplication, opts metav1.UpdateOptions) (result *v1.ArangoDeploymentReplication, err error) {
result = &v1.ArangoDeploymentReplication{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangodeploymentreplications").
Name(arangoDeploymentReplication.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeploymentReplication).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoDeploymentReplication and deletes it. Returns an error if one occurs.
func (c *arangoDeploymentReplications) Delete(name string, options *metav1.DeleteOptions) error {
func (c *arangoDeploymentReplications) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangodeploymentreplications").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoDeploymentReplications) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
func (c *arangoDeploymentReplications) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangodeploymentreplications").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoDeploymentReplication.
func (c *arangoDeploymentReplications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.ArangoDeploymentReplication, err error) {
result = &v1.ArangoDeploymentReplication{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangodeploymentreplications").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,8 @@
package fake
import (
"context"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
@ -43,7 +45,7 @@ var arangodeploymentreplicationsResource = schema.GroupVersionResource{Group: "r
var arangodeploymentreplicationsKind = schema.GroupVersionKind{Group: "replication.database.arangodb.com", Version: "v1", Kind: "ArangoDeploymentReplication"}
// Get takes name of the arangoDeploymentReplication, and returns the corresponding arangoDeploymentReplication object, and an error if there is any.
func (c *FakeArangoDeploymentReplications) Get(name string, options v1.GetOptions) (result *replicationv1.ArangoDeploymentReplication, err error) {
func (c *FakeArangoDeploymentReplications) Get(ctx context.Context, name string, options v1.GetOptions) (result *replicationv1.ArangoDeploymentReplication, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangodeploymentreplicationsResource, c.ns, name), &replicationv1.ArangoDeploymentReplication{})
@ -54,7 +56,7 @@ func (c *FakeArangoDeploymentReplications) Get(name string, options v1.GetOption
}
// List takes label and field selectors, and returns the list of ArangoDeploymentReplications that match those selectors.
func (c *FakeArangoDeploymentReplications) List(opts v1.ListOptions) (result *replicationv1.ArangoDeploymentReplicationList, err error) {
func (c *FakeArangoDeploymentReplications) List(ctx context.Context, opts v1.ListOptions) (result *replicationv1.ArangoDeploymentReplicationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangodeploymentreplicationsResource, arangodeploymentreplicationsKind, c.ns, opts), &replicationv1.ArangoDeploymentReplicationList{})
@ -76,14 +78,14 @@ func (c *FakeArangoDeploymentReplications) List(opts v1.ListOptions) (result *re
}
// Watch returns a watch.Interface that watches the requested arangoDeploymentReplications.
func (c *FakeArangoDeploymentReplications) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoDeploymentReplications) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangodeploymentreplicationsResource, c.ns, opts))
}
// Create takes the representation of a arangoDeploymentReplication and creates it. Returns the server's representation of the arangoDeploymentReplication, and an error, if there is any.
func (c *FakeArangoDeploymentReplications) Create(arangoDeploymentReplication *replicationv1.ArangoDeploymentReplication) (result *replicationv1.ArangoDeploymentReplication, err error) {
func (c *FakeArangoDeploymentReplications) Create(ctx context.Context, arangoDeploymentReplication *replicationv1.ArangoDeploymentReplication, opts v1.CreateOptions) (result *replicationv1.ArangoDeploymentReplication, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangodeploymentreplicationsResource, c.ns, arangoDeploymentReplication), &replicationv1.ArangoDeploymentReplication{})
@ -94,7 +96,7 @@ func (c *FakeArangoDeploymentReplications) Create(arangoDeploymentReplication *r
}
// Update takes the representation of a arangoDeploymentReplication and updates it. Returns the server's representation of the arangoDeploymentReplication, and an error, if there is any.
func (c *FakeArangoDeploymentReplications) Update(arangoDeploymentReplication *replicationv1.ArangoDeploymentReplication) (result *replicationv1.ArangoDeploymentReplication, err error) {
func (c *FakeArangoDeploymentReplications) Update(ctx context.Context, arangoDeploymentReplication *replicationv1.ArangoDeploymentReplication, opts v1.UpdateOptions) (result *replicationv1.ArangoDeploymentReplication, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangodeploymentreplicationsResource, c.ns, arangoDeploymentReplication), &replicationv1.ArangoDeploymentReplication{})
@ -106,7 +108,7 @@ func (c *FakeArangoDeploymentReplications) Update(arangoDeploymentReplication *r
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoDeploymentReplications) UpdateStatus(arangoDeploymentReplication *replicationv1.ArangoDeploymentReplication) (*replicationv1.ArangoDeploymentReplication, error) {
func (c *FakeArangoDeploymentReplications) UpdateStatus(ctx context.Context, arangoDeploymentReplication *replicationv1.ArangoDeploymentReplication, opts v1.UpdateOptions) (*replicationv1.ArangoDeploymentReplication, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangodeploymentreplicationsResource, "status", c.ns, arangoDeploymentReplication), &replicationv1.ArangoDeploymentReplication{})
@ -117,7 +119,7 @@ func (c *FakeArangoDeploymentReplications) UpdateStatus(arangoDeploymentReplicat
}
// Delete takes name of the arangoDeploymentReplication and deletes it. Returns an error if one occurs.
func (c *FakeArangoDeploymentReplications) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoDeploymentReplications) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(arangodeploymentreplicationsResource, c.ns, name), &replicationv1.ArangoDeploymentReplication{})
@ -125,15 +127,15 @@ func (c *FakeArangoDeploymentReplications) Delete(name string, options *v1.Delet
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoDeploymentReplications) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangodeploymentreplicationsResource, c.ns, listOptions)
func (c *FakeArangoDeploymentReplications) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangodeploymentreplicationsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &replicationv1.ArangoDeploymentReplicationList{})
return err
}
// Patch applies the patch and returns the patched arangoDeploymentReplication.
func (c *FakeArangoDeploymentReplications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *replicationv1.ArangoDeploymentReplication, err error) {
func (c *FakeArangoDeploymentReplications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *replicationv1.ArangoDeploymentReplication, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangodeploymentreplicationsResource, c.ns, name, pt, data, subresources...), &replicationv1.ArangoDeploymentReplication{})

View file

@ -23,6 +23,7 @@
package v2alpha1
import (
"context"
"time"
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
@ -41,15 +42,15 @@ type ArangoDeploymentReplicationsGetter interface {
// ArangoDeploymentReplicationInterface has methods to work with ArangoDeploymentReplication resources.
type ArangoDeploymentReplicationInterface interface {
Create(*v2alpha1.ArangoDeploymentReplication) (*v2alpha1.ArangoDeploymentReplication, error)
Update(*v2alpha1.ArangoDeploymentReplication) (*v2alpha1.ArangoDeploymentReplication, error)
UpdateStatus(*v2alpha1.ArangoDeploymentReplication) (*v2alpha1.ArangoDeploymentReplication, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v2alpha1.ArangoDeploymentReplication, error)
List(opts v1.ListOptions) (*v2alpha1.ArangoDeploymentReplicationList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoDeploymentReplication, err error)
Create(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.CreateOptions) (*v2alpha1.ArangoDeploymentReplication, error)
Update(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.UpdateOptions) (*v2alpha1.ArangoDeploymentReplication, error)
UpdateStatus(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.UpdateOptions) (*v2alpha1.ArangoDeploymentReplication, 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.ArangoDeploymentReplication, error)
List(ctx context.Context, opts v1.ListOptions) (*v2alpha1.ArangoDeploymentReplicationList, 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.ArangoDeploymentReplication, err error)
ArangoDeploymentReplicationExpansion
}
@ -68,20 +69,20 @@ func newArangoDeploymentReplications(c *ReplicationV2alpha1Client, namespace str
}
// Get takes name of the arangoDeploymentReplication, and returns the corresponding arangoDeploymentReplication object, and an error if there is any.
func (c *arangoDeploymentReplications) Get(name string, options v1.GetOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
result = &v2alpha1.ArangoDeploymentReplication{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangodeploymentreplications").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoDeploymentReplications that match those selectors.
func (c *arangoDeploymentReplications) List(opts v1.ListOptions) (result *v2alpha1.ArangoDeploymentReplicationList, err error) {
func (c *arangoDeploymentReplications) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ArangoDeploymentReplicationList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -92,13 +93,13 @@ func (c *arangoDeploymentReplications) List(opts v1.ListOptions) (result *v2alph
Resource("arangodeploymentreplications").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoDeploymentReplications.
func (c *arangoDeploymentReplications) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *arangoDeploymentReplications) 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
@ -109,87 +110,90 @@ func (c *arangoDeploymentReplications) Watch(opts v1.ListOptions) (watch.Interfa
Resource("arangodeploymentreplications").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoDeploymentReplication and creates it. Returns the server's representation of the arangoDeploymentReplication, and an error, if there is any.
func (c *arangoDeploymentReplications) Create(arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) Create(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.CreateOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
result = &v2alpha1.ArangoDeploymentReplication{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangodeploymentreplications").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeploymentReplication).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoDeploymentReplication and updates it. Returns the server's representation of the arangoDeploymentReplication, and an error, if there is any.
func (c *arangoDeploymentReplications) Update(arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) Update(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.UpdateOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
result = &v2alpha1.ArangoDeploymentReplication{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangodeploymentreplications").
Name(arangoDeploymentReplication.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeploymentReplication).
Do().
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 *arangoDeploymentReplications) UpdateStatus(arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) UpdateStatus(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.UpdateOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
result = &v2alpha1.ArangoDeploymentReplication{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangodeploymentreplications").
Name(arangoDeploymentReplication.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoDeploymentReplication).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoDeploymentReplication and deletes it. Returns an error if one occurs.
func (c *arangoDeploymentReplications) Delete(name string, options *v1.DeleteOptions) error {
func (c *arangoDeploymentReplications) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangodeploymentreplications").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoDeploymentReplications) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
func (c *arangoDeploymentReplications) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangodeploymentreplications").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoDeploymentReplication.
func (c *arangoDeploymentReplications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *arangoDeploymentReplications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoDeploymentReplication, err error) {
result = &v2alpha1.ArangoDeploymentReplication{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangodeploymentreplications").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,8 @@
package fake
import (
"context"
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
@ -43,7 +45,7 @@ var arangodeploymentreplicationsResource = schema.GroupVersionResource{Group: "r
var arangodeploymentreplicationsKind = schema.GroupVersionKind{Group: "replication.database.arangodb.com", Version: "v2alpha1", Kind: "ArangoDeploymentReplication"}
// Get takes name of the arangoDeploymentReplication, and returns the corresponding arangoDeploymentReplication object, and an error if there is any.
func (c *FakeArangoDeploymentReplications) Get(name string, options v1.GetOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *FakeArangoDeploymentReplications) Get(ctx context.Context, name string, options v1.GetOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangodeploymentreplicationsResource, c.ns, name), &v2alpha1.ArangoDeploymentReplication{})
@ -54,7 +56,7 @@ func (c *FakeArangoDeploymentReplications) Get(name string, options v1.GetOption
}
// List takes label and field selectors, and returns the list of ArangoDeploymentReplications that match those selectors.
func (c *FakeArangoDeploymentReplications) List(opts v1.ListOptions) (result *v2alpha1.ArangoDeploymentReplicationList, err error) {
func (c *FakeArangoDeploymentReplications) List(ctx context.Context, opts v1.ListOptions) (result *v2alpha1.ArangoDeploymentReplicationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangodeploymentreplicationsResource, arangodeploymentreplicationsKind, c.ns, opts), &v2alpha1.ArangoDeploymentReplicationList{})
@ -76,14 +78,14 @@ func (c *FakeArangoDeploymentReplications) List(opts v1.ListOptions) (result *v2
}
// Watch returns a watch.Interface that watches the requested arangoDeploymentReplications.
func (c *FakeArangoDeploymentReplications) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoDeploymentReplications) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangodeploymentreplicationsResource, c.ns, opts))
}
// Create takes the representation of a arangoDeploymentReplication and creates it. Returns the server's representation of the arangoDeploymentReplication, and an error, if there is any.
func (c *FakeArangoDeploymentReplications) Create(arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *FakeArangoDeploymentReplications) Create(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.CreateOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangodeploymentreplicationsResource, c.ns, arangoDeploymentReplication), &v2alpha1.ArangoDeploymentReplication{})
@ -94,7 +96,7 @@ func (c *FakeArangoDeploymentReplications) Create(arangoDeploymentReplication *v
}
// Update takes the representation of a arangoDeploymentReplication and updates it. Returns the server's representation of the arangoDeploymentReplication, and an error, if there is any.
func (c *FakeArangoDeploymentReplications) Update(arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *FakeArangoDeploymentReplications) Update(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.UpdateOptions) (result *v2alpha1.ArangoDeploymentReplication, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangodeploymentreplicationsResource, c.ns, arangoDeploymentReplication), &v2alpha1.ArangoDeploymentReplication{})
@ -106,7 +108,7 @@ func (c *FakeArangoDeploymentReplications) Update(arangoDeploymentReplication *v
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoDeploymentReplications) UpdateStatus(arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication) (*v2alpha1.ArangoDeploymentReplication, error) {
func (c *FakeArangoDeploymentReplications) UpdateStatus(ctx context.Context, arangoDeploymentReplication *v2alpha1.ArangoDeploymentReplication, opts v1.UpdateOptions) (*v2alpha1.ArangoDeploymentReplication, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangodeploymentreplicationsResource, "status", c.ns, arangoDeploymentReplication), &v2alpha1.ArangoDeploymentReplication{})
@ -117,7 +119,7 @@ func (c *FakeArangoDeploymentReplications) UpdateStatus(arangoDeploymentReplicat
}
// Delete takes name of the arangoDeploymentReplication and deletes it. Returns an error if one occurs.
func (c *FakeArangoDeploymentReplications) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoDeploymentReplications) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(arangodeploymentreplicationsResource, c.ns, name), &v2alpha1.ArangoDeploymentReplication{})
@ -125,15 +127,15 @@ func (c *FakeArangoDeploymentReplications) Delete(name string, options *v1.Delet
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoDeploymentReplications) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangodeploymentreplicationsResource, c.ns, listOptions)
func (c *FakeArangoDeploymentReplications) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangodeploymentreplicationsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v2alpha1.ArangoDeploymentReplicationList{})
return err
}
// Patch applies the patch and returns the patched arangoDeploymentReplication.
func (c *FakeArangoDeploymentReplications) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2alpha1.ArangoDeploymentReplication, err error) {
func (c *FakeArangoDeploymentReplications) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v2alpha1.ArangoDeploymentReplication, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangodeploymentreplicationsResource, c.ns, name, pt, data, subresources...), &v2alpha1.ArangoDeploymentReplication{})

View file

@ -23,6 +23,7 @@
package v1alpha
import (
"context"
"time"
v1alpha "github.com/arangodb/kube-arangodb/pkg/apis/storage/v1alpha"
@ -41,15 +42,15 @@ type ArangoLocalStoragesGetter interface {
// ArangoLocalStorageInterface has methods to work with ArangoLocalStorage resources.
type ArangoLocalStorageInterface interface {
Create(*v1alpha.ArangoLocalStorage) (*v1alpha.ArangoLocalStorage, error)
Update(*v1alpha.ArangoLocalStorage) (*v1alpha.ArangoLocalStorage, error)
UpdateStatus(*v1alpha.ArangoLocalStorage) (*v1alpha.ArangoLocalStorage, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1alpha.ArangoLocalStorage, error)
List(opts v1.ListOptions) (*v1alpha.ArangoLocalStorageList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha.ArangoLocalStorage, err error)
Create(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.CreateOptions) (*v1alpha.ArangoLocalStorage, error)
Update(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.UpdateOptions) (*v1alpha.ArangoLocalStorage, error)
UpdateStatus(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.UpdateOptions) (*v1alpha.ArangoLocalStorage, 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) (*v1alpha.ArangoLocalStorage, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha.ArangoLocalStorageList, 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 *v1alpha.ArangoLocalStorage, err error)
ArangoLocalStorageExpansion
}
@ -66,19 +67,19 @@ func newArangoLocalStorages(c *StorageV1alphaClient) *arangoLocalStorages {
}
// Get takes name of the arangoLocalStorage, and returns the corresponding arangoLocalStorage object, and an error if there is any.
func (c *arangoLocalStorages) Get(name string, options v1.GetOptions) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *arangoLocalStorages) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha.ArangoLocalStorage, err error) {
result = &v1alpha.ArangoLocalStorage{}
err = c.client.Get().
Resource("arangolocalstorages").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoLocalStorages that match those selectors.
func (c *arangoLocalStorages) List(opts v1.ListOptions) (result *v1alpha.ArangoLocalStorageList, err error) {
func (c *arangoLocalStorages) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha.ArangoLocalStorageList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
@ -88,13 +89,13 @@ func (c *arangoLocalStorages) List(opts v1.ListOptions) (result *v1alpha.ArangoL
Resource("arangolocalstorages").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoLocalStorages.
func (c *arangoLocalStorages) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *arangoLocalStorages) 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
@ -104,81 +105,84 @@ func (c *arangoLocalStorages) Watch(opts v1.ListOptions) (watch.Interface, error
Resource("arangolocalstorages").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
Watch(ctx)
}
// Create takes the representation of a arangoLocalStorage and creates it. Returns the server's representation of the arangoLocalStorage, and an error, if there is any.
func (c *arangoLocalStorages) Create(arangoLocalStorage *v1alpha.ArangoLocalStorage) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *arangoLocalStorages) Create(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.CreateOptions) (result *v1alpha.ArangoLocalStorage, err error) {
result = &v1alpha.ArangoLocalStorage{}
err = c.client.Post().
Resource("arangolocalstorages").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoLocalStorage).
Do().
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoLocalStorage and updates it. Returns the server's representation of the arangoLocalStorage, and an error, if there is any.
func (c *arangoLocalStorages) Update(arangoLocalStorage *v1alpha.ArangoLocalStorage) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *arangoLocalStorages) Update(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.UpdateOptions) (result *v1alpha.ArangoLocalStorage, err error) {
result = &v1alpha.ArangoLocalStorage{}
err = c.client.Put().
Resource("arangolocalstorages").
Name(arangoLocalStorage.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoLocalStorage).
Do().
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 *arangoLocalStorages) UpdateStatus(arangoLocalStorage *v1alpha.ArangoLocalStorage) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *arangoLocalStorages) UpdateStatus(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.UpdateOptions) (result *v1alpha.ArangoLocalStorage, err error) {
result = &v1alpha.ArangoLocalStorage{}
err = c.client.Put().
Resource("arangolocalstorages").
Name(arangoLocalStorage.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoLocalStorage).
Do().
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoLocalStorage and deletes it. Returns an error if one occurs.
func (c *arangoLocalStorages) Delete(name string, options *v1.DeleteOptions) error {
func (c *arangoLocalStorages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("arangolocalstorages").
Name(name).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoLocalStorages) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
func (c *arangoLocalStorages) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("arangolocalstorages").
VersionedParams(&listOptions, scheme.ParameterCodec).
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoLocalStorage.
func (c *arangoLocalStorages) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *arangoLocalStorages) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha.ArangoLocalStorage, err error) {
result = &v1alpha.ArangoLocalStorage{}
err = c.client.Patch(pt).
Resource("arangolocalstorages").
SubResource(subresources...).
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do().
Do(ctx).
Into(result)
return
}

View file

@ -23,6 +23,8 @@
package fake
import (
"context"
v1alpha "github.com/arangodb/kube-arangodb/pkg/apis/storage/v1alpha"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
@ -42,7 +44,7 @@ var arangolocalstoragesResource = schema.GroupVersionResource{Group: "storage.ar
var arangolocalstoragesKind = schema.GroupVersionKind{Group: "storage.arangodb.com", Version: "v1alpha", Kind: "ArangoLocalStorage"}
// Get takes name of the arangoLocalStorage, and returns the corresponding arangoLocalStorage object, and an error if there is any.
func (c *FakeArangoLocalStorages) Get(name string, options v1.GetOptions) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *FakeArangoLocalStorages) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha.ArangoLocalStorage, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(arangolocalstoragesResource, name), &v1alpha.ArangoLocalStorage{})
if obj == nil {
@ -52,7 +54,7 @@ func (c *FakeArangoLocalStorages) Get(name string, options v1.GetOptions) (resul
}
// List takes label and field selectors, and returns the list of ArangoLocalStorages that match those selectors.
func (c *FakeArangoLocalStorages) List(opts v1.ListOptions) (result *v1alpha.ArangoLocalStorageList, err error) {
func (c *FakeArangoLocalStorages) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha.ArangoLocalStorageList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(arangolocalstoragesResource, arangolocalstoragesKind, opts), &v1alpha.ArangoLocalStorageList{})
if obj == nil {
@ -73,13 +75,13 @@ func (c *FakeArangoLocalStorages) List(opts v1.ListOptions) (result *v1alpha.Ara
}
// Watch returns a watch.Interface that watches the requested arangoLocalStorages.
func (c *FakeArangoLocalStorages) Watch(opts v1.ListOptions) (watch.Interface, error) {
func (c *FakeArangoLocalStorages) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(arangolocalstoragesResource, opts))
}
// Create takes the representation of a arangoLocalStorage and creates it. Returns the server's representation of the arangoLocalStorage, and an error, if there is any.
func (c *FakeArangoLocalStorages) Create(arangoLocalStorage *v1alpha.ArangoLocalStorage) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *FakeArangoLocalStorages) Create(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.CreateOptions) (result *v1alpha.ArangoLocalStorage, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(arangolocalstoragesResource, arangoLocalStorage), &v1alpha.ArangoLocalStorage{})
if obj == nil {
@ -89,7 +91,7 @@ func (c *FakeArangoLocalStorages) Create(arangoLocalStorage *v1alpha.ArangoLocal
}
// Update takes the representation of a arangoLocalStorage and updates it. Returns the server's representation of the arangoLocalStorage, and an error, if there is any.
func (c *FakeArangoLocalStorages) Update(arangoLocalStorage *v1alpha.ArangoLocalStorage) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *FakeArangoLocalStorages) Update(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.UpdateOptions) (result *v1alpha.ArangoLocalStorage, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(arangolocalstoragesResource, arangoLocalStorage), &v1alpha.ArangoLocalStorage{})
if obj == nil {
@ -100,7 +102,7 @@ func (c *FakeArangoLocalStorages) Update(arangoLocalStorage *v1alpha.ArangoLocal
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoLocalStorages) UpdateStatus(arangoLocalStorage *v1alpha.ArangoLocalStorage) (*v1alpha.ArangoLocalStorage, error) {
func (c *FakeArangoLocalStorages) UpdateStatus(ctx context.Context, arangoLocalStorage *v1alpha.ArangoLocalStorage, opts v1.UpdateOptions) (*v1alpha.ArangoLocalStorage, error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(arangolocalstoragesResource, "status", arangoLocalStorage), &v1alpha.ArangoLocalStorage{})
if obj == nil {
@ -110,22 +112,22 @@ func (c *FakeArangoLocalStorages) UpdateStatus(arangoLocalStorage *v1alpha.Arang
}
// Delete takes name of the arangoLocalStorage and deletes it. Returns an error if one occurs.
func (c *FakeArangoLocalStorages) Delete(name string, options *v1.DeleteOptions) error {
func (c *FakeArangoLocalStorages) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(arangolocalstoragesResource, name), &v1alpha.ArangoLocalStorage{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoLocalStorages) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(arangolocalstoragesResource, listOptions)
func (c *FakeArangoLocalStorages) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(arangolocalstoragesResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha.ArangoLocalStorageList{})
return err
}
// Patch applies the patch and returns the patched arangoLocalStorage.
func (c *FakeArangoLocalStorages) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha.ArangoLocalStorage, err error) {
func (c *FakeArangoLocalStorages) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha.ArangoLocalStorage, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(arangolocalstoragesResource, name, pt, data, subresources...), &v1alpha.ArangoLocalStorage{})
if obj == nil {

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
time "time"
backupv1 "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"
@ -65,13 +66,13 @@ func NewFilteredArangoBackupInformer(client versioned.Interface, namespace strin
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.BackupV1().ArangoBackups(namespace).List(options)
return client.BackupV1().ArangoBackups(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.BackupV1().ArangoBackups(namespace).Watch(options)
return client.BackupV1().ArangoBackups(namespace).Watch(context.TODO(), options)
},
},
&backupv1.ArangoBackup{},

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
time "time"
backupv1 "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"
@ -65,13 +66,13 @@ func NewFilteredArangoBackupPolicyInformer(client versioned.Interface, namespace
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.BackupV1().ArangoBackupPolicies(namespace).List(options)
return client.BackupV1().ArangoBackupPolicies(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.BackupV1().ArangoBackupPolicies(namespace).Watch(options)
return client.BackupV1().ArangoBackupPolicies(namespace).Watch(context.TODO(), options)
},
},
&backupv1.ArangoBackupPolicy{},

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
time "time"
deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
@ -65,13 +66,13 @@ func NewFilteredArangoDeploymentInformer(client versioned.Interface, namespace s
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DatabaseV1().ArangoDeployments(namespace).List(options)
return client.DatabaseV1().ArangoDeployments(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DatabaseV1().ArangoDeployments(namespace).Watch(options)
return client.DatabaseV1().ArangoDeployments(namespace).Watch(context.TODO(), options)
},
},
&deploymentv1.ArangoDeployment{},

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
time "time"
deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
@ -65,13 +66,13 @@ func NewFilteredArangoMemberInformer(client versioned.Interface, namespace strin
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DatabaseV1().ArangoMembers(namespace).List(options)
return client.DatabaseV1().ArangoMembers(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DatabaseV1().ArangoMembers(namespace).Watch(options)
return client.DatabaseV1().ArangoMembers(namespace).Watch(context.TODO(), options)
},
},
&deploymentv1.ArangoMember{},

View file

@ -23,6 +23,7 @@
package v2alpha1
import (
"context"
time "time"
deploymentv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
@ -65,13 +66,13 @@ func NewFilteredArangoDeploymentInformer(client versioned.Interface, namespace s
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DatabaseV2alpha1().ArangoDeployments(namespace).List(options)
return client.DatabaseV2alpha1().ArangoDeployments(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DatabaseV2alpha1().ArangoDeployments(namespace).Watch(options)
return client.DatabaseV2alpha1().ArangoDeployments(namespace).Watch(context.TODO(), options)
},
},
&deploymentv2alpha1.ArangoDeployment{},

View file

@ -23,6 +23,7 @@
package v2alpha1
import (
"context"
time "time"
deploymentv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
@ -65,13 +66,13 @@ func NewFilteredArangoMemberInformer(client versioned.Interface, namespace strin
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DatabaseV2alpha1().ArangoMembers(namespace).List(options)
return client.DatabaseV2alpha1().ArangoMembers(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.DatabaseV2alpha1().ArangoMembers(namespace).Watch(options)
return client.DatabaseV2alpha1().ArangoMembers(namespace).Watch(context.TODO(), options)
},
},
&deploymentv2alpha1.ArangoMember{},

View file

@ -23,6 +23,7 @@
package v1
import (
"context"
time "time"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
@ -65,13 +66,13 @@ func NewFilteredArangoDeploymentReplicationInformer(client versioned.Interface,
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ReplicationV1().ArangoDeploymentReplications(namespace).List(options)
return client.ReplicationV1().ArangoDeploymentReplications(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ReplicationV1().ArangoDeploymentReplications(namespace).Watch(options)
return client.ReplicationV1().ArangoDeploymentReplications(namespace).Watch(context.TODO(), options)
},
},
&replicationv1.ArangoDeploymentReplication{},

View file

@ -23,6 +23,7 @@
package v2alpha1
import (
"context"
time "time"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
@ -65,13 +66,13 @@ func NewFilteredArangoDeploymentReplicationInformer(client versioned.Interface,
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ReplicationV2alpha1().ArangoDeploymentReplications(namespace).List(options)
return client.ReplicationV2alpha1().ArangoDeploymentReplications(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.ReplicationV2alpha1().ArangoDeploymentReplications(namespace).Watch(options)
return client.ReplicationV2alpha1().ArangoDeploymentReplications(namespace).Watch(context.TODO(), options)
},
},
&replicationv2alpha1.ArangoDeploymentReplication{},

View file

@ -23,6 +23,7 @@
package v1alpha
import (
"context"
time "time"
storagev1alpha "github.com/arangodb/kube-arangodb/pkg/apis/storage/v1alpha"
@ -64,13 +65,13 @@ func NewFilteredArangoLocalStorageInformer(client versioned.Interface, resyncPer
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.StorageV1alpha().ArangoLocalStorages().List(options)
return client.StorageV1alpha().ArangoLocalStorages().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.StorageV1alpha().ArangoLocalStorages().Watch(options)
return client.StorageV1alpha().ArangoLocalStorages().Watch(context.TODO(), options)
},
},
&storagev1alpha.ArangoLocalStorage{},

View file

@ -30,8 +30,10 @@ import (
)
// ArangoBackupLister helps list ArangoBackups.
// All objects returned here must be treated as read-only.
type ArangoBackupLister interface {
// List lists all ArangoBackups in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ArangoBackup, err error)
// ArangoBackups returns an object that can list and get ArangoBackups.
ArangoBackups(namespace string) ArangoBackupNamespaceLister
@ -62,10 +64,13 @@ func (s *arangoBackupLister) ArangoBackups(namespace string) ArangoBackupNamespa
}
// ArangoBackupNamespaceLister helps list and get ArangoBackups.
// All objects returned here must be treated as read-only.
type ArangoBackupNamespaceLister interface {
// List lists all ArangoBackups in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ArangoBackup, err error)
// Get retrieves the ArangoBackup from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1.ArangoBackup, error)
ArangoBackupNamespaceListerExpansion
}

View file

@ -30,8 +30,10 @@ import (
)
// ArangoBackupPolicyLister helps list ArangoBackupPolicies.
// All objects returned here must be treated as read-only.
type ArangoBackupPolicyLister interface {
// List lists all ArangoBackupPolicies in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ArangoBackupPolicy, err error)
// ArangoBackupPolicies returns an object that can list and get ArangoBackupPolicies.
ArangoBackupPolicies(namespace string) ArangoBackupPolicyNamespaceLister
@ -62,10 +64,13 @@ func (s *arangoBackupPolicyLister) ArangoBackupPolicies(namespace string) Arango
}
// ArangoBackupPolicyNamespaceLister helps list and get ArangoBackupPolicies.
// All objects returned here must be treated as read-only.
type ArangoBackupPolicyNamespaceLister interface {
// List lists all ArangoBackupPolicies in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ArangoBackupPolicy, err error)
// Get retrieves the ArangoBackupPolicy from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1.ArangoBackupPolicy, error)
ArangoBackupPolicyNamespaceListerExpansion
}

View file

@ -30,8 +30,10 @@ import (
)
// ArangoDeploymentLister helps list ArangoDeployments.
// All objects returned here must be treated as read-only.
type ArangoDeploymentLister interface {
// List lists all ArangoDeployments in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ArangoDeployment, err error)
// ArangoDeployments returns an object that can list and get ArangoDeployments.
ArangoDeployments(namespace string) ArangoDeploymentNamespaceLister
@ -62,10 +64,13 @@ func (s *arangoDeploymentLister) ArangoDeployments(namespace string) ArangoDeplo
}
// ArangoDeploymentNamespaceLister helps list and get ArangoDeployments.
// All objects returned here must be treated as read-only.
type ArangoDeploymentNamespaceLister interface {
// List lists all ArangoDeployments in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ArangoDeployment, err error)
// Get retrieves the ArangoDeployment from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1.ArangoDeployment, error)
ArangoDeploymentNamespaceListerExpansion
}

View file

@ -30,8 +30,10 @@ import (
)
// ArangoMemberLister helps list ArangoMembers.
// All objects returned here must be treated as read-only.
type ArangoMemberLister interface {
// List lists all ArangoMembers in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ArangoMember, err error)
// ArangoMembers returns an object that can list and get ArangoMembers.
ArangoMembers(namespace string) ArangoMemberNamespaceLister
@ -62,10 +64,13 @@ func (s *arangoMemberLister) ArangoMembers(namespace string) ArangoMemberNamespa
}
// ArangoMemberNamespaceLister helps list and get ArangoMembers.
// All objects returned here must be treated as read-only.
type ArangoMemberNamespaceLister interface {
// List lists all ArangoMembers in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1.ArangoMember, err error)
// Get retrieves the ArangoMember from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1.ArangoMember, error)
ArangoMemberNamespaceListerExpansion
}

View file

@ -30,8 +30,10 @@ import (
)
// ArangoDeploymentLister helps list ArangoDeployments.
// All objects returned here must be treated as read-only.
type ArangoDeploymentLister interface {
// List lists all ArangoDeployments in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v2alpha1.ArangoDeployment, err error)
// ArangoDeployments returns an object that can list and get ArangoDeployments.
ArangoDeployments(namespace string) ArangoDeploymentNamespaceLister
@ -62,10 +64,13 @@ func (s *arangoDeploymentLister) ArangoDeployments(namespace string) ArangoDeplo
}
// ArangoDeploymentNamespaceLister helps list and get ArangoDeployments.
// All objects returned here must be treated as read-only.
type ArangoDeploymentNamespaceLister interface {
// List lists all ArangoDeployments in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v2alpha1.ArangoDeployment, err error)
// Get retrieves the ArangoDeployment from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v2alpha1.ArangoDeployment, error)
ArangoDeploymentNamespaceListerExpansion
}

Some files were not shown because too many files have changed in this diff Show more