Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
62ad1655d5 | |||
caf3a095f2 | |||
89e44b2e5f | |||
a617f51b19 |
13
changelog.md
13
changelog.md
@ -1,5 +1,18 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2024-12-30 - 4.11.0 - feat(external-registry)
|
||||||
|
Introduce external registry management
|
||||||
|
|
||||||
|
- Added ExternalRegistryManager to handle external registry operations.
|
||||||
|
- Implemented ability to create, retrieve, and delete external registries.
|
||||||
|
- Enhanced Cloudly class to include ExternalRegistryManager.
|
||||||
|
|
||||||
|
## 2024-12-29 - 4.10.0 - feat(apiclient)
|
||||||
|
Added support for managing external registries in the API client.
|
||||||
|
|
||||||
|
- Introduced methods to get a registry by ID, get all registries, and create a new registry in the externalRegistry object.
|
||||||
|
- Updated external registry request interfaces to match new API client capabilities.
|
||||||
|
|
||||||
## 2024-12-29 - 4.9.0 - feat(apiclient)
|
## 2024-12-29 - 4.9.0 - feat(apiclient)
|
||||||
Add external registry management capabilities to Cloudly API client.
|
Add external registry management capabilities to Cloudly API client.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@serve.zone/cloudly",
|
"name": "@serve.zone/cloudly",
|
||||||
"version": "4.9.0",
|
"version": "4.11.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.",
|
"description": "A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/cloudly',
|
name: '@serve.zone/cloudly',
|
||||||
version: '4.9.0',
|
version: '4.11.0',
|
||||||
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import { CloudlyTaskmanager } from './manager.task/taskmanager.js';
|
|||||||
import { CloudlySecretManager } from './manager.secret/classes.secretmanager.js';
|
import { CloudlySecretManager } from './manager.secret/classes.secretmanager.js';
|
||||||
import { CloudlyServerManager } from './manager.server/classes.servermanager.js';
|
import { CloudlyServerManager } from './manager.server/classes.servermanager.js';
|
||||||
import { ExternalApiManager } from './manager.status/statusmanager.js';
|
import { ExternalApiManager } from './manager.status/statusmanager.js';
|
||||||
|
import { ExternalRegistryManager } from './manager.externalregistry/index.js';
|
||||||
import { ImageManager } from './manager.image/classes.imagemanager.js';
|
import { ImageManager } from './manager.image/classes.imagemanager.js';
|
||||||
import { logger } from './logger.js';
|
import { logger } from './logger.js';
|
||||||
import { CloudlyAuthManager } from './manager.auth/classes.authmanager.js';
|
import { CloudlyAuthManager } from './manager.auth/classes.authmanager.js';
|
||||||
@ -54,6 +55,7 @@ export class Cloudly {
|
|||||||
public clusterManager: ClusterManager;
|
public clusterManager: ClusterManager;
|
||||||
public coreflowManager: CloudlyCoreflowManager;
|
public coreflowManager: CloudlyCoreflowManager;
|
||||||
public externalApiManager: ExternalApiManager;
|
public externalApiManager: ExternalApiManager;
|
||||||
|
public externalRegistryManager: ExternalRegistryManager;
|
||||||
public imageManager: ImageManager;
|
public imageManager: ImageManager;
|
||||||
public taskManager: CloudlyTaskmanager;
|
public taskManager: CloudlyTaskmanager;
|
||||||
public serverManager: CloudlyServerManager;
|
public serverManager: CloudlyServerManager;
|
||||||
@ -80,6 +82,7 @@ export class Cloudly {
|
|||||||
this.clusterManager = new ClusterManager(this);
|
this.clusterManager = new ClusterManager(this);
|
||||||
this.coreflowManager = new CloudlyCoreflowManager(this);
|
this.coreflowManager = new CloudlyCoreflowManager(this);
|
||||||
this.externalApiManager = new ExternalApiManager(this);
|
this.externalApiManager = new ExternalApiManager(this);
|
||||||
|
this.externalRegistryManager = new ExternalRegistryManager(this);
|
||||||
this.imageManager = new ImageManager(this);
|
this.imageManager = new ImageManager(this);
|
||||||
this.taskManager = new CloudlyTaskmanager(this);
|
this.taskManager = new CloudlyTaskmanager(this);
|
||||||
this.secretManager = new CloudlySecretManager(this);
|
this.secretManager = new CloudlySecretManager(this);
|
||||||
|
@ -44,7 +44,7 @@ export class ClusterManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IReq_Any_Cloudly_GetClusters>(
|
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IReq_Any_Cloudly_GetClusters>(
|
||||||
new plugins.typedrequest.TypedHandler('getAllClusters', async (dataArg) => {
|
new plugins.typedrequest.TypedHandler('getClusters', async (dataArg) => {
|
||||||
// TODO: do authentication here
|
// TODO: do authentication here
|
||||||
const clusters = await this.getAllClusters();
|
const clusters = await this.getAllClusters();
|
||||||
return {
|
return {
|
||||||
@ -57,11 +57,11 @@ export class ClusterManager {
|
|||||||
|
|
||||||
// delete cluster
|
// delete cluster
|
||||||
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IReq_Any_Cloudly_DeleteClusterById>(
|
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.cluster.IReq_Any_Cloudly_DeleteClusterById>(
|
||||||
new plugins.typedrequest.TypedHandler('deleteCluster', async (reqDataArg, toolsArg) => {
|
new plugins.typedrequest.TypedHandler('deleteClusterById', async (reqDataArg, toolsArg) => {
|
||||||
await toolsArg.passGuards([this.cloudlyRef.authManager.adminIdentityGuard], reqDataArg);
|
await toolsArg.passGuards([this.cloudlyRef.authManager.adminIdentityGuard], reqDataArg);
|
||||||
await this.deleteCluster(reqDataArg.clusterId);
|
await this.deleteCluster(reqDataArg.clusterId);
|
||||||
return {
|
return {
|
||||||
success: true,
|
ok: true,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
40
ts/manager.externalregistry/classes.externalregistry.ts
Normal file
40
ts/manager.externalregistry/classes.externalregistry.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import * as plugins from '../plugins.js';
|
||||||
|
import * as paths from '../paths.js';
|
||||||
|
import type { Cloudly } from 'ts/classes.cloudly.js';
|
||||||
|
import type { ExternalRegistryManager } from './classes.externalregistrymanager.js';
|
||||||
|
|
||||||
|
export class ExternalRegistry extends plugins.smartdata.SmartDataDbDoc<ExternalRegistry, plugins.servezoneInterfaces.data.IExternalRegistry, ExternalRegistryManager> {
|
||||||
|
// STATIC
|
||||||
|
public static async getRegistryById(registryIdArg: string) {
|
||||||
|
const externalRegistry = await this.getInstance({
|
||||||
|
id: registryIdArg,
|
||||||
|
});
|
||||||
|
return externalRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async getRegistries() {
|
||||||
|
const externalRegistries = await this.getInstances({});
|
||||||
|
return externalRegistries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async createExternalRegistry(registryDataArg: Partial<plugins.servezoneInterfaces.data.IExternalRegistry['data']>) {
|
||||||
|
const externalRegistry = new ExternalRegistry();
|
||||||
|
externalRegistry.id = await ExternalRegistry.getNewId();
|
||||||
|
Object.assign(externalRegistry, registryDataArg);
|
||||||
|
await externalRegistry.save();
|
||||||
|
return externalRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
|
|
||||||
|
@plugins.smartdata.svDb()
|
||||||
|
public id: string;
|
||||||
|
|
||||||
|
@plugins.smartdata.svDb()
|
||||||
|
public data: plugins.servezoneInterfaces.data.IExternalRegistry['data'];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
import * as plugins from '../plugins.js';
|
||||||
|
import { Cloudly } from '../classes.cloudly.js';
|
||||||
|
import { ExternalRegistry } from './classes.externalregistry.js';
|
||||||
|
|
||||||
|
export class ExternalRegistryManager {
|
||||||
|
public cloudlyRef: Cloudly;
|
||||||
|
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||||
|
public CExternalRegistry = plugins.smartdata.setDefaultManagerForDoc(this, ExternalRegistry);
|
||||||
|
|
||||||
|
get db() {
|
||||||
|
return this.cloudlyRef.mongodbConnector.smartdataDb;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(cloudlyRef: Cloudly) {
|
||||||
|
this.cloudlyRef = cloudlyRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async start() {
|
||||||
|
// lets set up a typedrouter
|
||||||
|
this.typedrouter.addTypedRouter(this.typedrouter);
|
||||||
|
|
||||||
|
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.externalRegistry.IReq_GetRegistryById>(
|
||||||
|
new plugins.typedrequest.TypedHandler('getExternalRegistryById', async (dataArg) => {
|
||||||
|
const registry = await ExternalRegistry.getRegistryById(dataArg.id);
|
||||||
|
return {
|
||||||
|
registry: await registry.createSavableObject(),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.externalRegistry.IReq_GetRegistries>(
|
||||||
|
new plugins.typedrequest.TypedHandler('getExternalRegistries', async (dataArg) => {
|
||||||
|
const registries = await ExternalRegistry.getRegistries();
|
||||||
|
return {
|
||||||
|
registries: await Promise.all(
|
||||||
|
registries.map((registry) => registry.createSavableObject())
|
||||||
|
),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
this.typedrouter.addTypedHandler<plugins.servezoneInterfaces.requests.externalRegistry.IReq_CreateRegistry>(
|
||||||
|
new plugins.typedrequest.TypedHandler('createExternalRegistry', async (dataArg) => {
|
||||||
|
const registry = await ExternalRegistry.createExternalRegistry(dataArg.registryData);
|
||||||
|
return {
|
||||||
|
registry: await registry.createSavableObject(),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
2
ts/manager.externalregistry/index.ts
Normal file
2
ts/manager.externalregistry/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './classes.externalregistrymanager.js';
|
||||||
|
export * from './classes.externalregistry.js';
|
@ -1,30 +0,0 @@
|
|||||||
import * as plugins from '../plugins.js';
|
|
||||||
import * as paths from '../paths.js';
|
|
||||||
import type { Cloudly } from 'ts/classes.cloudly.js';
|
|
||||||
|
|
||||||
export class ExternalRegistry extends plugins.smartdata.SmartDataDbDoc<ExternalRegistry, plugins.servezoneInterfaces.data.IExternalRegistry> {
|
|
||||||
// STATIC
|
|
||||||
public async getRegistryById(registryNameArg: string) {
|
|
||||||
this
|
|
||||||
}
|
|
||||||
|
|
||||||
// INSTANCE
|
|
||||||
public cloudlyRef: Cloudly;
|
|
||||||
public smartdataDb: plugins.smartdata.SmartdataDb;
|
|
||||||
|
|
||||||
@plugins.smartdata.svDb()
|
|
||||||
public id: string;
|
|
||||||
|
|
||||||
@plugins.smartdata.svDb()
|
|
||||||
public data: plugins.servezoneInterfaces.data.IExternalRegistry['data'];
|
|
||||||
|
|
||||||
get db() {
|
|
||||||
return this.cloudlyRef.mongodbConnector.smartdataDb;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(cloudlyRef: Cloudly) {
|
|
||||||
super();
|
|
||||||
this.cloudlyRef = cloudlyRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -7,6 +7,7 @@ import { Service } from './classes.service.js';
|
|||||||
import { Cluster } from './classes.cluster.js';
|
import { Cluster } from './classes.cluster.js';
|
||||||
import { SecretBundle } from './classes.secretbundle.js';
|
import { SecretBundle } from './classes.secretbundle.js';
|
||||||
import { SecretGroup } from './classes.secretgroup.js';
|
import { SecretGroup } from './classes.secretgroup.js';
|
||||||
|
import { ExternalRegistry } from './classes.externalregistry.js';
|
||||||
|
|
||||||
export class CloudlyApiClient {
|
export class CloudlyApiClient {
|
||||||
private cloudlyUrl: string;
|
private cloudlyUrl: string;
|
||||||
@ -159,6 +160,19 @@ export class CloudlyApiClient {
|
|||||||
return typedResponse.certificate;
|
return typedResponse.certificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public externalRegistry = {
|
||||||
|
// ExternalRegistry
|
||||||
|
getRegistryById: async (registryNameArg: string) => {
|
||||||
|
return ExternalRegistry.getExternalRegistryById(this, registryNameArg);
|
||||||
|
},
|
||||||
|
getRegistries: async () => {
|
||||||
|
return ExternalRegistry.getExternalRegistries(this);
|
||||||
|
},
|
||||||
|
createRegistry: async (optionsArg: Parameters<typeof ExternalRegistry.createExternalRegistry>[1]) => {
|
||||||
|
return ExternalRegistry.createExternalRegistry(this, optionsArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public image = {
|
public image = {
|
||||||
// Images
|
// Images
|
||||||
getImageById: async (imageIdArg: string) => {
|
getImageById: async (imageIdArg: string) => {
|
||||||
|
@ -3,20 +3,20 @@ import type { CloudlyApiClient } from './classes.cloudlyapiclient.js';
|
|||||||
|
|
||||||
export class ExternalRegistry implements plugins.servezoneInterfaces.data.IExternalRegistry {
|
export class ExternalRegistry implements plugins.servezoneInterfaces.data.IExternalRegistry {
|
||||||
// STATIC
|
// STATIC
|
||||||
public static async getRegistryById(cloudlyClientRef: CloudlyApiClient, registryNameArg: string) {
|
public static async getExternalRegistryById(cloudlyClientRef: CloudlyApiClient, registryNameArg: string) {
|
||||||
const getRegistryByIdTR = cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.externalRegistry.IReq_GetRegistryById>(
|
const getRegistryByIdTR = cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.externalRegistry.IReq_GetRegistryById>(
|
||||||
'getExternalRegistryById'
|
'getExternalRegistryById'
|
||||||
);
|
);
|
||||||
const response = await getRegistryByIdTR.fire({
|
const response = await getRegistryByIdTR.fire({
|
||||||
identity: cloudlyClientRef.identity,
|
identity: cloudlyClientRef.identity,
|
||||||
registryName: registryNameArg,
|
id: registryNameArg,
|
||||||
});
|
});
|
||||||
const newRegistry = new ExternalRegistry(cloudlyClientRef);
|
const newRegistry = new ExternalRegistry(cloudlyClientRef);
|
||||||
Object.assign(newRegistry, response.registry);
|
Object.assign(newRegistry, response.registry);
|
||||||
return newRegistry;
|
return newRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async getRegistries(cloudlyClientRef: CloudlyApiClient) {
|
public static async getExternalRegistries(cloudlyClientRef: CloudlyApiClient) {
|
||||||
const getRegistriesTR = cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.externalRegistry.IReq_GetRegistries>(
|
const getRegistriesTR = cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.externalRegistry.IReq_GetRegistries>(
|
||||||
'getExternalRegistries'
|
'getExternalRegistries'
|
||||||
);
|
);
|
||||||
@ -32,13 +32,12 @@ export class ExternalRegistry implements plugins.servezoneInterfaces.data.IExter
|
|||||||
return registryConfigs;
|
return registryConfigs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async createRegistry(cloudlyClientRef: CloudlyApiClient, registryNameArg: string, registryDataArg: Partial<plugins.servezoneInterfaces.data.IExternalRegistry['data']>) {
|
public static async createExternalRegistry(cloudlyClientRef: CloudlyApiClient, registryDataArg: Partial<plugins.servezoneInterfaces.data.IExternalRegistry['data']>) {
|
||||||
const createRegistryTR = cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.externalRegistry.IReq_CreateRegistry>(
|
const createRegistryTR = cloudlyClientRef.typedsocketClient.createTypedRequest<plugins.servezoneInterfaces.requests.externalRegistry.IReq_CreateRegistry>(
|
||||||
'createExternalRegistry'
|
'createExternalRegistry'
|
||||||
);
|
);
|
||||||
const response = await createRegistryTR.fire({
|
const response = await createRegistryTR.fire({
|
||||||
identity: cloudlyClientRef.identity,
|
identity: cloudlyClientRef.identity,
|
||||||
registryName: registryNameArg,
|
|
||||||
registryData: registryDataArg as plugins.servezoneInterfaces.data.IExternalRegistry['data'],
|
registryData: registryDataArg as plugins.servezoneInterfaces.data.IExternalRegistry['data'],
|
||||||
});
|
});
|
||||||
const newRegistry = new ExternalRegistry(cloudlyClientRef);
|
const newRegistry = new ExternalRegistry(cloudlyClientRef);
|
||||||
|
@ -9,7 +9,7 @@ export interface IReq_GetRegistryById extends plugins.typedrequestInterfaces.imp
|
|||||||
method: 'getExternalRegistryById';
|
method: 'getExternalRegistryById';
|
||||||
request: {
|
request: {
|
||||||
identity: userInterfaces.IIdentity;
|
identity: userInterfaces.IIdentity;
|
||||||
registryName: string;
|
id: string;
|
||||||
};
|
};
|
||||||
response: {
|
response: {
|
||||||
registry: data.IExternalRegistry;
|
registry: data.IExternalRegistry;
|
||||||
@ -36,7 +36,6 @@ export interface IReq_CreateRegistry extends plugins.typedrequestInterfaces.impl
|
|||||||
method: 'createExternalRegistry';
|
method: 'createExternalRegistry';
|
||||||
request: {
|
request: {
|
||||||
identity: userInterfaces.IIdentity;
|
identity: userInterfaces.IIdentity;
|
||||||
registryName: string;
|
|
||||||
registryData: data.IExternalRegistry['data'];
|
registryData: data.IExternalRegistry['data'];
|
||||||
};
|
};
|
||||||
response: {
|
response: {
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/cloudly',
|
name: '@serve.zone/cloudly',
|
||||||
version: '4.9.0',
|
version: '4.11.0',
|
||||||
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
description: 'A comprehensive tool for managing containerized applications across multiple cloud providers using Docker Swarmkit, featuring web, CLI, and API interfaces.'
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user