Skip to content

Commit

Permalink
Merge pull request #207 from yersan/issue-206
Browse files Browse the repository at this point in the history
[Issue-206] Upgrade Operator SDK from 0.17.2 to 0.18.2
  • Loading branch information
jmesnil committed Jul 15, 2021
2 parents 49a8388 + 87c0840 commit dc17a6b
Show file tree
Hide file tree
Showing 1,043 changed files with 135,714 additions and 115,680 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Minikube
uses: manusa/[email protected]
with:
minikube version: v1.16.0
minikube version: v1.22.0
kubernetes version: v1.20.0
driver: docker
- name: Containerized End-to-End Tests
Expand Down
2 changes: 1 addition & 1 deletion build/setup-operator-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -o nounset

if ! [ -e "./operator-sdk" ]; then
echo 'Install operator-sdk' >&2
RELEASE_VERSION=v0.17.2
RELEASE_VERSION=v0.18.2
case "$(uname)" in
Darwin*) file=operator-sdk-${RELEASE_VERSION}-x86_64-apple-darwin;;
*) file=operator-sdk-${RELEASE_VERSION}-x86_64-linux-gnu;;
Expand Down
1,003 changes: 504 additions & 499 deletions deploy/crds/wildfly.org_wildflyservers_crd.yaml

Large diffs are not rendered by default.

28 changes: 17 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,29 @@ module github.com/wildfly/wildfly-operator
go 1.13

require (
github.com/RHsyseng/operator-utils v1.4.4
github.com/coreos/prometheus-operator v0.38.0
github.com/RHsyseng/operator-utils v1.4.5
github.com/coreos/prometheus-operator v0.41.0
github.com/go-logr/logr v0.1.0
github.com/go-openapi/spec v0.19.6
github.com/openshift/api v0.0.0-20200205145930-e9d93e317dd1
github.com/operator-framework/operator-sdk v0.17.2
github.com/go-openapi/spec v0.19.9
github.com/openshift/api v0.0.0-20200521101457-60c476765272
github.com/operator-framework/operator-sdk v0.18.2
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.4.0
github.com/stretchr/testify v1.6.1
github.com/tevino/abool v1.2.0
k8s.io/api v0.17.4
k8s.io/apimachinery v0.17.4
k8s.io/api v0.18.14
k8s.io/apimachinery v0.18.14
k8s.io/client-go v12.0.0+incompatible
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a
sigs.k8s.io/controller-runtime v0.5.2
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
sigs.k8s.io/controller-runtime v0.6.2
)

replace (
github.com/Azure/go-autorest => github.com/Azure/go-autorest v13.3.2+incompatible // Required by OLM
k8s.io/client-go => k8s.io/client-go v0.17.4 // Required by prometheus-operator
// OpenShift release-4.5
github.com/openshift/api => github.com/openshift/api v0.0.0-20200526144822-34f54f12813a
github.com/openshift/client-go => github.com/openshift/client-go v0.0.0-20200521150516-05eb9880269c
// Pinned to kubernetes-1.18.2
k8s.io/api => k8s.io/api v0.18.14
k8s.io/apimachinery => k8s.io/apimachinery v0.18.14
k8s.io/client-go => k8s.io/client-go v0.18.14 // Required by prometheus-operator
)
821 changes: 542 additions & 279 deletions go.sum

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions pkg/apis/wildfly/v1alpha1/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pkg/controller/util/remote_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package util
import (
"bufio"
"bytes"
"context"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -198,7 +199,7 @@ func readPodLog(pod *corev1.Pod, logOptions *corev1.PodLogOptions) (io.ReadClose
}

req := coreclient.Pods(pod.Namespace).GetLogs(pod.Name, logOptions)
return req.Stream() // execution of the request
return req.Stream(context.TODO()) // execution of the request
}

