From a78a0c4eaece6dafda0022c9c7eea94ddd96c933 Mon Sep 17 00:00:00 2001 From: Thorsten Klein Date: Mon, 18 Jan 2021 08:30:28 +0100 Subject: [PATCH] createClusterForm: show registry status Helps you to not connect to an exited registry --- src/commands/createClusterForm.ts | 17 ++++++++--------- src/k3d/k3d.objectmodel.ts | 1 + src/k3d/k3d.ts | 17 +++++++++-------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/commands/createClusterForm.ts b/src/commands/createClusterForm.ts index 1fa9ea6..6292da5 100644 --- a/src/commands/createClusterForm.ts +++ b/src/commands/createClusterForm.ts @@ -1,17 +1,16 @@ import * as vscode from 'vscode'; - -import { ClusterCreateSettings } from './createClusterSettings'; - import { getClustersNetworks, getRegistries } from '../k3d/k3d'; - import * as config from '../utils/config'; -import { Errorable } from '../utils/errorable'; -import { failed } from '../utils/errorable'; -import * as registry from '../utils/registry'; import * as docker from '../utils/docker'; +import { Errorable, failed } from '../utils/errorable'; import { longRunning } from '../utils/host'; -import { shell } from '../utils/shell'; import { logChannel } from "../utils/log"; +import * as registry from '../utils/registry'; +import { shell } from '../utils/shell'; +import { ClusterCreateSettings } from './createClusterSettings'; + + + const DEFAULT_IMAGE_REGISTRY = "https://registry.hub.docker.com"; const DEFAULT_IMAGE_REPO = "rancher/k3s"; @@ -239,7 +238,7 @@ export async function getCreateClusterForm(defaults: ClusterCreateSettings): Pro const registries = registriesResult.result; if (registries.length > 0) { res += ``; - res += registries.map((s) => ``).join("\n"); + res += registries.map((s) => ``).join("\n"); res += ``; datalistParam = `list="registries"`; diff --git a/src/k3d/k3d.objectmodel.ts b/src/k3d/k3d.objectmodel.ts index 9ff1695..f8b52c0 100644 --- a/src/k3d/k3d.objectmodel.ts +++ b/src/k3d/k3d.objectmodel.ts @@ -25,4 +25,5 @@ export interface K3dRegistryInfo { readonly name: string; readonly network: string; readonly created: Date; + readonly status: string; } diff --git a/src/k3d/k3d.ts b/src/k3d/k3d.ts index d0c62f8..b60be56 100644 --- a/src/k3d/k3d.ts +++ b/src/k3d/k3d.ts @@ -1,15 +1,15 @@ import { Observable, throwError } from 'rxjs'; - -import { K3dClusterInfo, K3dRegistryInfo } from "./k3d.objectmodel"; import { ClusterCreateSettings, createClusterArgsFromSettings } from '../commands/createClusterSettings'; -import { getOrInstallK3D, EnsureMode } from '../installer/installer'; - +import { EnsureMode, getOrInstallK3D } from '../installer/installer'; +import '../utils/array'; import { Errorable, failed } from '../utils/errorable'; -import * as shell from '../utils/shell'; +import * as kubectl from '../utils/kubectl'; import { logChannel } from '../utils/log'; -import '../utils/array'; +import * as shell from '../utils/shell'; import { minDate } from '../utils/time'; -import * as kubectl from '../utils/kubectl'; +import { K3dClusterInfo, K3dRegistryInfo } from "./k3d.objectmodel"; + + // invokeK3DCommandObj runs the k3d command with some @@ -176,7 +176,8 @@ export async function getRegistries(sh: shell.Shell): Promise registry.name); }