mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	expose the clientConfig to consumers trying to build custom clients against the kubeapiserver
This commit is contained in:
		@@ -30,6 +30,8 @@ import (
 | 
				
			|||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						"k8s.io/apimachinery/pkg/runtime"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	v1 "k8s.io/api/core/v1"
 | 
						v1 "k8s.io/api/core/v1"
 | 
				
			||||||
	apierrors "k8s.io/apimachinery/pkg/api/errors"
 | 
						apierrors "k8s.io/apimachinery/pkg/api/errors"
 | 
				
			||||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
						metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
				
			||||||
@@ -71,6 +73,7 @@ type Framework struct {
 | 
				
			|||||||
	// test multiple times in parallel.
 | 
						// test multiple times in parallel.
 | 
				
			||||||
	UniqueName string
 | 
						UniqueName string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						clientConfig                     *rest.Config
 | 
				
			||||||
	ClientSet                        clientset.Interface
 | 
						ClientSet                        clientset.Interface
 | 
				
			||||||
	KubemarkExternalClusterClientSet clientset.Interface
 | 
						KubemarkExternalClusterClientSet clientset.Interface
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -192,6 +195,7 @@ func (f *Framework) BeforeEach() {
 | 
				
			|||||||
		if TestContext.KubeAPIContentType != "" {
 | 
							if TestContext.KubeAPIContentType != "" {
 | 
				
			||||||
			config.ContentType = TestContext.KubeAPIContentType
 | 
								config.ContentType = TestContext.KubeAPIContentType
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							f.clientConfig = rest.CopyConfig(config)
 | 
				
			||||||
		f.ClientSet, err = clientset.NewForConfig(config)
 | 
							f.ClientSet, err = clientset.NewForConfig(config)
 | 
				
			||||||
		ExpectNoError(err)
 | 
							ExpectNoError(err)
 | 
				
			||||||
		f.DynamicClient, err = dynamic.NewForConfig(config)
 | 
							f.DynamicClient, err = dynamic.NewForConfig(config)
 | 
				
			||||||
@@ -387,6 +391,7 @@ func (f *Framework) AfterEach() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		// Paranoia-- prevent reuse!
 | 
							// Paranoia-- prevent reuse!
 | 
				
			||||||
		f.Namespace = nil
 | 
							f.Namespace = nil
 | 
				
			||||||
 | 
							f.clientConfig = nil
 | 
				
			||||||
		f.ClientSet = nil
 | 
							f.ClientSet = nil
 | 
				
			||||||
		f.namespacesToDelete = nil
 | 
							f.namespacesToDelete = nil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -522,6 +527,15 @@ func (f *Framework) WaitForPodNoLongerRunning(podName string) error {
 | 
				
			|||||||
	return e2epod.WaitForPodNoLongerRunningInNamespace(f.ClientSet, podName, f.Namespace.Name)
 | 
						return e2epod.WaitForPodNoLongerRunningInNamespace(f.ClientSet, podName, f.Namespace.Name)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ClientConfig an externally accessible method for reading the kube client config.
 | 
				
			||||||
 | 
					func (f *Framework) ClientConfig() *rest.Config {
 | 
				
			||||||
 | 
						ret := rest.CopyConfig(f.clientConfig)
 | 
				
			||||||
 | 
						// json is least common denominator
 | 
				
			||||||
 | 
						ret.ContentType = runtime.ContentTypeJSON
 | 
				
			||||||
 | 
						ret.AcceptContentTypes = runtime.ContentTypeJSON
 | 
				
			||||||
 | 
						return ret
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TestContainerOutput runs the given pod in the given namespace and waits
 | 
					// TestContainerOutput runs the given pod in the given namespace and waits
 | 
				
			||||||
// for all of the containers in the podSpec to move into the 'Success' status, and tests
 | 
					// for all of the containers in the podSpec to move into the 'Success' status, and tests
 | 
				
			||||||
// the specified container log against the given expected output using a substring matcher.
 | 
					// the specified container log against the given expected output using a substring matcher.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user