Skip to content

Commit

Permalink
Update client-go to v1.19.7
Browse files Browse the repository at this point in the history
Signed-off-by: Mikkel Oscar Lyderik Larsen <[email protected]>
  • Loading branch information
mikkeloscar committed Jan 19, 2021
1 parent f4de741 commit c339054
Show file tree
Hide file tree
Showing 43 changed files with 7,461 additions and 404 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ IMAGE ?= registry-write.opensource.zalan.do/poirot/$(BINARY)
E2E_IMAGE ?= $(IMAGE)-e2e
TAG ?= $(VERSION)
SOURCES = $(shell find . -name '*.go')
GENERATED = pkg/client pkg/apis/zalando.org/v1/zz_generated.deepcopy.go
CRD_TYPE_SOURCE = pkg/apis/zalando.org/v1/types.go
GENERATED_CRDS = docs/zalando.org_elasticsearchdatasets.yaml docs/zalando.org_elasticsearchmetricsets.yaml
GENERATED = pkg/apis/zalando.org/v1/zz_generated.deepcopy.go
DOCKERFILE ?= Dockerfile
GOPKGS = $(shell go list ./... | grep -v /e2e)
BUILD_FLAGS ?= -v
Expand All @@ -25,10 +27,13 @@ test: $(GENERATED)
lint:
golangci-lint run ./...

$(GENERATED):
$(GENERATED): go.mod $(CRD_TYPE_SOURCE)
./hack/update-codegen.sh

build.local: build/$(BINARY)
$(GENERATED_CRDS): $(GENERATED) $(CRD_SOURCES)
go run sigs.k8s.io/controller-tools/cmd/controller-gen crd:crdVersions=v1 paths=./pkg/apis/... output:crd:dir=docs || /bin/true || true

build.local: build/$(BINARY) $(GENERATED_CRDS)
build.linux: build/linux/$(BINARY)

build/linux/e2e: $(GENERATED) $(SOURCES)
Expand Down
18 changes: 10 additions & 8 deletions cmd/e2e/test_utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"context"
"fmt"
"reflect"
"testing"
Expand Down Expand Up @@ -175,6 +176,7 @@ func resourceCreated(t *testing.T, kind string, name string, k8sInterface interf
get := reflect.ValueOf(k8sInterface).MethodByName("Get")
return newAwaiter(t, fmt.Sprintf("creation of %s %s", kind, name)).withPoll(func() (bool, error) {
result := get.Call([]reflect.Value{
reflect.ValueOf(context.Background()),
reflect.ValueOf(name),
reflect.ValueOf(metav1.GetOptions{}),
})
Expand All @@ -192,23 +194,23 @@ func waitForEDS(t *testing.T, name string) (*zv1.ElasticsearchDataSet, error) {
if err != nil {
return nil, err
}
return edsInterface().Get(name, metav1.GetOptions{})
return edsInterface().Get(context.Background(), name, metav1.GetOptions{})
}

func waitForStatefulSet(t *testing.T, name string) (*appsv1.StatefulSet, error) {
err := resourceCreated(t, "sts", name, statefulSetInterface()).await()
if err != nil {
return nil, err
}
return statefulSetInterface().Get(name, metav1.GetOptions{})
return statefulSetInterface().Get(context.Background(), name, metav1.GetOptions{})
}

func waitForService(t *testing.T, name string) (*v1.Service, error) {
err := resourceCreated(t, "service", name, serviceInterface()).await()
if err != nil {
return nil, err
}
return serviceInterface().Get(name, metav1.GetOptions{})
return serviceInterface().Get(context.Background(), name, metav1.GetOptions{})
}

type expectedStsStatus struct {
Expand Down Expand Up @@ -236,7 +238,7 @@ func (expected expectedStsStatus) matches(sts *appsv1.StatefulSet) error {

func waitForEDSCondition(t *testing.T, name string, conditions ...func(eds *zv1.ElasticsearchDataSet) error) error {
return newAwaiter(t, fmt.Sprintf("eds %s to reach desired condition", name)).withPoll(func() (retry bool, err error) {
eds, err := edsInterface().Get(name, metav1.GetOptions{})
eds, err := edsInterface().Get(context.Background(), name, metav1.GetOptions{})
if err != nil {
return false, err
}
Expand All @@ -252,7 +254,7 @@ func waitForEDSCondition(t *testing.T, name string, conditions ...func(eds *zv1.

func waitForSTSCondition(t *testing.T, stsName string, conditions ...func(sts *appsv1.StatefulSet) error) error {
return newAwaiter(t, fmt.Sprintf("sts %s to reach desired condition", stsName)).withPoll(func() (retry bool, err error) {
sts, err := statefulSetInterface().Get(stsName, metav1.GetOptions{})
sts, err := statefulSetInterface().Get(context.Background(), stsName, metav1.GetOptions{})
if err != nil {
return false, err
}
Expand Down Expand Up @@ -282,17 +284,17 @@ func createEDS(name string, spec zv1.ElasticsearchDataSetSpec) error {
},
Spec: *myspec,
}
_, err := edsInterface().Create(eds)
_, err := edsInterface().Create(context.Background(), eds, metav1.CreateOptions{})
return err
}

func updateEDS(name string, eds *zv1.ElasticsearchDataSet) error {
_, err := edsInterface().Update(eds)
_, err := edsInterface().Update(context.Background(), eds, metav1.UpdateOptions{})
return err
}

func deleteEDS(name string) error {
err := edsInterface().Delete(name, &metav1.DeleteOptions{GracePeriodSeconds: pint64(10)})
err := edsInterface().Delete(context.Background(), name, metav1.DeleteOptions{GracePeriodSeconds: pint64(10)})
return err
}

Expand Down
3 changes: 2 additions & 1 deletion docs/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ kubectl apply -f docs/cluster-roles.yaml
The ES Operator manages two custom resources. These need to be registered in your cluster.

```
kubectl apply -f docs/custom-resource-definitions.yaml
kubectl apply -f docs/docs/zalando.org_elasticsearchdatasets.yaml
kubectl apply -f docs/docs/zalando.org_elasticsearchmetricsets.yaml
```


Expand Down
113 changes: 0 additions & 113 deletions docs/custom-resource-definitions.yaml

This file was deleted.

Loading

0 comments on commit c339054

Please sign in to comment.