func getKubeRestConfig() (*restclient.Config, error) {
Expand Down
9 changes: 4 additions & 5 deletions test/framework/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ func WildflyScaleDownTest(t *testing.T, applicationTag string) {
t.Fatalf("Failed while waiting for all resources being initialized based on the WildflyServer definition: %v", err)
}
// verification that the size of the instances matches what is expected by the test
context := goctx.TODO()
err = f.Client.Get(context, types.NamespacedName{Name: name, Namespace: namespace}, wildflyServer)
err = f.Client.Get(goctx.TODO(), types.NamespacedName{Name: name, Namespace: namespace}, wildflyServer)
if err != nil {
t.Fatalf("Failed to obtain the WildflyServer resource: %v", err)
}
Expand All @@ -166,12 +165,12 @@ func WildflyScaleDownTest(t *testing.T, applicationTag string) {
t.Logf("Application %s is deployed with %d instances\n", name, wildflyServer.Spec.Replicas)

// scaling down by one
err = f.Client.Get(context, types.NamespacedName{Name: name, Namespace: namespace}, wildflyServer)
err = f.Client.Get(goctx.TODO(), types.NamespacedName{Name: name, Namespace: namespace}, wildflyServer)
if err != nil {
t.Fatalf("Failed to obtain the WildflyServer resource for scaling it down: %v", err)
}
wildflyServer.Spec.Replicas = 1
err = f.Client.Update(context, wildflyServer)
err = f.Client.Update(goctx.TODO(), wildflyServer)
if err != nil {
t.Fatalf("Failed to update size of %s resource by decreasing the spec size: %v", name, err)
}
Expand All @@ -183,7 +182,7 @@ func WildflyScaleDownTest(t *testing.T, applicationTag string) {
}

// verification that deletion works correctly as finalizers should be run at this call
if DeleteWildflyServer(context, wildflyServer, f, t); err != nil {
if DeleteWildflyServer(wildflyServer, f, t); err != nil {
t.Fatalf("Failed to wait until the WildflyServer resource is deleted: %v", err)
}
}
Expand Down
25 changes: 12 additions & 13 deletions test/framework/wildlfyserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package framework
import (
"bytes"
"context"
goctx "context"
"fmt"
"io"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -44,7 +43,7 @@ func MakeBasicWildFlyServer(ns, name, applicationImage string, size int32, boota
Spec: wildflyv1alpha1.WildFlyServerSpec{
ApplicationImage: applicationImage,
Replicas: size,
BootableJar: bootableJar,
BootableJar: bootableJar,
},
}
}
Expand Down Expand Up @@ -92,13 +91,13 @@ func CreateStandaloneConfigMap(f *framework.Framework, ctx *framework.Context, n
key: file,
},
}
return f.Client.Create(goctx.TODO(), configMap, &framework.CleanupOptions{TestContext: ctx, Timeout: cleanupTimeout, RetryInterval: cleanupRetryInterval})
return f.Client.Create(context.TODO(), configMap, &framework.CleanupOptions{TestContext: ctx, Timeout: cleanupTimeout, RetryInterval: cleanupRetryInterval})
}

