
This PR reworks auth controller to use informer framework. It also fix the problem of tenant and user not created. Change-Id: I017032f2eb4d83440319729d9f1fb13351f4d72b Closes-Bug: 1702841 Signed-off-by: Pengfei Ni <feiskyer@gmail.com>
30 lines
742 B
Go
30 lines
742 B
Go
package auth
|
|
|
|
import (
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
"k8s.io/apimachinery/pkg/runtime/serializer"
|
|
"k8s.io/client-go/rest"
|
|
|
|
crv1 "git.openstack.org/openstack/stackube/pkg/apis/v1"
|
|
)
|
|
|
|
func NewClient(cfg *rest.Config) (*rest.RESTClient, *runtime.Scheme, error) {
|
|
scheme := runtime.NewScheme()
|
|
if err := crv1.AddToScheme(scheme); err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
config := *cfg
|
|
config.GroupVersion = &crv1.SchemeGroupVersion
|
|
config.APIPath = "/apis"
|
|
config.ContentType = runtime.ContentTypeJSON
|
|
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: serializer.NewCodecFactory(scheme)}
|
|
|
|
client, err := rest.RESTClientFor(&config)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
return client, scheme, nil
|
|
}
|