Allow KubeApi connect directly to remote k8s (#3766)

* allow KubeApi to connect directly to remote k8s

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* backward compat

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* backward compat

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2021-09-13 10:14:05 +03:00
1 parent 7bd0fed997
commit 3262b13926
4 files changed
+93 -5

No files matched your search

+27 -1
View File
@@ -19,10 +19,36 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { KubeApi } from "../kube-api";
import { Pod } from "../endpoints/pods.api";
import { forRemoteCluster, KubeApi } from "../kube-api";
import { KubeJsonApi } from "../kube-json-api";
import { KubeObject } from "../kube-object";
describe("forRemoteCluster", () => {
it("builds api client", async (done) => {
const api = forRemoteCluster({
cluster: {
server: "https://127.0.0.1:6443"
},
user: {
token: "daa"
}
}, Pod);
(fetch as any).mockResponse(async (request: any) => {
expect(request.url).toEqual("https://127.0.0.1:6443/api/v1/pods");
done();
return {
body: ""
};
});
await api.list();
});
});
describe("KubeApi", () => {
let request: KubeJsonApi;