Skip to content

Commit 47b97da

Browse files
committed
update to 2.6.0, fix deprecation notices
On-behalf-of: @SAP [email protected]
1 parent c9249b6 commit 47b97da

File tree

11 files changed

+145
-26
lines changed

11 files changed

+145
-26
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ YAML_PATCH_BIN := yaml-patch
5050
YAML_PATCH := $(TOOLS_DIR)/$(YAML_PATCH_BIN)-$(YAML_PATCH_VER)
5151
export YAML_PATCH # so hack scripts can use it
5252

53-
GOLANGCI_LINT_VER := v2.5.0
53+
GOLANGCI_LINT_VER := v2.6.0
5454
GOLANGCI_LINT_BIN := golangci-lint
5555
GOLANGCI_LINT := $(TOOLS_GOBIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
5656
GOLANGCI_LINT_FLAGS ?=

pkg/network/dialer_linux.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build linux
2-
// +build linux
32

43
/*
54
Copyright 2024 The KCP Authors.

pkg/network/dialer_other.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build !linux
2-
// +build !linux
32

43
/*
54
Copyright 2024 The KCP Authors.

staging/src/github.com/kcp-dev/sdk/apis/apis/v1alpha1/types_apiexportendpointslice.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const (
116116
PartitionValid conditionsv1alpha1.ConditionType = "PartitionValid"
117117

118118
// EndpointURLsReady is a condition for APIExportEndpointSlice that reflects the readiness of the URLs.
119+
//
119120
// Deprecated: This condition is deprecated and will be removed in a future release.
120121
APIExportEndpointSliceURLsReady conditionsv1alpha1.ConditionType = "EndpointURLsReady"
121122

staging/src/github.com/kcp-dev/sdk/apis/cache/v1alpha1/types_cachedresourceendpointslice.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const (
110110
PartitionValid conditionsv1alpha1.ConditionType = "PartitionValid"
111111

112112
// EndpointURLsReady is a condition for CachedResourceEndpointSlice that reflects the readiness of the URLs.
113+
//
113114
// Deprecated: This condition is deprecated and will be removed in a future release.
114115
CachedResourceEndpointSliceURLsReady conditionsv1alpha1.ConditionType = "EndpointURLsReady"
115116

staging/src/github.com/kcp-dev/sdk/testing/server/fixture.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const kcpBinariesDirEnvDir = "KCP_BINARIES_DIR"
5858

5959
// RunInProcessFunc instantiates the kcp server in process for easier debugging.
6060
// It is here to decouple the rest of the code from kcp core dependencies.
61+
//
6162
// Deprecated: Use ContextRunInProcessFunc instead.
6263
var RunInProcessFunc func(t TestingT, dataDir string, args []string) (<-chan struct{}, error)
6364

test/e2e/conformance/cross_logical_cluster_list_test.go

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package conformance
1919
import (
2020
"context"
2121
"fmt"
22+
"strings"
2223
"testing"
2324
"time"
2425

@@ -27,6 +28,7 @@ import (
2728
corev1 "k8s.io/api/core/v1"
2829
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
2930
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31+
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3032
"k8s.io/apimachinery/pkg/labels"
3133
"k8s.io/apimachinery/pkg/runtime"
3234
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -45,6 +47,7 @@ import (
4547
tenancyv1alpha1 "github.com/kcp-dev/sdk/apis/tenancy/v1alpha1"
4648
kcpclientset "github.com/kcp-dev/sdk/client/clientset/versioned/cluster"
4749
kcptesting "github.com/kcp-dev/sdk/testing"
50+
kcptestinghelpers "github.com/kcp-dev/sdk/testing/helpers"
4851

4952
configcrds "github.com/kcp-dev/kcp/config/crds"
5053
"github.com/kcp-dev/kcp/pkg/informer"
@@ -196,20 +199,20 @@ func TestCRDCrossLogicalClusterListPartialObjectMetadata(t *testing.T) {
196199
t.Logf("Install a different sheriffs CRD into workspace %q", wsNormalCRD2)
197200
bootstrapCRD(t, wsNormalCRD2, crdClusterClient.ApiextensionsV1().CustomResourceDefinitions(), sheriffCRD2)
198201

199-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsNormalCRD1a, group, wsNormalCRD1a.String())
200-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsNormalCRD1b, group, wsNormalCRD1b.String())
202+
createSheriff(ctx, t, dynamicClusterClient, wsNormalCRD1a, group)
203+
createSheriff(ctx, t, dynamicClusterClient, wsNormalCRD1b, group)
201204

202205
apifixtures.CreateSheriffsSchemaAndExport(ctx, t, wsExport1a, kcpClusterClient, group, "export1")
203206
apifixtures.BindToExport(ctx, t, wsExport1a, group, wsConsume1a, kcpClusterClient)
204-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsConsume1a, group, wsConsume1a.String())
207+
createSheriff(ctx, t, dynamicClusterClient, wsConsume1a, group)
205208

206209
apifixtures.CreateSheriffsSchemaAndExport(ctx, t, wsExport1b, kcpClusterClient, group, "export1")
207210
apifixtures.BindToExport(ctx, t, wsExport1b, group, wsConsume1b, kcpClusterClient)
208-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsConsume1b, group, wsConsume1b.String())
211+
createSheriff(ctx, t, dynamicClusterClient, wsConsume1b, group)
209212

210213
apifixtures.CreateSheriffsSchemaAndExport(ctx, t, wsExport2, kcpClusterClient, group, "export2")
211214
apifixtures.BindToExport(ctx, t, wsExport2, group, wsConsume2, kcpClusterClient)
212-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, wsConsume2, group, wsConsume2.String())
215+
createSheriff(ctx, t, dynamicClusterClient, wsConsume2, group)
213216

214217
t.Logf("Trying to wildcard list with PartialObjectMetadata content-type and it should work")
215218
rootShardMetadataClusterClient, err := metadataclient.NewDynamicMetadataClusterClientForConfig(rootShardConfig)
@@ -321,3 +324,32 @@ func TestBuiltInCrossLogicalClusterListPartialObjectMetadata(t *testing.T) {
321324

322325
require.Subset(t, sets.List[string](names), expected)
323326
}
327+
328+
func createSheriff(
329+
ctx context.Context,
330+
t *testing.T,
331+
dynamicClusterClient kcpdynamic.ClusterInterface,
332+
clusterName logicalcluster.Path,
333+
group string,
334+
) {
335+
t.Helper()
336+
337+
name := strings.ReplaceAll(clusterName.String(), ":", "-")
338+
339+
t.Logf("Creating %s/v1 sheriffs %s|default/%s", group, clusterName, name)
340+
341+
sheriffsGVR := schema.GroupVersionResource{Group: group, Resource: "sheriffs", Version: "v1"}
342+
343+
sheriff := &unstructured.Unstructured{}
344+
sheriff.SetAPIVersion(group + "/v1")
345+
sheriff.SetKind("Sheriff")
346+
sheriff.SetName(name)
347+
348+
// CRDs are asynchronously served because they are informer based.
349+
kcptestinghelpers.Eventually(t, func() (bool, string) {
350+
if _, err := dynamicClusterClient.Cluster(clusterName).Resource(sheriffsGVR).Namespace("default").Create(ctx, sheriff, metav1.CreateOptions{}); err != nil {
351+
return false, fmt.Sprintf("failed to create Sheriff %s|%s: %v", clusterName, name, err.Error())
352+
}
353+
return true, ""
354+
}, wait.ForeverTestTimeout, time.Millisecond*100, "error creating Sheriff %s|%s", clusterName, name)
355+
}

test/e2e/fixtures/apifixtures/sheriffs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ func CreateSheriffsSchemaAndExport(
185185

186186
// CreateSheriff creates an instance of a Sheriff CustomResource in the logical cluster identified by clusterName, in
187187
// the specific API group, and with the specified name.
188+
//
188189
// Deprecated: use local fixtures instead.
189190
func CreateSheriff(
190191
ctx context.Context,

test/e2e/quota/quota_test.go

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package quota
1919
import (
2020
"context"
2121
"fmt"
22+
"strings"
2223
"testing"
2324
"time"
2425

@@ -314,15 +315,15 @@ func TestKubeQuotaNormalCRDs(t *testing.T) {
314315
}, wait.ForeverTestTimeout, 100*time.Millisecond, "error waiting for ws %d quota to show usage in status", wsIndex)
315316

316317
t.Logf("Create 2 sheriffs to reach the quota limit")
317-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, ws, group, fmt.Sprintf("ws%d-1", wsIndex))
318-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, ws, group, fmt.Sprintf("ws%d-2", wsIndex))
318+
createSheriff(ctx, t, dynamicClusterClient, ws, group, fmt.Sprintf("ws%d-1", wsIndex))
319+
createSheriff(ctx, t, dynamicClusterClient, ws, group, fmt.Sprintf("ws%d-2", wsIndex))
319320

320321
t.Logf("Make sure quota is enforcing limits")
321322
i := 0
322323
sheriffsGVR := schema.GroupVersionResource{Group: group, Resource: "sheriffs", Version: "v1"}
323324
kcptestinghelpers.Eventually(t, func() (bool, string) {
324325
t.Logf("Trying to create a sheriff")
325-
sheriff := NewSheriff(group, fmt.Sprintf("ws%d-%d", wsIndex, i))
326+
sheriff := newSheriff(group, fmt.Sprintf("ws%d-%d", wsIndex, i))
326327
i++
327328
_, err := dynamicClusterClient.Cluster(ws).Resource(sheriffsGVR).Namespace("default").Create(ctx, sheriff, metav1.CreateOptions{})
328329
return apierrors.IsForbidden(err), fmt.Sprintf("expected a forbidden error, got: %v", err)
@@ -461,15 +462,38 @@ func bootstrapCRD(
461462
require.NoError(t, err, "error bootstrapping CRD %s in cluster %s", crd.Name, clusterName)
462463
}
463464

464-
// NewSheriff returns a new *unstructured.Unstructured for a Sheriff with the given group and name.
465-
func NewSheriff(group, name string) *unstructured.Unstructured {
466-
return &unstructured.Unstructured{
467-
Object: map[string]interface{}{
468-
"apiVersion": group + "/v1",
469-
"kind": "Sheriff",
470-
"metadata": map[string]interface{}{
471-
"name": name,
472-
},
473-
},
474-
}
465+
// newSheriff returns a new *unstructured.Unstructured for a Sheriff with the given group and name.
466+
func newSheriff(group, name string) *unstructured.Unstructured {
467+
sheriff := &unstructured.Unstructured{}
468+
sheriff.SetAPIVersion(group + "/v1")
469+
sheriff.SetKind("Sheriff")
470+
sheriff.SetName(name)
471+
472+
return sheriff
473+
}
474+
475+
func createSheriff(
476+
ctx context.Context,
477+
t *testing.T,
478+
dynamicClusterClient kcpdynamic.ClusterInterface,
479+
clusterName logicalcluster.Path,
480+
group, name string,
481+
) {
482+
t.Helper()
483+
484+
name = strings.ReplaceAll(name, ":", "-")
485+
486+
t.Logf("Creating %s/v1 sheriffs %s|default/%s", group, clusterName, name)
487+
488+
sheriffsGVR := schema.GroupVersionResource{Group: group, Resource: "sheriffs", Version: "v1"}
489+
490+
sheriff := newSheriff(group, name)
491+
492+
// CRDs are asynchronously served because they are informer based.
493+
kcptestinghelpers.Eventually(t, func() (bool, string) {
494+
if _, err := dynamicClusterClient.Cluster(clusterName).Resource(sheriffsGVR).Namespace("default").Create(ctx, sheriff, metav1.CreateOptions{}); err != nil {
495+
return false, fmt.Sprintf("failed to create Sheriff %s|%s: %v", clusterName, name, err.Error())
496+
}
497+
return true, ""
498+
}, wait.ForeverTestTimeout, time.Millisecond*100, "error creating Sheriff %s|%s", clusterName, name)
475499
}

test/e2e/virtual/apiexport/virtualworkspace_test.go

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
apierrors "k8s.io/apimachinery/pkg/api/errors"
3838
"k8s.io/apimachinery/pkg/api/meta"
3939
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
40+
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
4041
"k8s.io/apimachinery/pkg/runtime/schema"
4142
"k8s.io/apimachinery/pkg/types"
4243
"k8s.io/apimachinery/pkg/util/sets"
@@ -603,11 +604,11 @@ func TestAPIExportPermissionClaims(t *testing.T) {
603604

604605
t.Logf("Bind sheriffs into %s and create initial sheriff", consumer1Path)
605606
apifixtures.BindToExport(ctx, t, sheriffProviderPath, "wild.wild.west", consumer1Path, kcpClusterClient)
606-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, consumer1Path, "wild.wild.west", "in-vw-before")
607+
createSheriff(ctx, t, dynamicClusterClient, consumer1Path, "wild.wild.west", "in-vw-before")
607608

608609
t.Logf("Bind sheriffs into %s and create initial sheriff", consumer2Path)
609610
apifixtures.BindToExport(ctx, t, sheriffProviderPath, "wild.wild.west", consumer2Path, kcpClusterClient)
610-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, consumer2Path, "wild.wild.west", "not-in-vw")
611+
createSheriff(ctx, t, dynamicClusterClient, consumer2Path, "wild.wild.west", "not-in-vw")
611612

612613
t.Logf("Create cowboys API Export in %v with permission claims to core resources and sheriffs provided by %v", claimerPath, sheriffProviderPath)
613614
setUpServiceProviderWithPermissionClaims(ctx, t, dynamicClusterClient, kcpClusterClient, claimerPath, cfg, identityHash)
@@ -718,7 +719,7 @@ func TestAPIExportPermissionClaims(t *testing.T) {
718719
}, wait.ForeverTestTimeout, 100*time.Millisecond, "expected to see more than 1 binding")
719720

720721
t.Logf("Creating a sheriff in %s", consumer1Path)
721-
apifixtures.CreateSheriff(ctx, t, dynamicClusterClient, consumer1Path, "wild.wild.west", "in-vw")
722+
createSheriff(ctx, t, dynamicClusterClient, consumer1Path, "wild.wild.west", "in-vw")
722723

723724
t.Logf("Verify that two sherrifs are eventually returned")
724725
kcptestinghelpers.Eventually(t, func() (done bool, str string) {
@@ -1188,3 +1189,32 @@ func toJSON(t *testing.T, obj interface{}) string {
11881189
require.NoError(t, err)
11891190
return string(ret)
11901191
}
1192+
1193+
func createSheriff(
1194+
ctx context.Context,
1195+
t *testing.T,
1196+
dynamicClusterClient kcpdynamic.ClusterInterface,
1197+
clusterName logicalcluster.Path,
1198+
group, name string,
1199+
) {
1200+
t.Helper()
1201+
1202+
name = strings.ReplaceAll(name, ":", "-")
1203+
1204+
t.Logf("Creating %s/v1 sheriffs %s|default/%s", group, clusterName, name)
1205+
1206+
sheriffsGVR := schema.GroupVersionResource{Group: group, Resource: "sheriffs", Version: "v1"}
1207+
1208+
sheriff := &unstructured.Unstructured{}
1209+
sheriff.SetAPIVersion(group + "/v1")
1210+
sheriff.SetKind("Sheriff")
1211+
sheriff.SetName(name)
1212+
1213+
// CRDs are asynchronously served because they are informer based.
1214+
kcptestinghelpers.Eventually(t, func() (bool, string) {
1215+
if _, err := dynamicClusterClient.Cluster(clusterName).Resource(sheriffsGVR).Namespace("default").Create(ctx, sheriff, metav1.CreateOptions{}); err != nil {
1216+
return false, fmt.Sprintf("failed to create Sheriff %s|%s: %v", clusterName, name, err.Error())
1217+
}
1218+
return true, ""
1219+
}, wait.ForeverTestTimeout, time.Millisecond*100, "error creating Sheriff %s|%s", clusterName, name)
1220+
}

0 commit comments

Comments
 (0)