|
33 | 33 | _ = Describe("", Label(ClusterIPLabel), testClusterIPServiceImport)
|
34 | 34 | _ = Describe("", Label(HeadlessLabel), testHeadlessServiceImport)
|
35 | 35 | _ = Describe("", Label(ExternalNameLabel), testExternalNameService)
|
| 36 | + _ = Describe("", testServiceTypeConflict) |
36 | 37 | )
|
37 | 38 |
|
38 | 39 | func testGeneralServiceImport() {
|
@@ -326,3 +327,30 @@ func testExternalNameService() {
|
326 | 327 | "the ServiceImport should not exist for an ExternalName service")
|
327 | 328 | })
|
328 | 329 | }
|
| 330 | + |
| 331 | +func testServiceTypeConflict() { |
| 332 | + t := newTwoClusterTestDriver(newTestDriver()) |
| 333 | + |
| 334 | + BeforeEach(func() { |
| 335 | + t.helloService2.Spec.ClusterIP = corev1.ClusterIPNone |
| 336 | + }) |
| 337 | + |
| 338 | + JustBeforeEach(func() { |
| 339 | + t.createServiceExport(&clients[0], newHelloServiceExport()) |
| 340 | + }) |
| 341 | + |
| 342 | + Specify("A service exported on two clusters with conflicting headlessness should apply the conflict resolution policy and "+ |
| 343 | + "report a Conflict condition on the ServiceExport", Label(RequiredLabel), func() { |
| 344 | + AddReportEntry(SpecRefReportEntry, "https://github.com/kubernetes/enhancements/tree/master/keps/sig-multicluster/1645-multi-cluster-services-api#headlessness") |
| 345 | + |
| 346 | + t.awaitServiceExportCondition(&clients[0], v1alpha1.ServiceExportConflict, metav1.ConditionTrue) |
| 347 | + t.awaitServiceExportCondition(&clients[1], v1alpha1.ServiceExportConflict, metav1.ConditionTrue) |
| 348 | + |
| 349 | + for i := range clients { |
| 350 | + serviceImport := t.awaitServiceImport(&clients[i], helloServiceName, true, nil) |
| 351 | + |
| 352 | + Expect(serviceImport.Spec.Type).To(Equal(v1alpha1.ClusterSetIP), reportNonConformant( |
| 353 | + fmt.Sprintf("ServiceImport on cluster %q has type %q", clients[i].name, serviceImport.Spec.Type))) |
| 354 | + } |
| 355 | + }) |
| 356 | +} |
0 commit comments