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

Add SMI CRD into client and controllers #66

Merged
merged 2 commits into from
Jun 19, 2019
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
44 changes: 44 additions & 0 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (

"github.com/containous/i3o/k8s"
traefikv1alpha1 "github.com/containous/traefik/pkg/provider/kubernetes/crd/traefik/v1alpha1"
smiAccessv1alpha1 "github.com/deislabs/smi-sdk-go/pkg/apis/access/v1alpha1"
smiSpecsv1alpha1 "github.com/deislabs/smi-sdk-go/pkg/apis/specs/v1alpha1"
smiSplitv1alpha1 "github.com/deislabs/smi-sdk-go/pkg/apis/split/v1alpha1"
log "github.com/sirupsen/logrus"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -47,6 +50,47 @@ func NewController(clients *k8s.ClientWrapper, controllerType interface{}, ignor
}
ot = &apiv1.Service{}
printableType = "service"
case smiAccessv1alpha1.TrafficTarget:
lw = &cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
// list all of the traffic targets (SMI access object) in all namespaces
return clients.SmiAccessClient.AccessV1alpha1().TrafficTargets(metav1.NamespaceAll).List(options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
// watch all of the traffic targets (SMI access object) in all namespaces
return clients.SmiAccessClient.AccessV1alpha1().TrafficTargets(metav1.NamespaceAll).Watch(options)
},
}
ot = &smiAccessv1alpha1.TrafficTarget{}
printableType = "traffictarget"

case smiSpecsv1alpha1.HTTPRouteGroup:
lw = &cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
// list all of the httproutegroups (SMI specs object) in all namespaces
return clients.SmiSpecsClient.SpecsV1alpha1().HTTPRouteGroups(metav1.NamespaceAll).List(options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
// watch all of the httproutegroups (SMI specs object) in all namespaces
return clients.SmiSpecsClient.SpecsV1alpha1().HTTPRouteGroups(metav1.NamespaceAll).Watch(options)
},
}
ot = &smiSpecsv1alpha1.HTTPRouteGroup{}
printableType = "httproutegroup"

case smiSplitv1alpha1.TrafficSplit:
lw = &cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
// list all of the traffic splits (SMI specs object) in all namespaces
return clients.SmiSplitClient.SplitV1alpha1().TrafficSplits(metav1.NamespaceAll).List(options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
// watch all of the traffic splits (SMI specs object) in all namespaces
return clients.SmiSplitClient.SplitV1alpha1().TrafficSplits(metav1.NamespaceAll).Watch(options)
},
}
ot = &smiSplitv1alpha1.TrafficSplit{}
printableType = "trafficsplit"

case traefikv1alpha1.IngressRoute:
lw = &cache.ListWatch{
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ require (
github.com/containous/flaeg v1.4.1 // indirect
github.com/containous/mux v0.0.0-20181024131434-c33f32e26898 // indirect
github.com/containous/traefik v2.0.0-alpha5+incompatible
github.com/deislabs/smi-sdk-go v0.0.0-20190614052637-0c7d04dba950
github.com/go-acme/lego v2.6.0+incompatible // indirect
github.com/go-check/check v0.0.0-20180628173108-788fd7840127
github.com/google/uuid v1.0.0
github.com/gorilla/context v1.1.1 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.4
github.com/stretchr/testify v1.3.0
github.com/vdemeester/shakers v0.1.0
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
gopkg.in/square/go-jose.v2 v2.3.1 // indirect
k8s.io/api v0.0.0-20190602205700-9b8cae951d65
k8s.io/apimachinery v0.0.0-20190606174813-5a6182816fbf
Expand Down
Loading