Skip to content

Commit

Permalink
createClusterForm: show registry status
Browse files Browse the repository at this point in the history
Helps you to not connect to an exited registry
  • Loading branch information
iwilltry42 committed Jan 18, 2021
1 parent 7558f01 commit a78a0c4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
17 changes: 8 additions & 9 deletions src/commands/createClusterForm.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -239,7 +238,7 @@ export async function getCreateClusterForm(defaults: ClusterCreateSettings): Pro
const registries = registriesResult.result;
if (registries.length > 0) {
res += `<datalist id="registries">`;
res += registries.map((s) => `<option value="${s.name}">${s.name}</option>`).join("\n");
res += registries.map((s) => `<option value="${s.name}">${s.name} (${s.status})</option>`).join("\n");
res += `</datalist>`;

datalistParam = `list="registries"`;
Expand Down
1 change: 1 addition & 0 deletions src/k3d/k3d.objectmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ export interface K3dRegistryInfo {
readonly name: string;
readonly network: string;
readonly created: Date;
readonly status: string;
}
17 changes: 9 additions & 8 deletions src/k3d/k3d.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -176,7 +176,8 @@ export async function getRegistries(sh: shell.Shell): Promise<Errorable<K3dRegis
{
name: registry.name,
network: registry.Network,
created: new Date(registry.created)
created: new Date(registry.created),
status: registry.State.status
}))
.orderBy((registry: K3dRegistryInfo) => registry.name);
}
Expand Down

0 comments on commit a78a0c4

Please sign in to comment.