Skip to content

Commit eeca469

Browse files
wip
1 parent 2889845 commit eeca469

File tree

4 files changed

+7
-23
lines changed

4 files changed

+7
-23
lines changed

pkg/cmd/server/bootstrappolicy/controller_policy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ func init() {
297297
},
298298
})
299299

300-
// ingress-secretref-controller
300+
// ingress-to-route-controller
301301
addControllerRole(rbac.ClusterRole{
302302
ObjectMeta: metav1.ObjectMeta{Name: saRolePrefix + InfraIngressToRouteControllerServiceAccountName},
303303
Rules: []rbac.PolicyRule{

pkg/route/controller/ingress/ingress.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ import (
4646
// 2. For every TLS hostname that has a corresponding path rule and points to a secret
4747
// that exists, a route should exist with a valid TLS config from that secret.
4848
// 3. For every service referenced by the ingress path rule, the route should have
49-
// an update to date target port based on the service.
50-
// 4. A route owned by an ingress that no longer satisfies the first three invariants
51-
// should be deleted.
49+
// a target port based on the service.
50+
// 4. A route owned by an ingress that is not described by any of the three invariants
51+
// above should be deleted.
5252
//
5353
// Unsupported attributes:
5454
//

pkg/router/controller/extended_validator.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package controller
22

33
import (
44
"fmt"
5-
"reflect"
65

76
"github.com/golang/glog"
87
"k8s.io/apimachinery/pkg/util/sets"
@@ -22,19 +21,15 @@ type ExtendedValidator struct {
2221

2322
// recorder is an interface for indicating route rejections.
2423
recorder RejectionRecorder
25-
26-
// invalidRoutes is a map of invalid routes previously encountered.
27-
invalidRoutes map[string]routeapi.Route
2824
}
2925

3026
// NewExtendedValidator creates a plugin wrapper that ensures only routes that
3127
// pass extended validation are relayed to the next plugin in the chain.
3228
// Recorder is an interface for indicating why a route was rejected.
3329
func NewExtendedValidator(plugin router.Plugin, recorder RejectionRecorder) *ExtendedValidator {
3430
return &ExtendedValidator{
35-
plugin: plugin,
36-
recorder: recorder,
37-
invalidRoutes: make(map[string]routeapi.Route),
31+
plugin: plugin,
32+
recorder: recorder,
3833
}
3934
}
4035

@@ -52,17 +47,6 @@ func (p *ExtendedValidator) HandleEndpoints(eventType watch.EventType, endpoints
5247
func (p *ExtendedValidator) HandleRoute(eventType watch.EventType, route *routeapi.Route) error {
5348
// Check if previously seen route and its Spec is unchanged.
5449
routeName := routeNameKey(route)
55-
old, ok := p.invalidRoutes[routeName]
56-
if ok && reflect.DeepEqual(old.Spec, route.Spec) {
57-
// Route spec was unchanged and it is already marked in
58-
// error, we don't need to do anything more.
59-
p.plugin.HandleRoute(watch.Deleted, route)
60-
if eventType == watch.Deleted {
61-
delete(p.invalidRoutes, routeName)
62-
}
63-
return fmt.Errorf("invalid route configuration")
64-
}
65-
6650
if errs := validation.ExtendedValidateRoute(route); len(errs) > 0 {
6751
errmsg := ""
6852
for i := 0; i < len(errs); i++ {

test/extended/testdata/ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kind: List
22
apiVersion: v1
33
items:
4-
# an ingress that should be captured as three routes
4+
# an ingress that should be captured as individual routes
55
- apiVersion: extensions/v1beta1
66
kind: Ingress
77
metadata:

0 commit comments

Comments
 (0)