Drop more references to Kim, including in the READMEs

- Most of the time use a generic, "image"-related name
- Update the READMEs

Signed-off-by: Eric Promislow <epromislow@suse.com>
This commit is contained in:
Eric Promislow
2021-10-01 16:52:03 -07:00
parent 1f8b720203
commit e58eabdc45
16 changed files with 57 additions and 68 deletions

View File

@@ -9,12 +9,12 @@ Rancher Desktop provides the following features in the form of a desktop applica
- The version of Kubernetes you choose
- Ability to test upgrading Kubernetes to a new version and see how your workloads respond
- Build, push, and pull images (powered by [KIM])
- Build, push, and pull images (powered by [NERDCTL])
- Expose an application in Kubernetes for local access
All of this is wrapped in an open-source application.
[KIM]: https://github.com/rancher/kim
[NERDCTL]: https://github.com/containerd/nerdctl
## Get The App
@@ -38,7 +38,7 @@ https://github.com/rancher-sandbox/rancher-desktop/actions/workflows/package.yam
Rancher Desktop is an Electron application with the primary business logic
written in TypeScript and JavaScript. It leverages several other pieces of
technology to provide the platform elements which include k3s, kim, kubectl,
technology to provide the platform elements which include k3s, kubectl, nerdctl
WSL, qemu, and more. The application wraps numerous pieces of technology to
provide one cohesive application.
@@ -58,9 +58,9 @@ be installed to build the source. On Windows, [Go] is also required.
#### Windows
There are two options for building from source on Windows: with a
[Development VM Setup](#development-vm-setup) or
[Manual Development Environment Setup](#manual-development-environment-setup)
There are two options for building from source on Windows: with a
[Development VM Setup](#development-vm-setup) or
[Manual Development Environment Setup](#manual-development-environment-setup)
with an existing Windows installation.
##### Development VM Setup

View File

@@ -126,7 +126,7 @@ async function doFirstRun() {
if (os.platform() === 'darwin') {
await Promise.all([
linkResource('helm', true),
linkResource('kim', true),
linkResource('kim', true), // TODO: Remove when we stop shipping kim
linkResource('kubectl', true),
linkResource('nerdctl', true),
]);
@@ -439,7 +439,7 @@ Electron.ipcMain.on('factory-reset', async() => {
await k8smanager.factoryReset();
if (os.platform() === 'darwin') {
// Unlink binaries
for (const name of ['helm', 'kim', 'kubectl']) {
for (const name of ['helm', 'kubectl', 'nerdctl']) {
Electron.ipcMain.emit('install-set', { reply: () => { } }, name, false);
}
}

View File

@@ -1,19 +1,22 @@
# Images
Rancher Desktop provides the ability to build, push, and pull images via the
[KIM](https://github.com/rancher/kim) project.
[NERDCTL](https://github.com/containerd/nerdctl) project.
Note, `kim` is put into the path automatically. This occurs during the
Note, `nerdctl` is put into the path automatically. This occurs during the
installer on Windows, and upon first run on macOS.
## Using KIM
## Using NERDCTL
You can learn about all of the command options by running `kim -h`. This will
display the help documentation.
You can learn about all of the command options by running `nerdctl -h`. This will
display the help documentation. The command requires Rancher Desktop to be running
for it to work.
KIM has a client side and server side component. The server side part is a
container running in Kubernetes while the client side application runs on
Mac or Windows. Images are stored in the same containerd that Kubernetes uses.
The initial set of images are stored in the same containerd that Kubernetes uses,
and are part of the `k8s.io` namespace. You can also switch to a namespace called
`default` if you wish to build or pull images into a different namespace. Currently
the only way to create other namespaces is to build or pull an image with the
`nerdctl` CLI, using the `--namespace <NAMESPACE_NAME>` option.
## Building Images
@@ -22,7 +25,7 @@ running `kim` from a directory with a `Dockerfile` where the `Dockerfile` is
using a scratch image.
```console
kim build .
nerdctl build .
[+] Building 0.1s (4/4) FINISHED
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 31B
@@ -33,8 +36,8 @@ using a scratch image.
=> CACHED [1/1] ADD anvil-app /
```
`kim` has tags for tagging at the same time as building and other options you've
`nerdctl` has tags for tagging at the same time as building and other options you've
come to expect.
If you want to tag an existing image you've built you can use the `kim tag`
If you want to tag an existing image you've built you can use the `nerdctl tag`
command.

View File

@@ -164,10 +164,10 @@ suffix:
# Components & Pages
##############################
images:
title: Images
state:
title: Images
state:
k8sUnready: Waiting for Kubernetes to be ready
kimUnready: Waiting for image manager to be ready
imagesUnready: Waiting for image manager to be ready
unknown: 'Error: Unknown state; please reload.'
close: Close Output to Continue
manager:

View File

@@ -98,8 +98,8 @@
<h3 v-if="state === 'K8S_UNREADY'">
{{ t('images.state.k8sUnready') }}
</h3>
<h3 v-else-if="state === 'KIM_UNREADY'">
{{ t('images.state.kimUnready') }}
<h3 v-else-if="state === 'IMAGE_MANAGER_UNREADY'">
{{ t('images.state.imagesUnready') }}
</h3>
<h3 v-else>
{{ t('images.state.unknown') }}
@@ -128,7 +128,7 @@ export default {
state: {
type: String,
default: 'K8S_UNREADY',
validator: value => ['K8S_UNREADY', 'KIM_UNREADY', 'READY'].includes(value),
validator: value => ['K8S_UNREADY', 'IMAGE_MANAGER_UNREADY', 'READY'].includes(value),
},
showAll: {
type: Boolean,

View File

@@ -1,6 +1,6 @@
import { ImageProcessor } from '@/k8s-engine/images/imageProcessor';
import NerdctlImageProcessor from '@/k8s-engine/images/nerdctlImageProcessor';
import * as K8s from '~/k8s-engine/k8s';
import * as K8s from '@/k8s-engine/k8s';
/**
* Currently there's only one image processor.

View File

@@ -35,8 +35,8 @@ export interface imageType {
*/
export abstract class ImageProcessor extends EventEmitter {
protected k8sManager: K8s.KubernetesBackend|null;
// During startup `kim images` repeatedly fires the same error message. Instead,
// keep track of the current error and give a count instead.
// Sometimes the `images` subcommand repeatedly fires the same error message.
// Instead of logging it every time, keep track of the current error and give a count instead.
private lastErrorMessage = '';
private sameErrorMessageCount = 0;
protected showedStderr = false;

View File

@@ -6,6 +6,7 @@ import resources from '@/resources';
import PathConflictManager from '@/main/pathConflictManager';
import * as window from '@/window';
// TODO: Remove 'kim' when we stop shipping kim
const INTEGRATIONS = ['helm', 'kim', 'kubectl', 'nerdctl'];
const console = Logging.background;
const PUBLIC_LINK_DIR = '/usr/local/bin';

View File

@@ -1,9 +1,8 @@
/**
* This module contains code for handling kim (images).
* This module contains code for handling image-processor events (nerdctl, kim).
*/
import path from 'path';
import util from 'util';
import Electron from 'electron';
@@ -51,23 +50,8 @@ export function setupImageProcessor(imageProcessorName: string, k8sManager: K8s.
Electron.ipcMain.on('do-image-deletion', async(event, imageName, imageID) => {
try {
const maxNumAttempts = 2;
// On macOS a second attempt is needed to actually delete the image.
// Probably due to a timing issue on the server part of kim, but not determined why.
// Leave this in for windows in case it can happen there too.
let i = 0;
for (i = 0; i < maxNumAttempts; i++) {
await imageManager.deleteImage(imageID);
await imageManager.refreshImages();
if (!imageManager.listImages().some(image => image.imageID === imageID)) {
break;
}
await util.promisify(setTimeout)(500);
}
if (i === maxNumAttempts) {
console.log(`Failed to delete ${ imageID } in ${ maxNumAttempts } tries`);
}
await imageManager.deleteImage(imageID);
await imageManager.refreshImages();
event.reply('image-process-ended', 0);
} catch (err) {
await Electron.dialog.showMessageBox({

View File

@@ -21,10 +21,10 @@ export default {
components: { Images },
data() {
return {
settings: ipcRenderer.sendSync('settings-read'),
k8sState: ipcRenderer.sendSync('k8s-state'),
kimState: false,
images: [],
settings: ipcRenderer.sendSync('settings-read'),
k8sState: ipcRenderer.sendSync('k8s-state'),
imageManagerState: false,
images: [],
};
},
@@ -34,7 +34,7 @@ export default {
return 'K8S_UNREADY';
}
return this.kimState ? 'READY' : 'KIM_UNREADY';
return this.imageManagerState ? 'READY' : 'IMAGE_MANAGER_UNREADY';
}
},
@@ -50,7 +50,7 @@ export default {
this.$data.k8sState = state;
});
ipcRenderer.on('images-check-state', (event, state) => {
this.kimState = state;
this.imageManagerState = state;
});
ipcRenderer.on('settings-update', (event, settings) => {
// TODO: put in a status bar
@@ -60,7 +60,7 @@ export default {
this.$data.images = await ipcRenderer.invoke('images-mounted', true);
})();
(async() => {
this.$data.kimState = await ipcRenderer.invoke('images-check-state');
this.$data.imageManagerState = await ipcRenderer.invoke('images-check-state');
})();
},

View File

@@ -1,14 +1,14 @@
import KimNonBuildOutputCuller from '~/utils/processOutputInterpreters/kim-non-build-output';
import KimBuildOutputCuller from '~/utils/processOutputInterpreters/kim-build-output';
import TrivyScanImageOutputCuller from '~/utils/processOutputInterpreters/trivy-image-output';
import ImageNonBuildOutputCuller from '@/utils/processOutputInterpreters/image-non-build-output';
import ImageBuildOutputCuller from '@/utils/processOutputInterpreters/image-build-output';
import TrivyScanImageOutputCuller from '@/utils/processOutputInterpreters/trivy-image-output';
const cullersByName = {
build: KimBuildOutputCuller,
build: ImageBuildOutputCuller,
'trivy-image': TrivyScanImageOutputCuller
};
export default function getImageOutputCuller(command) {
const klass = cullersByName[command] || KimNonBuildOutputCuller;
const klass = cullersByName[command] || ImageNonBuildOutputCuller;
return new klass();
}

View File

@@ -5,6 +5,7 @@ import semver from 'semver';
import * as childProcess from '@/utils/childProcess';
import resources from '@/resources';
// TODO: Remove all references to kim once we stop shipping it
const flags: Record<string, string> = {
helm: 'version',
kim: '-v',

View File

@@ -1,13 +1,13 @@
import fs from 'fs';
import path from 'path';
import KimBuildOutputCuller from '@/utils/processOutputInterpreters/kim-build-output';
import ImageBuildOutputCuller from '@/utils/processOutputInterpreters/image-build-output';
describe('kim build output', () => {
describe('image build output', () => {
it('returns the raw text back', () => {
const buildOutputPath = path.join('./src/utils/processOutputInterpreters/__tests__/assets', 'build.txt');
const data = fs.readFileSync(buildOutputPath).toString();
const culler = new KimBuildOutputCuller();
const culler = new ImageBuildOutputCuller();
culler.addData(data);
expect(culler.getProcessedData()).toBe(data.replace(/\r/g, ''));

View File

@@ -1,15 +1,15 @@
import fs from 'fs';
import path from 'path';
import KimNonBuildOutputCuller from '@/utils/processOutputInterpreters/kim-non-build-output';
import ImageNonBuildOutputCuller from '@/utils/processOutputInterpreters/image-non-build-output';
describe('simple kim output', () => {
describe('simple image output', () => {
describe('push', () => {
it('culls by SHA', () => {
const fname = path.join('./src/utils/processOutputInterpreters/__tests__/assets', 'push.txt');
const data = fs.readFileSync(fname).toString();
const lines = data.split(/(\r?\n)/);
const culler = new KimNonBuildOutputCuller();
const culler = new ImageNonBuildOutputCuller();
expect(lines.length).toBeGreaterThan(6);
culler.addData(lines.slice(0, 24).join(''));
@@ -131,7 +131,7 @@ describe('simple kim output', () => {
const fname = path.join('./src/utils/processOutputInterpreters/__tests__/assets', 'pull.txt');
const data = fs.readFileSync(fname).toString();
const lines = data.split(/(\r?\n)/);
const culler = new KimNonBuildOutputCuller();
const culler = new ImageNonBuildOutputCuller();
expect(lines.length).toBeGreaterThan(6);
culler.addData(lines.slice(0, 16).join(''));

View File

@@ -1,6 +1,6 @@
const LineSplitter = /\r?\n/;
export default class KimBuildOutputCuller {
export default class ImageBuildOutputCuller {
constructor() {
this.lines = [];
}

View File

@@ -2,7 +2,7 @@ const LineSplitter = /\r?\n/;
const ShaLineMatcher = /^[-\w]+-sha256:(\w+):\s*\w+\s*\|.*?\|/;
const SummaryLineMatcher = /^elapsed:.*total:/;
export default class KimNonBuildOutputCuller {
export default class ImageNonBuildOutputCuller {
constructor() {
this.buffering = true;
this.lines = [];