Skip to content

Commit 186a0a1

Browse files
committed
Review fixes
1 parent 8894421 commit 186a0a1

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

test/e2e/cluster_upgrade_runtimesdk.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ type ClusterUpgradeWithRuntimeSDKSpecInput struct {
9090
// If not specified, this is a no-op.
9191
PostUpgrade func(managementClusterProxy framework.ClusterProxy, workloadClusterNamespace, workloadClusterName string)
9292

93-
// ExtensionNamespace is the namespace where the service for the Runtime SDK is located
93+
// ExtensionServiceNamespace is the namespace where the service for the Runtime SDK is located
9494
// and is used to configure in the test-namespace scoped ExtensionConfig.
95-
ExtensionNamespace string
96-
// ExtensionServiceName is the service to configure in the test-namespace scoped ExtensionConfig.
95+
ExtensionServiceNamespace string
96+
// ExtensionServiceName is the name of the service to configure in the test-namespace scoped ExtensionConfig.
9797
ExtensionServiceName string
9898
}
9999

@@ -131,7 +131,7 @@ func ClusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() Cl
131131
Expect(input.E2EConfig.Variables).To(HaveKey(KubernetesVersionUpgradeFrom))
132132
Expect(input.E2EConfig.Variables).To(HaveKey(KubernetesVersionUpgradeTo))
133133

134-
Expect(input.ExtensionNamespace).ToNot(BeEmpty())
134+
Expect(input.ExtensionServiceNamespace).ToNot(BeEmpty())
135135
Expect(input.ExtensionServiceName).ToNot(BeEmpty())
136136

137137
if input.ControlPlaneMachineCount == nil {
@@ -162,7 +162,7 @@ func ClusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() Cl
162162
By("Deploy Test Extension ExtensionConfig")
163163

164164
Expect(input.BootstrapClusterProxy.GetClient().Create(ctx,
165-
extensionConfig(specName, namespace.Name, input.ExtensionNamespace, input.ExtensionServiceName))).
165+
extensionConfig(specName, namespace.Name, input.ExtensionServiceNamespace, input.ExtensionServiceName))).
166166
To(Succeed(), "Failed to create the extension config")
167167

168168
By("Creating a workload cluster; creation waits for BeforeClusterCreateHook to gate the operation")
@@ -300,7 +300,7 @@ func ClusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() Cl
300300
AfterEach(func() {
301301
// Delete the extensionConfig first to ensure the BeforeDeleteCluster hook doesn't block deletion.
302302
Eventually(func() error {
303-
return input.BootstrapClusterProxy.GetClient().Delete(ctx, extensionConfig(specName, namespace.Name, input.ExtensionNamespace, input.ExtensionServiceName))
303+
return input.BootstrapClusterProxy.GetClient().Delete(ctx, extensionConfig(specName, namespace.Name, input.ExtensionServiceNamespace, input.ExtensionServiceName))
304304
}, 10*time.Second, 1*time.Second).Should(Succeed(), "delete extensionConfig failed")
305305

306306
// Dumps all the resources in the spec Namespace, then cleanups the cluster object and the spec Namespace itself.
@@ -410,23 +410,23 @@ func machineSetPreflightChecksTestHandler(ctx context.Context, c client.Client,
410410
// We make sure this cluster-wide object does not conflict with others by using a random generated
411411
// name and a NamespaceSelector selecting on the namespace of the current test.
412412
// Thus, this object is "namespaced" to the current test even though it's a cluster-wide object.
413-
func extensionConfig(name, namespace, extensionNamespace, extensionServiceName string) *runtimev1.ExtensionConfig {
413+
func extensionConfig(name, namespace, extensionServiceNamespace, extensionServiceName string) *runtimev1.ExtensionConfig {
414414
return &runtimev1.ExtensionConfig{
415415
ObjectMeta: metav1.ObjectMeta{
416416
// Note: We have to use a constant name here as we have to be able to reference it in the ClusterClass
417417
// when configuring external patches.
418418
Name: name,
419419
Annotations: map[string]string{
420420
// Note: this assumes the test extension get deployed in the default namespace defined in its own runtime-extensions-components.yaml
421-
runtimev1.InjectCAFromSecretAnnotation: fmt.Sprintf("%s/%s-cert", extensionNamespace, extensionServiceName),
421+
runtimev1.InjectCAFromSecretAnnotation: fmt.Sprintf("%s/%s-cert", extensionServiceNamespace, extensionServiceName),
422422
},
423423
},
424424
Spec: runtimev1.ExtensionConfigSpec{
425425
ClientConfig: runtimev1.ClientConfig{
426426
Service: &runtimev1.ServiceReference{
427427
Name: extensionServiceName,
428428
// Note: this assumes the test extension get deployed in the default namespace defined in its own runtime-extensions-components.yaml
429-
Namespace: extensionNamespace,
429+
Namespace: extensionServiceNamespace,
430430
},
431431
},
432432
NamespaceSelector: &metav1.LabelSelector{

test/e2e/cluster_upgrade_runtimesdk_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ var _ = Describe("When upgrading a workload cluster using ClusterClass with Runt
5050
framework.ValidateResourceVersionStable(ctx, proxy, namespace, clusterctlcluster.FilterClusterObjectsWithNameFilter(clusterName))
5151
},
5252
// "upgrades" is the same as the "topology" flavor but with an additional MachinePool.
53-
Flavor: ptr.To("upgrades-runtimesdk"),
54-
ExtensionNamespace: "test-extension-system",
55-
ExtensionServiceName: "test-extension-webhook-service",
53+
Flavor: ptr.To("upgrades-runtimesdk"),
54+
// The runtime extension gets deployed to the test-extension-system namespace and is exposed
55+
// by the test-extension-webhook-service.
56+
// The below values are used when creating the cluster-wide ExtensionConfig to refer
57+
// the actual service.
58+
ExtensionServiceNamespace: "test-extension-system",
59+
ExtensionServiceName: "test-extension-webhook-service",
5660
}
5761
})
5862
})

0 commit comments

Comments
 (0)