mirror of https://github.com/k3s-io/k3s
Merge pull request #60204 from soltysh/remove_factory_client_methods
Automatic merge from submit-queue (batch tested with PRs 60214, 58762, 59898, 59897, 60204). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Remove ClientSetForVersion & ClientConfigForVersion from factory **What this PR does / why we need it**: This is further cleaning the factory. **Special notes for your reviewer**: /assign @deads2k **Release note**: ```release-note NONE ```pull/6/head
commit
bd5b46a4f2
|
@ -322,13 +322,6 @@ func (f *FakeFactory) ClientForMapping(mapping *meta.RESTMapping) (resource.REST
|
|||
return f.tf.Client, f.tf.Err
|
||||
}
|
||||
|
||||
func (f *FakeFactory) ClientSetForVersion(requiredVersion *schema.GroupVersion) (internalclientset.Interface, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (f *FakeFactory) ClientConfigForVersion(requiredVersion *schema.GroupVersion) (*restclient.Config, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (f *FakeFactory) UnstructuredClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error) {
|
||||
if f.tf.UnstructuredClientForMappingFunc != nil {
|
||||
return f.tf.UnstructuredClientForMappingFunc(mapping)
|
||||
|
@ -606,10 +599,6 @@ func (f *fakeAPIFactory) CategoryExpander() categories.CategoryExpander {
|
|||
return f.Factory.CategoryExpander()
|
||||
}
|
||||
|
||||
func (f *fakeAPIFactory) ClientSetForVersion(requiredVersion *schema.GroupVersion) (internalclientset.Interface, error) {
|
||||
return f.ClientSet()
|
||||
}
|
||||
|
||||
func (f *fakeAPIFactory) ClientConfig() (*restclient.Config, error) {
|
||||
return f.tf.ClientConfig, f.tf.Err
|
||||
}
|
||||
|
|
|
@ -106,11 +106,6 @@ type ClientAccessFactory interface {
|
|||
// just directions to the server. People use this to build RESTMappers on top of
|
||||
BareClientConfig() (*restclient.Config, error)
|
||||
|
||||
// TODO remove. This should be rolled into `ClientSet`
|
||||
ClientSetForVersion(requiredVersion *schema.GroupVersion) (internalclientset.Interface, error)
|
||||
// TODO remove. This should be rolled into `ClientConfig`
|
||||
ClientConfigForVersion(requiredVersion *schema.GroupVersion) (*restclient.Config, error)
|
||||
|
||||
// UpdatePodSpecForObject will call the provided function on the pod spec this object supports,
|
||||
// return false if no pod spec is supported, or return an error.
|
||||
UpdatePodSpecForObject(obj runtime.Object, fn func(*v1.PodSpec) error) (bool, error)
|
||||
|
|
|
@ -208,10 +208,6 @@ func (f *ring0Factory) ClientSet() (internalclientset.Interface, error) {
|
|||
return f.clientCache.ClientSetForVersion(nil)
|
||||
}
|
||||
|
||||
func (f *ring0Factory) ClientSetForVersion(requiredVersion *schema.GroupVersion) (internalclientset.Interface, error) {
|
||||
return f.clientCache.ClientSetForVersion(requiredVersion)
|
||||
}
|
||||
|
||||
func (f *ring0Factory) ClientConfig() (*restclient.Config, error) {
|
||||
return f.clientCache.ClientConfigForVersion(nil)
|
||||
}
|
||||
|
@ -219,10 +215,6 @@ func (f *ring0Factory) BareClientConfig() (*restclient.Config, error) {
|
|||
return f.clientConfig.ClientConfig()
|
||||
}
|
||||
|
||||
func (f *ring0Factory) ClientConfigForVersion(requiredVersion *schema.GroupVersion) (*restclient.Config, error) {
|
||||
return f.clientCache.ClientConfigForVersion(nil)
|
||||
}
|
||||
|
||||
func (f *ring0Factory) RESTClient() (*restclient.RESTClient, error) {
|
||||
clientConfig, err := f.clientCache.ClientConfigForVersion(nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -166,9 +166,7 @@ func (f *ring1Factory) UnstructuredClientForMapping(mapping *meta.RESTMapping) (
|
|||
}
|
||||
|
||||
func (f *ring1Factory) Describer(mapping *meta.RESTMapping) (printers.Describer, error) {
|
||||
mappingVersion := mapping.GroupVersionKind.GroupVersion()
|
||||
|
||||
clientset, err := f.clientAccessFactory.ClientSetForVersion(&mappingVersion)
|
||||
clientset, err := f.clientAccessFactory.ClientSet()
|
||||
if err != nil {
|
||||
// if we can't make a client for this group/version, go generic if possible
|
||||
if genericDescriber, genericErr := genericDescriber(f.clientAccessFactory, mapping); genericErr == nil {
|
||||
|
@ -219,7 +217,7 @@ func genericDescriber(clientAccessFactory ClientAccessFactory, mapping *meta.RES
|
|||
}
|
||||
|
||||
func (f *ring1Factory) LogsForObject(object, options runtime.Object, timeout time.Duration) (*restclient.Request, error) {
|
||||
clientset, err := f.clientAccessFactory.ClientSetForVersion(nil)
|
||||
clientset, err := f.clientAccessFactory.ClientSet()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -282,8 +280,7 @@ func (f *ring1Factory) LogsForObject(object, options runtime.Object, timeout tim
|
|||
}
|
||||
|
||||
func (f *ring1Factory) Scaler(mapping *meta.RESTMapping) (kubectl.Scaler, error) {
|
||||
mappingVersion := mapping.GroupVersionKind.GroupVersion()
|
||||
clientset, err := f.clientAccessFactory.ClientSetForVersion(&mappingVersion)
|
||||
clientset, err := f.clientAccessFactory.ClientSet()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -307,8 +304,7 @@ func (f *ring1Factory) Scaler(mapping *meta.RESTMapping) (kubectl.Scaler, error)
|
|||
}
|
||||
|
||||
func (f *ring1Factory) Reaper(mapping *meta.RESTMapping) (kubectl.Reaper, error) {
|
||||
mappingVersion := mapping.GroupVersionKind.GroupVersion()
|
||||
clientset, clientsetErr := f.clientAccessFactory.ClientSetForVersion(&mappingVersion)
|
||||
clientset, clientsetErr := f.clientAccessFactory.ClientSet()
|
||||
reaper, reaperErr := kubectl.ReaperFor(mapping.GroupVersionKind.GroupKind(), clientset)
|
||||
|
||||
if kubectl.IsNoSuchReaperError(reaperErr) {
|
||||
|
@ -367,7 +363,7 @@ func (f *ring1Factory) ApproximatePodTemplateForObject(object runtime.Object) (*
|
|||
}
|
||||
|
||||
func (f *ring1Factory) AttachablePodForObject(object runtime.Object, timeout time.Duration) (*api.Pod, error) {
|
||||
clientset, err := f.clientAccessFactory.ClientSetForVersion(nil)
|
||||
clientset, err := f.clientAccessFactory.ClientSet()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ type fakeClientAccessFactory struct {
|
|||
fakeClientset *fake.Clientset
|
||||
}
|
||||
|
||||
func (f *fakeClientAccessFactory) ClientSetForVersion(requiredVersion *schema.GroupVersion) (internalclientset.Interface, error) {
|
||||
func (f *fakeClientAccessFactory) ClientSet() (internalclientset.Interface, error) {
|
||||
return f.fakeClientset, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue