@@ -54,8 +54,8 @@ func hookResponsesConfigMapName(clusterName string) string {
54
54
return fmt .Sprintf ("%s-%s" , clusterName , hookResponsesConfigMapNameSuffix )
55
55
}
56
56
57
- // clusterUpgradeWithRuntimeSDKSpecInput is the input for clusterUpgradeWithRuntimeSDKSpec.
58
- type clusterUpgradeWithRuntimeSDKSpecInput struct {
57
+ // ClusterUpgradeWithRuntimeSDKSpecInput is the input for clusterUpgradeWithRuntimeSDKSpec.
58
+ type ClusterUpgradeWithRuntimeSDKSpecInput struct {
59
59
E2EConfig * clusterctl.E2EConfig
60
60
ClusterctlConfigPath string
61
61
BootstrapClusterProxy framework.ClusterProxy
@@ -89,21 +89,27 @@ type clusterUpgradeWithRuntimeSDKSpecInput struct {
89
89
// Allows to inject a function to be run after the cluster is upgraded.
90
90
// If not specified, this is a no-op.
91
91
PostUpgrade func (managementClusterProxy framework.ClusterProxy , workloadClusterNamespace , workloadClusterName string )
92
+
93
+ // ExtensionServiceNamespace is the namespace where the service for the Runtime SDK is located
94
+ // and is used 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.
97
+ ExtensionServiceName string
92
98
}
93
99
94
- // clusterUpgradeWithRuntimeSDKSpec implements a spec that upgrades a cluster and runs the Kubernetes conformance suite.
100
+ // ClusterUpgradeWithRuntimeSDKSpec implements a spec that upgrades a cluster and runs the Kubernetes conformance suite.
95
101
// Upgrading a cluster refers to upgrading the control-plane and worker nodes (managed by MD and machine pools).
96
102
// NOTE: This test only works with a KubeadmControlPlane.
97
103
// NOTE: This test works with Clusters with and without ClusterClass.
98
104
// When using ClusterClass the ClusterClass must have the variables "etcdImageTag" and "coreDNSImageTag" of type string.
99
105
// Those variables should have corresponding patches which set the etcd and CoreDNS tags in KCP.
100
- func clusterUpgradeWithRuntimeSDKSpec (ctx context.Context , inputGetter func () clusterUpgradeWithRuntimeSDKSpecInput ) {
106
+ func ClusterUpgradeWithRuntimeSDKSpec (ctx context.Context , inputGetter func () ClusterUpgradeWithRuntimeSDKSpecInput ) {
101
107
const (
102
108
specName = "k8s-upgrade-with-runtimesdk"
103
109
)
104
110
105
111
var (
106
- input clusterUpgradeWithRuntimeSDKSpecInput
112
+ input ClusterUpgradeWithRuntimeSDKSpecInput
107
113
namespace * corev1.Namespace
108
114
cancelWatches context.CancelFunc
109
115
@@ -125,6 +131,9 @@ func clusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() cl
125
131
Expect (input .E2EConfig .Variables ).To (HaveKey (KubernetesVersionUpgradeFrom ))
126
132
Expect (input .E2EConfig .Variables ).To (HaveKey (KubernetesVersionUpgradeTo ))
127
133
134
+ Expect (input .ExtensionServiceNamespace ).ToNot (BeEmpty ())
135
+ Expect (input .ExtensionServiceName ).ToNot (BeEmpty ())
136
+
128
137
if input .ControlPlaneMachineCount == nil {
129
138
controlPlaneMachineCount = 1
130
139
} else {
@@ -153,7 +162,7 @@ func clusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() cl
153
162
By ("Deploy Test Extension ExtensionConfig" )
154
163
155
164
Expect (input .BootstrapClusterProxy .GetClient ().Create (ctx ,
156
- extensionConfig (specName , namespace .Name ))).
165
+ extensionConfig (specName , namespace .Name , input . ExtensionServiceNamespace , input . ExtensionServiceName ))).
157
166
To (Succeed (), "Failed to create the extension config" )
158
167
159
168
By ("Creating a workload cluster; creation waits for BeforeClusterCreateHook to gate the operation" )
@@ -291,7 +300,7 @@ func clusterUpgradeWithRuntimeSDKSpec(ctx context.Context, inputGetter func() cl
291
300
AfterEach (func () {
292
301
// Delete the extensionConfig first to ensure the BeforeDeleteCluster hook doesn't block deletion.
293
302
Eventually (func () error {
294
- return input .BootstrapClusterProxy .GetClient ().Delete (ctx , extensionConfig (specName , namespace .Name ))
303
+ return input .BootstrapClusterProxy .GetClient ().Delete (ctx , extensionConfig (specName , namespace .Name , input . ExtensionServiceNamespace , input . ExtensionServiceName ))
295
304
}, 10 * time .Second , 1 * time .Second ).Should (Succeed (), "delete extensionConfig failed" )
296
305
297
306
// Dumps all the resources in the spec Namespace, then cleanups the cluster object and the spec Namespace itself.
@@ -401,23 +410,23 @@ func machineSetPreflightChecksTestHandler(ctx context.Context, c client.Client,
401
410
// We make sure this cluster-wide object does not conflict with others by using a random generated
402
411
// name and a NamespaceSelector selecting on the namespace of the current test.
403
412
// Thus, this object is "namespaced" to the current test even though it's a cluster-wide object.
404
- func extensionConfig (name , namespace string ) * runtimev1.ExtensionConfig {
413
+ func extensionConfig (name , namespace , extensionServiceNamespace , extensionServiceName string ) * runtimev1.ExtensionConfig {
405
414
return & runtimev1.ExtensionConfig {
406
415
ObjectMeta : metav1.ObjectMeta {
407
416
// Note: We have to use a constant name here as we have to be able to reference it in the ClusterClass
408
417
// when configuring external patches.
409
418
Name : name ,
410
419
Annotations : map [string ]string {
411
420
// Note: this assumes the test extension get deployed in the default namespace defined in its own runtime-extensions-components.yaml
412
- runtimev1 .InjectCAFromSecretAnnotation : "test-extension-system/test-extension-webhook-service- cert" ,
421
+ runtimev1 .InjectCAFromSecretAnnotation : fmt . Sprintf ( "%s/%s- cert", extensionServiceNamespace , extensionServiceName ) ,
413
422
},
414
423
},
415
424
Spec : runtimev1.ExtensionConfigSpec {
416
425
ClientConfig : runtimev1.ClientConfig {
417
426
Service : & runtimev1.ServiceReference {
418
- Name : "test-extension-webhook-service" ,
427
+ Name : extensionServiceName ,
419
428
// Note: this assumes the test extension get deployed in the default namespace defined in its own runtime-extensions-components.yaml
420
- Namespace : "test-extension-system" ,
429
+ Namespace : extensionServiceNamespace ,
421
430
},
422
431
},
423
432
NamespaceSelector : & metav1.LabelSelector {
0 commit comments