@@ -1443,205 +1443,6 @@ func TestCompareServices(t *testing.T) {
14431443 match : false ,
14441444 reason : `new service's LoadBalancerSourceRange does not match the current one` ,
14451445 },
1446- {
1447- about : "services differ on DNS annotation" ,
1448- current : newService (
1449- map [string ]string {
1450- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1451- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1452- },
1453- v1 .ServiceTypeLoadBalancer ,
1454- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1455- new : newService (
1456- map [string ]string {
1457- constants .ZalandoDNSNameAnnotation : "new_clstr.acid.zalan.do" ,
1458- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1459- },
1460- v1 .ServiceTypeLoadBalancer ,
1461- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1462- match : false ,
1463- reason : `new service's annotations does not match the current one: "external-dns.alpha.kubernetes.io/hostname" changed from "clstr.acid.zalan.do" to "new_clstr.acid.zalan.do".` ,
1464- },
1465- {
1466- about : "services differ on AWS ELB annotation" ,
1467- current : newService (
1468- map [string ]string {
1469- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1470- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1471- },
1472- v1 .ServiceTypeLoadBalancer ,
1473- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1474- new : newService (
1475- map [string ]string {
1476- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1477- constants .ElbTimeoutAnnotationName : "1800" ,
1478- },
1479- v1 .ServiceTypeLoadBalancer ,
1480- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1481- match : false ,
1482- reason : `new service's annotations does not match the current one: "service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout" changed from "3600" to "1800".` ,
1483- },
1484- {
1485- about : "service changes existing annotation" ,
1486- current : newService (
1487- map [string ]string {
1488- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1489- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1490- "foo" : "bar" ,
1491- },
1492- v1 .ServiceTypeLoadBalancer ,
1493- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1494- new : newService (
1495- map [string ]string {
1496- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1497- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1498- "foo" : "baz" ,
1499- },
1500- v1 .ServiceTypeLoadBalancer ,
1501- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1502- match : false ,
1503- reason : `new service's annotations does not match the current one: "foo" changed from "bar" to "baz".` ,
1504- },
1505- {
1506- about : "service changes multiple existing annotations" ,
1507- current : newService (
1508- map [string ]string {
1509- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1510- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1511- "foo" : "bar" ,
1512- "bar" : "foo" ,
1513- },
1514- v1 .ServiceTypeLoadBalancer ,
1515- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1516- new : newService (
1517- map [string ]string {
1518- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1519- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1520- "foo" : "baz" ,
1521- "bar" : "fooz" ,
1522- },
1523- v1 .ServiceTypeLoadBalancer ,
1524- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1525- match : false ,
1526- // Test just the prefix to avoid flakiness and map sorting
1527- reason : `new service's annotations does not match the current one:` ,
1528- },
1529- {
1530- about : "service adds a new custom annotation" ,
1531- current : newService (
1532- map [string ]string {
1533- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1534- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1535- },
1536- v1 .ServiceTypeLoadBalancer ,
1537- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1538- new : newService (
1539- map [string ]string {
1540- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1541- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1542- "foo" : "bar" ,
1543- },
1544- v1 .ServiceTypeLoadBalancer ,
1545- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1546- match : false ,
1547- reason : `new service's annotations does not match the current one: Added "foo" with value "bar".` ,
1548- },
1549- {
1550- about : "service removes a custom annotation" ,
1551- current : newService (
1552- map [string ]string {
1553- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1554- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1555- "foo" : "bar" ,
1556- },
1557- v1 .ServiceTypeLoadBalancer ,
1558- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1559- new : newService (
1560- map [string ]string {
1561- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1562- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1563- },
1564- v1 .ServiceTypeLoadBalancer ,
1565- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1566- match : false ,
1567- reason : `new service's annotations does not match the current one: Removed "foo".` ,
1568- },
1569- {
1570- about : "service removes a custom annotation and adds a new one" ,
1571- current : newService (
1572- map [string ]string {
1573- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1574- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1575- "foo" : "bar" ,
1576- },
1577- v1 .ServiceTypeLoadBalancer ,
1578- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1579- new : newService (
1580- map [string ]string {
1581- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1582- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1583- "bar" : "foo" ,
1584- },
1585- v1 .ServiceTypeLoadBalancer ,
1586- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1587- match : false ,
1588- reason : `new service's annotations does not match the current one: Removed "foo". Added "bar" with value "foo".` ,
1589- },
1590- {
1591- about : "service removes a custom annotation, adds a new one and change another" ,
1592- current : newService (
1593- map [string ]string {
1594- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1595- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1596- "foo" : "bar" ,
1597- "zalan" : "do" ,
1598- },
1599- v1 .ServiceTypeLoadBalancer ,
1600- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1601- new : newService (
1602- map [string ]string {
1603- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1604- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1605- "bar" : "foo" ,
1606- "zalan" : "do.com" ,
1607- },
1608- v1 .ServiceTypeLoadBalancer ,
1609- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1610- match : false ,
1611- // Test just the prefix to avoid flakiness and map sorting
1612- reason : `new service's annotations does not match the current one: Removed "foo".` ,
1613- },
1614- {
1615- about : "service add annotations" ,
1616- current : newService (
1617- map [string ]string {},
1618- v1 .ServiceTypeLoadBalancer ,
1619- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1620- new : newService (
1621- map [string ]string {
1622- constants .ZalandoDNSNameAnnotation : "clstr.acid.zalan.do" ,
1623- constants .ElbTimeoutAnnotationName : constants .ElbTimeoutAnnotationValue ,
1624- },
1625- v1 .ServiceTypeLoadBalancer ,
1626- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1627- match : false ,
1628- // Test just the prefix to avoid flakiness and map sorting
1629- reason : `new service's annotations does not match the current one: Added ` ,
1630- },
1631- {
1632- about : "ignored annotations" ,
1633- current : newService (
1634- map [string ]string {},
1635- v1 .ServiceTypeLoadBalancer ,
1636- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1637- new : newService (
1638- map [string ]string {
1639- "k8s.v1.cni.cncf.io/network-status" : "up" ,
1640- },
1641- v1 .ServiceTypeLoadBalancer ,
1642- []string {"128.141.0.0/16" , "137.138.0.0/16" }),
1643- match : true ,
1644- },
16451446 }
16461447
16471448 for _ , tt := range tests {
0 commit comments