Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal/dag: Remove processing of service-apis GatewayClass/TCPRoute #3279

Merged
merged 1 commit into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions internal/dag/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ type KubernetesCache struct {
secrets map[types.NamespacedName]*v1.Secret
httpproxydelegations map[types.NamespacedName]*contour_api_v1.TLSCertificateDelegation
services map[types.NamespacedName]*v1.Service
gatewayclasses map[types.NamespacedName]*serviceapis.GatewayClass
gateways map[types.NamespacedName]*serviceapis.Gateway
httproutes map[types.NamespacedName]*serviceapis.HTTPRoute
tcproutes map[types.NamespacedName]*serviceapis.TCPRoute
extensions map[types.NamespacedName]*contour_api_v1alpha1.ExtensionService

initialize sync.Once
Expand All @@ -69,10 +67,8 @@ func (kc *KubernetesCache) init() {
kc.secrets = make(map[types.NamespacedName]*v1.Secret)
kc.httpproxydelegations = make(map[types.NamespacedName]*contour_api_v1.TLSCertificateDelegation)
kc.services = make(map[types.NamespacedName]*v1.Service)
kc.gatewayclasses = make(map[types.NamespacedName]*serviceapis.GatewayClass)
kc.gateways = make(map[types.NamespacedName]*serviceapis.Gateway)
kc.httproutes = make(map[types.NamespacedName]*serviceapis.HTTPRoute)
kc.tcproutes = make(map[types.NamespacedName]*serviceapis.TCPRoute)
kc.extensions = make(map[types.NamespacedName]*contour_api_v1alpha1.ExtensionService)
}

Expand Down Expand Up @@ -159,13 +155,6 @@ func (kc *KubernetesCache) Insert(obj interface{}) bool {
case *contour_api_v1.TLSCertificateDelegation:
kc.httpproxydelegations[k8s.NamespacedNameOf(obj)] = obj
return true
case *serviceapis.GatewayClass:
m := k8s.NamespacedNameOf(obj)
// TODO(youngnick): Remove this once service-apis actually have behavior
// other than being added to the cache.
kc.WithField("experimental", "service-apis").WithField("name", m.Name).WithField("namespace", m.Namespace).Debug("Adding GatewayClass")
kc.gatewayclasses[k8s.NamespacedNameOf(obj)] = obj
return true
case *serviceapis.Gateway:
m := k8s.NamespacedNameOf(obj)
// TODO(youngnick): Remove this once service-apis actually have behavior
Expand All @@ -180,13 +169,6 @@ func (kc *KubernetesCache) Insert(obj interface{}) bool {
kc.WithField("experimental", "service-apis").WithField("name", m.Name).WithField("namespace", m.Namespace).Debug("Adding HTTPRoute")
kc.httproutes[k8s.NamespacedNameOf(obj)] = obj
return true
case *serviceapis.TCPRoute:
m := k8s.NamespacedNameOf(obj)
// TODO(youngnick): Remove this once service-apis actually have behavior
// other than being added to the cache.
kc.WithField("experimental", "service-apis").WithField("name", m.Name).WithField("namespace", m.Namespace).Debug("Adding TcpRoute")
kc.tcproutes[k8s.NamespacedNameOf(obj)] = obj
return true
case *contour_api_v1alpha1.ExtensionService:
kc.extensions[k8s.NamespacedNameOf(obj)] = obj
return true
Expand Down Expand Up @@ -240,14 +222,6 @@ func (kc *KubernetesCache) remove(obj interface{}) bool {
_, ok := kc.httpproxydelegations[m]
delete(kc.httpproxydelegations, m)
return ok
case *serviceapis.GatewayClass:
m := k8s.NamespacedNameOf(obj)
_, ok := kc.gatewayclasses[m]
// TODO(youngnick): Remove this once service-apis actually have behavior
// other than being removed from the cache.
kc.WithField("experimental", "service-apis").WithField("name", m.Name).WithField("namespace", m.Namespace).Debug("Removing GatewayClass")
delete(kc.gatewayclasses, m)
return ok
case *serviceapis.Gateway:
m := k8s.NamespacedNameOf(obj)
_, ok := kc.gateways[m]
Expand All @@ -264,14 +238,6 @@ func (kc *KubernetesCache) remove(obj interface{}) bool {
kc.WithField("experimental", "service-apis").WithField("name", m.Name).WithField("namespace", m.Namespace).Debug("Removing HTTPRoute")
delete(kc.httproutes, m)
return ok
case *serviceapis.TCPRoute:
m := k8s.NamespacedNameOf(obj)
_, ok := kc.tcproutes[m]
// TODO(youngnick): Remove this once service-apis actually have behavior
// other than being removed from the cache.
kc.WithField("experimental", "service-apis").WithField("name", m.Name).WithField("namespace", m.Namespace).Debug("Removing TcpRoute")
delete(kc.tcproutes, m)
return ok
case *contour_api_v1alpha1.ExtensionService:
m := k8s.NamespacedNameOf(obj)
_, ok := kc.extensions[m]
Expand Down
48 changes: 0 additions & 48 deletions internal/dag/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,15 +646,6 @@ func TestKubernetesCacheInsert(t *testing.T) {
},
want: true,
},
"insert service-apis Gatewayclass": {
obj: &serviceapis.GatewayClass{
ObjectMeta: metav1.ObjectMeta{
Name: "gatewayclass",
Namespace: "default",
},
},
want: true,
},
"insert service-apis Gateway": {
obj: &serviceapis.Gateway{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -673,15 +664,6 @@ func TestKubernetesCacheInsert(t *testing.T) {
},
want: true,
},
"insert service-apis TcPRoute": {
obj: &serviceapis.TCPRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "tcproute",
Namespace: "default",
},
},
want: true,
},
"insert extension service": {
obj: &contour_api_v1alpha1.ExtensionService{
ObjectMeta: fixture.ObjectMeta("default/extension"),
Expand Down Expand Up @@ -841,21 +823,6 @@ func TestKubernetesCacheRemove(t *testing.T) {
},
want: false,
},
"remove service-apis Gatewayclass": {
cache: cache(&serviceapis.GatewayClass{
ObjectMeta: metav1.ObjectMeta{
Name: "gatewayclass",
Namespace: "default",
},
}),
obj: &serviceapis.GatewayClass{
ObjectMeta: metav1.ObjectMeta{
Name: "gatewayclass",
Namespace: "default",
},
},
want: true,
},
"remove service-apis Gateway": {
cache: cache(&serviceapis.Gateway{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -886,21 +853,6 @@ func TestKubernetesCacheRemove(t *testing.T) {
},
want: true,
},
"remove service-apis TcpRoute": {
cache: cache(&serviceapis.TCPRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "tcproute",
Namespace: "default",
},
}),
obj: &serviceapis.TCPRoute{
ObjectMeta: metav1.ObjectMeta{
Name: "tcproute",
Namespace: "default",
},
},
want: true,
},
"remove extension service": {
cache: cache(&contour_api_v1alpha1.ExtensionService{
ObjectMeta: fixture.ObjectMeta("default/extension"),
Expand Down
8 changes: 0 additions & 8 deletions internal/k8s/informers.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,13 @@ func DefaultResources() []schema.GroupVersionResource {
// ServiceAPIResources ...
func ServiceAPIResources() []schema.GroupVersionResource {
return []schema.GroupVersionResource{{
Group: serviceapis.GroupVersion.Group,
Version: serviceapis.GroupVersion.Version,
Resource: "gatewayclasses",
}, {
Group: serviceapis.GroupVersion.Group,
Version: serviceapis.GroupVersion.Version,
Resource: "gateways",
}, {
Group: serviceapis.GroupVersion.Group,
Version: serviceapis.GroupVersion.Version,
Resource: "httproutes",
}, {
Group: serviceapis.GroupVersion.Group,
Version: serviceapis.GroupVersion.Version,
Resource: "tcproutes",
},
}
}
Expand Down