Bump sigs.k8s.io/controller-runtime to v0.14.4 (#5507)

* Bump sigs.k8s.io/controller-runtime to v0.14.4

* Update gofmt
This commit is contained in:
hongming
2023-02-08 14:06:15 +08:00
committed by GitHub
parent 129e6fbec3
commit 1c49fcd57e
1404 changed files with 141422 additions and 47769 deletions

View File

@@ -39,7 +39,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -51,9 +50,7 @@ var testEnv *envtest.Environment
func TestApplicationController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"Application Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Application Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {
@@ -90,9 +87,10 @@ var _ = AfterSuite(func() {
// SetupTest will setup a testing environment.
// This includes:
// * creating a Namespace to be used during the test
// * starting application controller
// * stopping application controller after the test ends
// - creating a Namespace to be used during the test
// - starting application controller
// - stopping application controller after the test ends
//
// Call this function at the start of each of your tests.
func SetupTest(ctx context.Context) *corev1.Namespace {
var stopCh chan struct{}

View File

@@ -31,7 +31,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -42,9 +41,7 @@ var testEnv *envtest.Environment
func TestApplicationController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"Application Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Application Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {

View File

@@ -28,8 +28,6 @@ import (
fakek8s "k8s.io/client-go/kubernetes/fake"
"k8s.io/client-go/kubernetes/scheme"
clienttesting "k8s.io/client-go/testing"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
iamv1alpha2 "kubesphere.io/api/iam/v1alpha2"
"kubesphere.io/kubesphere/pkg/apis"
@@ -39,9 +37,7 @@ import (
func TestLoginRecordController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"LoginRecord Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "LoginRecord Controller Test Suite")
}
func newLoginRecord(username string) *iamv1alpha2.LoginRecord {

View File

@@ -34,7 +34,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -46,9 +45,7 @@ var testEnv *envtest.Environment
func TestNamespaceController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"Namespace Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Namespace Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {

View File

@@ -218,7 +218,7 @@ func (c *k8sPolicyController) handleErr(err error, key string) {
klog.Errorf("Dropping NetworkPolicy %q out of the queue: %v", key, err)
}
//NewNsNetworkPolicyProvider sync k8s NetworkPolicy
// NewNsNetworkPolicyProvider sync k8s NetworkPolicy
func NewNsNetworkPolicyProvider(client kubernetes.Interface, npInformer informerv1.NetworkPolicyInformer) (NsNetworkPolicyProvider, error) {
var once sync.Once

View File

@@ -4,14 +4,13 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package utils
import (

View File

@@ -4,14 +4,13 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package webhooks
import (

View File

@@ -4,14 +4,13 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package webhooks
import (

View File

@@ -37,7 +37,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
"kubesphere.io/kubesphere/pkg/apis"
"kubesphere.io/kubesphere/pkg/constants"
@@ -46,7 +45,7 @@ import (
func TestSource(t *testing.T) {
RegisterFailHandler(Fail)
suiteName := "Cache Suite"
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
RunSpecs(t, suiteName)
}
var (

View File

@@ -34,7 +34,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -46,9 +45,7 @@ var testEnv *envtest.Environment
func TestHelmApplicationController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"HelmCategory Application Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "HelmCategory Application Test Suite")
}
var _ = BeforeSuite(func(done Done) {

View File

@@ -35,7 +35,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -47,9 +46,7 @@ var testEnv *envtest.Environment
func TestHelmCategoryController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"HelmCategory Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "HelmCategory Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {

View File

@@ -80,15 +80,18 @@ type ReconcileHelmRelease struct {
StopChan <-chan struct{}
}
// =========================>
// ^ |
// | <==upgraded<==upgrading================
// | \ =========^ /
// | | / |
// =========================>
// ^ |
// | <==upgraded<==upgrading================
// | \ =========^ /
// | | / |
//
// creating=>created===>active=====>deleting=>deleted |
// \ ^ / |
// \ | /======> /
// \=>failed<==========================
//
// \ ^ / |
// \ | /======> /
// \=>failed<==========================
//
// Reconcile reads that state of the cluster for a helmreleases object and makes changes based on the state read
// and what is in the helmreleases.Spec
// +kubebuilder:rbac:groups=application.kubesphere.io,resources=helmreleases,verbs=get;list;watch;create;update;patch;delete

View File

@@ -34,7 +34,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -46,9 +45,7 @@ var testEnv *envtest.Environment
func TestHelmRepoController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"HelmRepo Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "HelmRepo Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {

View File

@@ -103,7 +103,7 @@ func (a *accessor) UpdateQuotaStatus(newQuota *corev1.ResourceQuota) error {
})
klog.V(6).Infof("update resource quota: %+v", updatedQuota)
err = a.client.Status().Update(ctx, updatedQuota, &client.UpdateOptions{})
err = a.client.Status().Update(ctx, updatedQuota)
if err != nil {
klog.Errorf("failed to update resource quota: %v", err)
return err

View File

@@ -292,7 +292,7 @@ func (r *Reconciler) syncQuotaForNamespaces(originalQuota *quotav1alpha2.Resourc
}
klog.V(6).Infof("update resource quota: %+v", quota)
if err := r.Status().Update(ctx, quota, &client.UpdateOptions{}); err != nil {
if err := r.Status().Update(ctx, quota); err != nil {
return err
}

View File

@@ -4,14 +4,13 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package utils
import (

View File

@@ -4,14 +4,13 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package servicemesh
import (

View File

@@ -4,14 +4,13 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package servicemesh
import "testing"

View File

@@ -211,9 +211,11 @@ func (v *VirtualServiceController) processNextWorkItem() bool {
// created virtualservice's name are same as the service name, same
// as the destinationrule name
// labels:
// servicemesh.kubernetes.io/enabled: ""
// app.kubernetes.io/name: bookinfo
// app: reviews
//
// servicemesh.kubernetes.io/enabled: ""
// app.kubernetes.io/name: bookinfo
// app: reviews
//
// are used to bind them together.
// syncService are the main part of reconcile function body, it takes
// service, destinationrule, strategy as input to create a virtualservice

View File

@@ -4,14 +4,13 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package workspace
import (

View File

@@ -34,7 +34,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -46,9 +45,7 @@ var testEnv *envtest.Environment
func TestWorkspaceController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"Workspace Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "Workspace Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {

View File

@@ -34,7 +34,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -46,9 +45,7 @@ var testEnv *envtest.Environment
func TestWorkspaceRoleController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"WorkspaceRole Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "WorkspaceRole Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {

View File

@@ -34,7 +34,6 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
// These tests use Ginkgo (BDD-style Go testing framework). Refer to
@@ -46,9 +45,7 @@ var testEnv *envtest.Environment
func TestWorkspaceRoleBindingController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"WorkspaceRoleBinding Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "WorkspaceRoleBinding Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {

View File

@@ -30,14 +30,11 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
)
func TestWorkspaceTemplateController(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t,
"WorkspaceTemplate Controller Test Suite",
[]Reporter{printer.NewlineReporter{}})
RunSpecs(t, "WorkspaceTemplate Controller Test Suite")
}
var _ = BeforeSuite(func(done Done) {