@@ -1299,11 +1299,11 @@ func (c *Configuration) buildHostsAndResources() (newHosts map[string]Resource,
1299
1299
var resource * IngressConfiguration
1300
1300
1301
1301
if val := c .isChallengeIngress (ing ); val {
1302
- // if using cert-manager with Ingress, the challenge Ingress must be Minion
1303
- // and this code won't be reached. With VS, the challenge Ingress must not be Minion.
1304
1302
vsr := c .convertIngressToVSR (ing )
1305
- challengesVSR = append (challengesVSR , vsr )
1306
- continue
1303
+ if vsr != nil {
1304
+ challengesVSR = append (challengesVSR , vsr )
1305
+ continue
1306
+ }
1307
1307
}
1308
1308
1309
1309
if isMaster (ing ) {
@@ -1407,6 +1407,10 @@ func (c *Configuration) isChallengeIngress(ing *networking.Ingress) bool {
1407
1407
func (c * Configuration ) convertIngressToVSR (ing * networking.Ingress ) * conf_v1.VirtualServerRoute {
1408
1408
rule := ing .Spec .Rules [0 ]
1409
1409
1410
+ if ! c .isChallengeIngressOwnerVs (rule .Host ) {
1411
+ return nil
1412
+ }
1413
+
1410
1414
vs := & conf_v1.VirtualServerRoute {
1411
1415
ObjectMeta : metav1.ObjectMeta {
1412
1416
Namespace : ing .Namespace ,
@@ -1435,6 +1439,16 @@ func (c *Configuration) convertIngressToVSR(ing *networking.Ingress) *conf_v1.Vi
1435
1439
return vs
1436
1440
}
1437
1441
1442
+ func (c * Configuration ) isChallengeIngressOwnerVs (host string ) bool {
1443
+ for _ , key := range getSortedVirtualServerKeys (c .virtualServers ) {
1444
+ vs := c .virtualServers [key ]
1445
+ if host == vs .Spec .Host {
1446
+ return true
1447
+ }
1448
+ }
1449
+ return false
1450
+ }
1451
+
1438
1452
func (c * Configuration ) buildMinionConfigs (masterHost string ) ([]* MinionConfiguration , map [string ][]string ) {
1439
1453
var minionConfigs []* MinionConfiguration
1440
1454
childWarnings := make (map [string ][]string )
0 commit comments