Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/clients/kubernetesClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export class KubernetesClient {
private secretsCache: Map<string, any[]> = new Map();
private artifactsCache: Map<string, any[]> = new Map();
private engineconfigsCache: Map<string, any[]> = new Map();
private nodeprofilesCache: Map<string, any[]> = new Map();
private manifestsCache: Map<string, any[]> = new Map();
private crdCache: any[] = [];


Expand Down Expand Up @@ -84,6 +86,8 @@ export class KubernetesClient {

// core.eda.nokia.com/v1
{ name: 'engineconfigs', group: 'core.eda.nokia.com', version: 'v1', plural: 'engineconfigs', namespaced: true },
{ name: 'nodeprofiles', group: 'core.eda.nokia.com', version: 'v1', plural: 'nodeprofiles', namespaced: true },
{ name: 'manifests', group: 'core.eda.nokia.com', version: 'v1', plural: 'manifests', namespaced: true },

// apps/v1
{ name: 'deployments', group: 'apps', version: 'v1', plural: 'deployments', namespaced: true },
Expand Down Expand Up @@ -529,6 +533,14 @@ export class KubernetesClient {
return this.engineconfigsCache.get(ns) || [];
}

public getCachedNodeprofiles(ns: string): any[] {
return this.nodeprofilesCache.get(ns) || [];
}

public getCachedManifests(ns: string): any[] {
return this.manifestsCache.get(ns) || [];
}


public async getCustomResourceYaml(
group: string,
Expand Down Expand Up @@ -563,6 +575,26 @@ export class KubernetesClient {
);
}

public async getNodeprofileYaml(name: string, namespace: string): Promise<string> {
return this.getCustomResourceYaml(
'core.eda.nokia.com',
'v1',
'nodeprofiles',
name,
namespace
);
}

public async getManifestYaml(name: string, namespace: string): Promise<string> {
return this.getCustomResourceYaml(
'core.eda.nokia.com',
'v1',
'manifests',
name,
namespace
);
}

/**
* Fetch any Kubernetes resource as YAML using the API
*/
Expand Down