// CreateAndWaitUntilReady creates a WildFlyServer resource and wait until it is ready
func CreateAndWaitUntilReady(f *framework.Framework, ctx *framework.Context, t *testing.T, server *wildflyv1alpha1.WildFlyServer) error {
// use Context's create helper to create the object and add a cleanup function for the new object
err := f.Client.Create(goctx.TODO(), server, &framework.CleanupOptions{TestContext: ctx, Timeout: cleanupTimeout, RetryInterval: cleanupRetryInterval})
err := f.Client.Create(context.TODO(), server, &framework.CleanupOptions{TestContext: ctx, Timeout: cleanupTimeout, RetryInterval: cleanupRetryInterval})
if err != nil {
return err
}
Expand All @@ -109,10 +108,10 @@ func CreateAndWaitUntilReady(f *framework.Framework, ctx *framework.Context, t *
// Removing deployment for not putting finalizers back to the WildflyServer
name := server.ObjectMeta.Name
namespace := server.ObjectMeta.Namespace
deployment, err := f.KubeClient.AppsV1().Deployments(namespace).Get("wildfly-operator", metav1.GetOptions{})
deployment, err := f.KubeClient.AppsV1().Deployments(namespace).Get(context.TODO(), "wildfly-operator", metav1.GetOptions{})
if err == nil && deployment != nil {
t.Logf("Cleaning deployment '%v'\n", deployment.Name)
f.Client.Delete(goctx.TODO(), deployment)
f.Client.Delete(context.TODO(), deployment)
}
// Cleaning finalizer
wait.Poll(retryInterval, timeout, func() (done bool, err error) {
Expand All @@ -135,10 +134,10 @@ func CreateAndWaitUntilReady(f *framework.Framework, ctx *framework.Context, t *
return true, nil
})

namespaceResource, err := f.KubeClient.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{})
namespaceResource, err := f.KubeClient.CoreV1().Namespaces().Get(context.TODO(), namespace, metav1.GetOptions{})
if err == nil && namespaceResource != nil {
t.Logf("Cleaning namespace '%v'\n", namespace)
f.Client.Delete(goctx.TODO(), namespaceResource)
f.Client.Delete(context.TODO(), namespaceResource)
}

return err
Expand All @@ -158,7 +157,7 @@ func WaitUntilReady(f *framework.Framework, t *testing.T, server *wildflyv1alpha

err := wait.Poll(retryInterval, timeout, func() (done bool, err error) {

statefulSet, err := f.KubeClient.AppsV1().StatefulSets(ns).Get(name, metav1.GetOptions{})
statefulSet, err := f.KubeClient.AppsV1().StatefulSets(ns).Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
t.Logf("Statefulset %s not found", name)
Expand Down Expand Up @@ -247,7 +246,7 @@ func WaitUntilClusterIsFormed(f *framework.Framework, t *testing.T, server *wild
// GetLogs returns the logs from the given pod (in the server's namespace).
func GetLogs(f *framework.Framework, server *wildflyv1alpha1.WildFlyServer, podName string) (string, error) {
logsReq := f.KubeClient.CoreV1().Pods(server.ObjectMeta.Namespace).GetLogs(podName, &corev1.PodLogOptions{})
podLogs, err := logsReq.Stream()
podLogs, err := logsReq.Stream(context.TODO())
if err != nil {
return "", err
}
Expand Down Expand Up @@ -278,16 +277,16 @@ func GetWildflyServer(name string, namespace string, f *framework.Framework) (*w
}

// DeleteWildflyServer deletes the instance of WildflyServer and waits for the underlaying StatefulSet is removed altogether
func DeleteWildflyServer(context goctx.Context, wildflyServer *wildflyv1alpha1.WildFlyServer, f *framework.Framework, t *testing.T) error {
err := f.Client.Delete(context, wildflyServer)
func DeleteWildflyServer(wildflyServer *wildflyv1alpha1.WildFlyServer, f *framework.Framework, t *testing.T) error {
err := f.Client.Delete(context.TODO(), wildflyServer)
if err != nil {
t.Fatalf("Failed to delete of WildflyServer resource: %v", err)
}
name := wildflyServer.ObjectMeta.Name
namespace := wildflyServer.ObjectMeta.Namespace
t.Logf("WildflyServer resource of application %s was deleted\n", name)
err = wait.Poll(retryInterval, timeout, func() (bool, error) {
_, err := f.KubeClient.AppsV1().StatefulSets(namespace).Get(name, metav1.GetOptions{})
_, err := f.KubeClient.AppsV1().StatefulSets(namespace).Get(context.TODO(), name, metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
t.Logf("Statefulset %s was not found. It was probably successfully deleted already.", name)
Expand Down
12 changes: 0 additions & 12 deletions vendor/cloud.google.com/go/compute/metadata/.repo-metadata.json

This file was deleted.

52 changes: 22 additions & 30 deletions vendor/cloud.google.com/go/compute/metadata/metadata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/Azure/go-autorest/autorest/adal/go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dc17a6b

Please sign in to comment.