@backstage-community/plugin-ocm-backend 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +639 -0
- package/README.md +5 -0
- package/config.d.ts +71 -0
- package/dist/bundle.cjs.js +19 -0
- package/dist/bundle.cjs.js.map +1 -0
- package/dist/constants.cjs.js +10 -0
- package/dist/constants.cjs.js.map +1 -0
- package/dist/helpers/config.cjs.js +80 -0
- package/dist/helpers/config.cjs.js.map +1 -0
- package/dist/helpers/kubernetes.cjs.js +106 -0
- package/dist/helpers/kubernetes.cjs.js.map +1 -0
- package/dist/helpers/parser.cjs.js +81 -0
- package/dist/helpers/parser.cjs.js.map +1 -0
- package/dist/index.cjs.js +16 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/providers/ManagedClusterProvider.cjs.js +148 -0
- package/dist/providers/ManagedClusterProvider.cjs.js.map +1 -0
- package/dist/providers/module.cjs.js +38 -0
- package/dist/providers/module.cjs.js.map +1 -0
- package/dist/schema/openapi.generated.cjs.js +301 -0
- package/dist/schema/openapi.generated.cjs.js.map +1 -0
- package/dist/service/router.cjs.js +125 -0
- package/dist/service/router.cjs.js.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManagedClusterProvider.cjs.js","sources":["../../src/providers/ManagedClusterProvider.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n LoggerService,\n SchedulerService,\n SchedulerServiceTaskRunner,\n} from '@backstage/backend-plugin-api';\nimport {\n ANNOTATION_LOCATION,\n ANNOTATION_ORIGIN_LOCATION,\n ResourceEntity,\n} from '@backstage/catalog-model';\nimport type { Config } from '@backstage/config';\nimport { InputError } from '@backstage/errors';\nimport type {\n EntityProvider,\n EntityProviderConnection,\n} from '@backstage/plugin-catalog-node';\n\nimport { CustomObjectsApi } from '@kubernetes/client-node';\n\nimport {\n ANNOTATION_CLUSTER_ID,\n ANNOTATION_PROVIDER_ID,\n} from '@backstage-community/plugin-ocm-common';\n\nimport {\n ANNOTATION_KUBERNETES_API_SERVER,\n CONSOLE_CLAIM,\n HUB_CLUSTER_NAME_IN_OCM,\n} from '../constants';\nimport { readOcmConfigs } from '../helpers/config';\nimport {\n getManagedCluster,\n hubApiClient,\n listManagedClusters,\n} from '../helpers/kubernetes';\nimport { getClaim, translateOCMToResource } from '../helpers/parser';\n\n/**\n * Provides OpenShift cluster resource entities from Open Cluster Management.\n */\nexport class ManagedClusterProvider implements EntityProvider {\n protected readonly client: CustomObjectsApi;\n protected readonly hubResourceName: string;\n protected readonly id: string;\n protected readonly owner: string;\n protected readonly logger: LoggerService;\n private readonly scheduleFn: () => Promise<void>;\n protected connection?: EntityProviderConnection;\n\n protected constructor(\n client: CustomObjectsApi,\n hubResourceName: string,\n id: string,\n deps: { logger: LoggerService },\n owner: string,\n taskRunner: SchedulerServiceTaskRunner,\n ) {\n this.client = client;\n this.hubResourceName = hubResourceName;\n this.id = id;\n this.logger = deps.logger;\n this.owner = owner;\n this.scheduleFn = this.createScheduleFn(taskRunner);\n }\n\n static fromConfig(\n deps: {\n config: Config;\n logger: LoggerService;\n },\n options:\n | { schedule: SchedulerServiceTaskRunner }\n | { scheduler: SchedulerService },\n ) {\n const { config, logger } = deps;\n\n return readOcmConfigs(config).map(providerConfig => {\n const client = hubApiClient(providerConfig, logger);\n let taskRunner;\n if ('scheduler' in options && providerConfig.schedule) {\n // Create a scheduled task runner using the provided scheduler and schedule configuration\n taskRunner = options.scheduler.createScheduledTaskRunner(\n providerConfig.schedule,\n );\n } else if ('schedule' in options) {\n // Use the provided schedule directly\n taskRunner = options.schedule;\n } else {\n throw new InputError(\n `No schedule provided via config for OCMProvider:${providerConfig.id}.`,\n );\n }\n\n return new ManagedClusterProvider(\n client,\n providerConfig.hubResourceName,\n providerConfig.id,\n deps,\n providerConfig.owner,\n taskRunner,\n );\n });\n }\n public async connect(connection: EntityProviderConnection): Promise<void> {\n this.connection = connection;\n await this.scheduleFn();\n }\n\n private createScheduleFn(\n taskRunner: SchedulerServiceTaskRunner,\n ): () => Promise<void> {\n return async () => {\n return taskRunner.run({\n id: `run_ocm_refresh_${this.getProviderName()}`,\n fn: async () => {\n try {\n await this.run();\n } catch (error: any) {\n // Ensure that we don't log any sensitive internal data:\n this.logger.error(\n 'Error while syncing cluster resources from Open Cluster Management',\n {\n // Default Error properties:\n name: error.name,\n message: error.message,\n stack: error.stack,\n // Additional status code if available:\n status: error.response?.status,\n },\n );\n }\n },\n });\n };\n }\n\n getProviderName(): string {\n return `ocm-managed-cluster:${this.id}`;\n }\n\n async run(): Promise<void> {\n if (!this.connection) {\n throw new Error('Not initialized');\n }\n\n this.logger.info(\n `Providing OpenShift cluster resources from Open Cluster Management`,\n );\n const hubConsole = getClaim(\n await getManagedCluster(this.client, HUB_CLUSTER_NAME_IN_OCM),\n CONSOLE_CLAIM,\n );\n\n const resources: ResourceEntity[] = (\n await listManagedClusters(this.client)\n ).items.map(i => {\n const normalizedName = translateOCMToResource(\n i.metadata!.name!,\n this.hubResourceName,\n );\n\n return {\n kind: 'Resource',\n apiVersion: 'backstage.io/v1beta1',\n metadata: {\n name: normalizedName,\n annotations: {\n /**\n * Can also be pulled from ManagedClusterInfo on .spec.masterEndpoint (details in discussion: https://github.com/janus-idp/backstage-plugins/pull/94#discussion_r1093228858)\n */\n [ANNOTATION_KUBERNETES_API_SERVER]:\n i.spec?.managedClusterClientConfigs?.[0]?.url,\n [ANNOTATION_CLUSTER_ID]: i.metadata?.labels?.clusterID!,\n [ANNOTATION_LOCATION]: this.getProviderName(),\n [ANNOTATION_ORIGIN_LOCATION]: this.getProviderName(),\n [ANNOTATION_PROVIDER_ID]: this.id,\n },\n links: [\n {\n url: getClaim(i, CONSOLE_CLAIM),\n title: 'OpenShift Console',\n icon: 'dashboard',\n },\n {\n url: `${hubConsole}/multicloud/infrastructure/clusters/details/${\n i.metadata!.name\n }/`,\n title: 'OCM Console',\n },\n {\n url: `https://console.redhat.com/openshift/details/s/${\n i.metadata!.labels!.clusterID\n }`,\n title: 'OpenShift Cluster Manager',\n },\n ],\n },\n spec: {\n owner: this.owner,\n type: 'kubernetes-cluster',\n },\n };\n });\n\n await this.connection.applyMutation({\n type: 'full',\n entities: resources.map(entity => ({\n entity,\n locationKey: this.getProviderName(),\n })),\n });\n }\n}\n"],"names":["config","readOcmConfigs","hubApiClient","InputError","getClaim","getManagedCluster","HUB_CLUSTER_NAME_IN_OCM","CONSOLE_CLAIM","listManagedClusters","translateOCMToResource","ANNOTATION_KUBERNETES_API_SERVER","ANNOTATION_CLUSTER_ID","ANNOTATION_LOCATION","ANNOTATION_ORIGIN_LOCATION","ANNOTATION_PROVIDER_ID"],"mappings":";;;;;;;;;;AAwDO,MAAM,sBAAiD,CAAA;AAAA,EACzC,MAAA,CAAA;AAAA,EACA,eAAA,CAAA;AAAA,EACA,EAAA,CAAA;AAAA,EACA,KAAA,CAAA;AAAA,EACA,MAAA,CAAA;AAAA,EACF,UAAA,CAAA;AAAA,EACP,UAAA,CAAA;AAAA,EAEA,YACR,MACA,EAAA,eAAA,EACA,EACA,EAAA,IAAA,EACA,OACA,UACA,EAAA;AACA,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA,CAAA;AACd,IAAA,IAAA,CAAK,eAAkB,GAAA,eAAA,CAAA;AACvB,IAAA,IAAA,CAAK,EAAK,GAAA,EAAA,CAAA;AACV,IAAA,IAAA,CAAK,SAAS,IAAK,CAAA,MAAA,CAAA;AACnB,IAAA,IAAA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AAK,WAAW,aAAc,CAAA;AAAA,MAClC,IAAM,EAAA,MAAA;AAAA,MACN,QAAA,EAAU,SAAU,CAAA,GAAA,CAAI,CAAW,MAAA,MAAA;AAAA,QACjC,MAAA;AAAA,QACA,WAAA,EAAa,KAAK,eAAgB,EAAA;AAAA,OAClC,CAAA,CAAA;AAAA,KACH,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
4
|
+
var alpha = require('@backstage/plugin-catalog-node/alpha');
|
|
5
|
+
var ManagedClusterProvider = require('./ManagedClusterProvider.cjs.js');
|
|
6
|
+
|
|
7
|
+
const catalogModuleOCMEntityProvider = backendPluginApi.createBackendModule({
|
|
8
|
+
moduleId: "catalog-backend-module-ocm",
|
|
9
|
+
pluginId: "catalog",
|
|
10
|
+
register(env) {
|
|
11
|
+
env.registerInit({
|
|
12
|
+
deps: {
|
|
13
|
+
catalog: alpha.catalogProcessingExtensionPoint,
|
|
14
|
+
config: backendPluginApi.coreServices.rootConfig,
|
|
15
|
+
logger: backendPluginApi.coreServices.logger,
|
|
16
|
+
scheduler: backendPluginApi.coreServices.scheduler
|
|
17
|
+
},
|
|
18
|
+
async init({ catalog, config, logger, scheduler }) {
|
|
19
|
+
catalog.addEntityProvider(
|
|
20
|
+
ManagedClusterProvider.ManagedClusterProvider.fromConfig(
|
|
21
|
+
{ config, logger },
|
|
22
|
+
{
|
|
23
|
+
schedule: scheduler.createScheduledTaskRunner({
|
|
24
|
+
frequency: { hours: 1 },
|
|
25
|
+
timeout: { minutes: 15 },
|
|
26
|
+
initialDelay: { seconds: 15 }
|
|
27
|
+
}),
|
|
28
|
+
scheduler
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
exports.catalogModuleOCMEntityProvider = catalogModuleOCMEntityProvider;
|
|
38
|
+
//# sourceMappingURL=module.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.cjs.js","sources":["../../src/providers/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\n\nimport { ManagedClusterProvider } from './ManagedClusterProvider';\n\nexport const catalogModuleOCMEntityProvider = createBackendModule({\n moduleId: 'catalog-backend-module-ocm',\n pluginId: 'catalog',\n register(env) {\n env.registerInit({\n deps: {\n catalog: catalogProcessingExtensionPoint,\n config: coreServices.rootConfig,\n logger: coreServices.logger,\n scheduler: coreServices.scheduler,\n },\n async init({ catalog, config, logger, scheduler }) {\n catalog.addEntityProvider(\n ManagedClusterProvider.fromConfig(\n { config, logger },\n {\n schedule: scheduler.createScheduledTaskRunner({\n frequency: { hours: 1 },\n timeout: { minutes: 15 },\n initialDelay: { seconds: 15 },\n }),\n scheduler: scheduler,\n },\n ),\n );\n },\n });\n },\n});\n"],"names":["createBackendModule","catalogProcessingExtensionPoint","coreServices","ManagedClusterProvider"],"mappings":";;;;;;AAwBO,MAAM,iCAAiCA,oCAAoB,CAAA;AAAA,EAChE,QAAU,EAAA,4BAAA;AAAA,EACV,QAAU,EAAA,SAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,OAAS,EAAAC,qCAAA;AAAA,QACT,QAAQC,6BAAa,CAAA,UAAA;AAAA,QACrB,QAAQA,6BAAa,CAAA,MAAA;AAAA,QACrB,WAAWA,6BAAa,CAAA,SAAA;AAAA,OAC1B;AAAA,MACA,MAAM,IAAK,CAAA,EAAE,SAAS,MAAQ,EAAA,MAAA,EAAQ,WAAa,EAAA;AACjD,QAAQ,OAAA,CAAA,iBAAA;AAAA,UACNC,6CAAuB,CAAA,UAAA;AAAA,YACrB,EAAE,QAAQ,MAAO,EAAA;AAAA,YACjB;AAAA,cACE,QAAA,EAAU,UAAU,yBAA0B,CAAA;AAAA,gBAC5C,SAAA,EAAW,EAAE,KAAA,EAAO,CAAE,EAAA;AAAA,gBACtB,OAAA,EAAS,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,gBACvB,YAAA,EAAc,EAAE,OAAA,EAAS,EAAG,EAAA;AAAA,eAC7B,CAAA;AAAA,cACD,SAAA;AAAA,aACF;AAAA,WACF;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var backendOpenapiUtils = require('@backstage/backend-openapi-utils');
|
|
4
|
+
|
|
5
|
+
const spec = {
|
|
6
|
+
openapi: "3.0.0",
|
|
7
|
+
info: {
|
|
8
|
+
title: "OCM Plugin API",
|
|
9
|
+
version: "latest",
|
|
10
|
+
description: "The Open Cluster Management (OCM) plugin integrates your Backstage instance with OCM."
|
|
11
|
+
},
|
|
12
|
+
servers: [
|
|
13
|
+
{
|
|
14
|
+
url: "{protocol}://{host}:{port}/{basePath}",
|
|
15
|
+
variables: {
|
|
16
|
+
protocol: {
|
|
17
|
+
enum: ["http", "https"],
|
|
18
|
+
default: "http"
|
|
19
|
+
},
|
|
20
|
+
host: {
|
|
21
|
+
default: "localhost"
|
|
22
|
+
},
|
|
23
|
+
port: {
|
|
24
|
+
default: "7007"
|
|
25
|
+
},
|
|
26
|
+
basePath: {
|
|
27
|
+
default: "api/ocm"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
paths: {
|
|
33
|
+
"/status/{providerId}/{clusterName}": {
|
|
34
|
+
get: {
|
|
35
|
+
summary: "Get the status of a specific cluster",
|
|
36
|
+
description: "Retrieve the status of a specific cluster on a given hub.",
|
|
37
|
+
parameters: [
|
|
38
|
+
{
|
|
39
|
+
name: "providerId",
|
|
40
|
+
in: "path",
|
|
41
|
+
required: true,
|
|
42
|
+
description: "The ID of the OCM provider",
|
|
43
|
+
schema: {
|
|
44
|
+
type: "string"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "clusterName",
|
|
49
|
+
in: "path",
|
|
50
|
+
required: true,
|
|
51
|
+
description: "The name of the cluster",
|
|
52
|
+
schema: {
|
|
53
|
+
type: "string"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
responses: {
|
|
58
|
+
"200": {
|
|
59
|
+
description: "Cluster status retrieved successfully",
|
|
60
|
+
content: {
|
|
61
|
+
"application/json": {
|
|
62
|
+
schema: {
|
|
63
|
+
$ref: "#/components/schemas/Cluster"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"403": {
|
|
69
|
+
description: "Unauthorized"
|
|
70
|
+
},
|
|
71
|
+
"404": {
|
|
72
|
+
description: "Hub not found"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
security: [
|
|
76
|
+
{},
|
|
77
|
+
{
|
|
78
|
+
JWT: []
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"/status": {
|
|
84
|
+
get: {
|
|
85
|
+
summary: "Get the status of all clusters",
|
|
86
|
+
description: "Retrieve the status of all clusters across all hubs.",
|
|
87
|
+
responses: {
|
|
88
|
+
"200": {
|
|
89
|
+
description: "Clusters status retrieved successfully",
|
|
90
|
+
content: {
|
|
91
|
+
"application/json": {
|
|
92
|
+
schema: {
|
|
93
|
+
type: "array",
|
|
94
|
+
items: {
|
|
95
|
+
$ref: "#/components/schemas/ClusterOverview"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"403": {
|
|
102
|
+
description: "Unauthorized"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
security: [
|
|
106
|
+
{},
|
|
107
|
+
{
|
|
108
|
+
JWT: []
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
components: {
|
|
115
|
+
schemas: {
|
|
116
|
+
ClusterStatus: {
|
|
117
|
+
type: "object",
|
|
118
|
+
properties: {
|
|
119
|
+
available: {
|
|
120
|
+
type: "boolean",
|
|
121
|
+
description: "Indicates if the cluster is available"
|
|
122
|
+
},
|
|
123
|
+
reason: {
|
|
124
|
+
type: "string",
|
|
125
|
+
description: "Optional reason why the cluster is not available or as problems"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
required: ["available"]
|
|
129
|
+
},
|
|
130
|
+
ClusterUpdate: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
available: {
|
|
134
|
+
type: "boolean",
|
|
135
|
+
description: "Indicates if an update is available"
|
|
136
|
+
},
|
|
137
|
+
version: {
|
|
138
|
+
type: "string",
|
|
139
|
+
description: "Version of the available update"
|
|
140
|
+
},
|
|
141
|
+
url: {
|
|
142
|
+
type: "string",
|
|
143
|
+
description: "URL for the update"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
ClusterNodesStatus: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
status: {
|
|
151
|
+
type: "string",
|
|
152
|
+
description: "Status of the node"
|
|
153
|
+
},
|
|
154
|
+
type: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: "Type of the node"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
ClusterDetails: {
|
|
161
|
+
type: "object",
|
|
162
|
+
properties: {
|
|
163
|
+
consoleUrl: {
|
|
164
|
+
type: "string",
|
|
165
|
+
description: "URL for the cluster console"
|
|
166
|
+
},
|
|
167
|
+
kubernetesVersion: {
|
|
168
|
+
type: "string",
|
|
169
|
+
description: "Version of Kubernetes"
|
|
170
|
+
},
|
|
171
|
+
oauthUrl: {
|
|
172
|
+
type: "string",
|
|
173
|
+
description: "OAuth URL for the cluster"
|
|
174
|
+
},
|
|
175
|
+
openshiftId: {
|
|
176
|
+
type: "string",
|
|
177
|
+
description: "ID of the OpenShift cluster"
|
|
178
|
+
},
|
|
179
|
+
openshiftVersion: {
|
|
180
|
+
type: "string",
|
|
181
|
+
description: "Version of OpenShift running in the cluster"
|
|
182
|
+
},
|
|
183
|
+
platform: {
|
|
184
|
+
type: "string",
|
|
185
|
+
description: "Platform of the cluster"
|
|
186
|
+
},
|
|
187
|
+
region: {
|
|
188
|
+
type: "string",
|
|
189
|
+
description: "Region where the cluster is located"
|
|
190
|
+
},
|
|
191
|
+
allocatableResources: {
|
|
192
|
+
type: "object",
|
|
193
|
+
description: "Resources that are allocatable in the cluster",
|
|
194
|
+
properties: {
|
|
195
|
+
cpuCores: {
|
|
196
|
+
type: "number",
|
|
197
|
+
description: "Number of CPU cores allocatable"
|
|
198
|
+
},
|
|
199
|
+
memorySize: {
|
|
200
|
+
type: "string",
|
|
201
|
+
description: "Size of allocatable memory"
|
|
202
|
+
},
|
|
203
|
+
numberOfPods: {
|
|
204
|
+
type: "number",
|
|
205
|
+
description: "Number of allocatable pods"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
availableResources: {
|
|
210
|
+
type: "object",
|
|
211
|
+
description: "Resources that are available in the cluster",
|
|
212
|
+
properties: {
|
|
213
|
+
cpuCores: {
|
|
214
|
+
type: "number",
|
|
215
|
+
description: "Number of CPU cores available"
|
|
216
|
+
},
|
|
217
|
+
memorySize: {
|
|
218
|
+
type: "string",
|
|
219
|
+
description: "Size of available memory"
|
|
220
|
+
},
|
|
221
|
+
numberOfPods: {
|
|
222
|
+
type: "number",
|
|
223
|
+
description: "Number of available pods"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
update: {
|
|
228
|
+
$ref: "#/components/schemas/ClusterUpdate"
|
|
229
|
+
},
|
|
230
|
+
status: {
|
|
231
|
+
$ref: "#/components/schemas/ClusterStatus"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
Cluster: {
|
|
236
|
+
allOf: [
|
|
237
|
+
{
|
|
238
|
+
$ref: "#/components/schemas/ClusterBase"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
$ref: "#/components/schemas/ClusterDetails"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
ClusterBase: {
|
|
246
|
+
type: "object",
|
|
247
|
+
properties: {
|
|
248
|
+
name: {
|
|
249
|
+
type: "string",
|
|
250
|
+
description: "The name of the cluster"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
ClusterOverview: {
|
|
255
|
+
allOf: [
|
|
256
|
+
{
|
|
257
|
+
$ref: "#/components/schemas/ClusterBase"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
type: "object",
|
|
261
|
+
properties: {
|
|
262
|
+
status: {
|
|
263
|
+
$ref: "#/components/schemas/ClusterStatus"
|
|
264
|
+
},
|
|
265
|
+
update: {
|
|
266
|
+
$ref: "#/components/schemas/ClusterUpdate"
|
|
267
|
+
},
|
|
268
|
+
platform: {
|
|
269
|
+
type: "string",
|
|
270
|
+
description: "Platform of the cluster"
|
|
271
|
+
},
|
|
272
|
+
openshiftVersion: {
|
|
273
|
+
type: "string",
|
|
274
|
+
description: "Version of OpenShift running in the cluster"
|
|
275
|
+
},
|
|
276
|
+
nodes: {
|
|
277
|
+
type: "array",
|
|
278
|
+
items: {
|
|
279
|
+
$ref: "#/components/schemas/ClusterNodesStatus"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
securitySchemes: {
|
|
288
|
+
JWT: {
|
|
289
|
+
type: "http",
|
|
290
|
+
scheme: "bearer",
|
|
291
|
+
bearerFormat: "JWT",
|
|
292
|
+
description: "Backstage Permissions Framework JWT"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
const createOpenApiRouter = async (options) => backendOpenapiUtils.createValidatedOpenApiRouter(spec, options);
|
|
298
|
+
|
|
299
|
+
exports.createOpenApiRouter = createOpenApiRouter;
|
|
300
|
+
exports.spec = spec;
|
|
301
|
+
//# sourceMappingURL=openapi.generated.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.generated.cjs.js","sources":["../../src/schema/openapi.generated.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\nimport { createValidatedOpenApiRouter } from '@backstage/backend-openapi-utils';\n\nexport const spec = {\n openapi: '3.0.0',\n info: {\n title: 'OCM Plugin API',\n version: 'latest',\n description:\n 'The Open Cluster Management (OCM) plugin integrates your Backstage instance with OCM.',\n },\n servers: [\n {\n url: '{protocol}://{host}:{port}/{basePath}',\n variables: {\n protocol: {\n enum: ['http', 'https'],\n default: 'http',\n },\n host: {\n default: 'localhost',\n },\n port: {\n default: '7007',\n },\n basePath: {\n default: 'api/ocm',\n },\n },\n },\n ],\n paths: {\n '/status/{providerId}/{clusterName}': {\n get: {\n summary: 'Get the status of a specific cluster',\n description:\n 'Retrieve the status of a specific cluster on a given hub.',\n parameters: [\n {\n name: 'providerId',\n in: 'path',\n required: true,\n description: 'The ID of the OCM provider',\n schema: {\n type: 'string',\n },\n },\n {\n name: 'clusterName',\n in: 'path',\n required: true,\n description: 'The name of the cluster',\n schema: {\n type: 'string',\n },\n },\n ],\n responses: {\n '200': {\n description: 'Cluster status retrieved successfully',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Cluster',\n },\n },\n },\n },\n '403': {\n description: 'Unauthorized',\n },\n '404': {\n description: 'Hub not found',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/status': {\n get: {\n summary: 'Get the status of all clusters',\n description: 'Retrieve the status of all clusters across all hubs.',\n responses: {\n '200': {\n description: 'Clusters status retrieved successfully',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/ClusterOverview',\n },\n },\n },\n },\n },\n '403': {\n description: 'Unauthorized',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n },\n components: {\n schemas: {\n ClusterStatus: {\n type: 'object',\n properties: {\n available: {\n type: 'boolean',\n description: 'Indicates if the cluster is available',\n },\n reason: {\n type: 'string',\n description:\n 'Optional reason why the cluster is not available or as problems',\n },\n },\n required: ['available'],\n },\n ClusterUpdate: {\n type: 'object',\n properties: {\n available: {\n type: 'boolean',\n description: 'Indicates if an update is available',\n },\n version: {\n type: 'string',\n description: 'Version of the available update',\n },\n url: {\n type: 'string',\n description: 'URL for the update',\n },\n },\n },\n ClusterNodesStatus: {\n type: 'object',\n properties: {\n status: {\n type: 'string',\n description: 'Status of the node',\n },\n type: {\n type: 'string',\n description: 'Type of the node',\n },\n },\n },\n ClusterDetails: {\n type: 'object',\n properties: {\n consoleUrl: {\n type: 'string',\n description: 'URL for the cluster console',\n },\n kubernetesVersion: {\n type: 'string',\n description: 'Version of Kubernetes',\n },\n oauthUrl: {\n type: 'string',\n description: 'OAuth URL for the cluster',\n },\n openshiftId: {\n type: 'string',\n description: 'ID of the OpenShift cluster',\n },\n openshiftVersion: {\n type: 'string',\n description: 'Version of OpenShift running in the cluster',\n },\n platform: {\n type: 'string',\n description: 'Platform of the cluster',\n },\n region: {\n type: 'string',\n description: 'Region where the cluster is located',\n },\n allocatableResources: {\n type: 'object',\n description: 'Resources that are allocatable in the cluster',\n properties: {\n cpuCores: {\n type: 'number',\n description: 'Number of CPU cores allocatable',\n },\n memorySize: {\n type: 'string',\n description: 'Size of allocatable memory',\n },\n numberOfPods: {\n type: 'number',\n description: 'Number of allocatable pods',\n },\n },\n },\n availableResources: {\n type: 'object',\n description: 'Resources that are available in the cluster',\n properties: {\n cpuCores: {\n type: 'number',\n description: 'Number of CPU cores available',\n },\n memorySize: {\n type: 'string',\n description: 'Size of available memory',\n },\n numberOfPods: {\n type: 'number',\n description: 'Number of available pods',\n },\n },\n },\n update: {\n $ref: '#/components/schemas/ClusterUpdate',\n },\n status: {\n $ref: '#/components/schemas/ClusterStatus',\n },\n },\n },\n Cluster: {\n allOf: [\n {\n $ref: '#/components/schemas/ClusterBase',\n },\n {\n $ref: '#/components/schemas/ClusterDetails',\n },\n ],\n },\n ClusterBase: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description: 'The name of the cluster',\n },\n },\n },\n ClusterOverview: {\n allOf: [\n {\n $ref: '#/components/schemas/ClusterBase',\n },\n {\n type: 'object',\n properties: {\n status: {\n $ref: '#/components/schemas/ClusterStatus',\n },\n update: {\n $ref: '#/components/schemas/ClusterUpdate',\n },\n platform: {\n type: 'string',\n description: 'Platform of the cluster',\n },\n openshiftVersion: {\n type: 'string',\n description: 'Version of OpenShift running in the cluster',\n },\n nodes: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/ClusterNodesStatus',\n },\n },\n },\n },\n ],\n },\n },\n securitySchemes: {\n JWT: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n description: 'Backstage Permissions Framework JWT',\n },\n },\n },\n} as const;\nexport const createOpenApiRouter = async (\n options?: Parameters<typeof createValidatedOpenApiRouter>['1'],\n) => createValidatedOpenApiRouter<typeof spec>(spec, options);\n"],"names":["createValidatedOpenApiRouter"],"mappings":";;;;AAqBO,MAAM,IAAO,GAAA;AAAA,EAClB,OAAS,EAAA,OAAA;AAAA,EACT,IAAM,EAAA;AAAA,IACJ,KAAO,EAAA,gBAAA;AAAA,IACP,OAAS,EAAA,QAAA;AAAA,IACT,WACE,EAAA,uFAAA;AAAA,GACJ;AAAA,EACA,OAAS,EAAA;AAAA,IACP;AAAA,MACE,GAAK,EAAA,uCAAA;AAAA,MACL,SAAW,EAAA;AAAA,QACT,QAAU,EAAA;AAAA,UACR,IAAA,EAAM,CAAC,MAAA,EAAQ,OAAO,CAAA;AAAA,UACtB,OAAS,EAAA,MAAA;AAAA,SACX;AAAA,QACA,IAAM,EAAA;AAAA,UACJ,OAAS,EAAA,WAAA;AAAA,SACX;AAAA,QACA,IAAM,EAAA;AAAA,UACJ,OAAS,EAAA,MAAA;AAAA,SACX;AAAA,QACA,QAAU,EAAA;AAAA,UACR,OAAS,EAAA,SAAA;AAAA,SACX;AAAA,OACF;AAAA,KACF;AAAA,GACF;AAAA,EACA,KAAO,EAAA;AAAA,IACL,oCAAsC,EAAA;AAAA,MACpC,GAAK,EAAA;AAAA,QACH,OAAS,EAAA,sCAAA;AAAA,QACT,WACE,EAAA,2DAAA;AAAA,QACF,UAAY,EAAA;AAAA,UACV;AAAA,YAC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AAA;AAAA,gBACN,WAAa,EAAA,yBAAA;AAAA,eACf;AAAA,cACA,gBAAkB,EAAA;AAAA,gBAChB,IAAM,EAAA,QAAA;AAAA,gBACN,WAAa,EAAA,6CAAA;AAAA,eACf;AAAA,cACA,KAAO,EAAA;AAAA,gBACL,IAAM,EAAA,OAAA;AAAA,gBACN,KAAO,EAAA;AAAA,kBACL,IAAM,EAAA,yCAAA;AAAA,iBACR;AAAA,eACF;AAAA,aACF;AAAA,WACF;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAAA,IACA,eAAiB,EAAA;AAAA,MACf,GAAK,EAAA;AAAA,QACH,IAAM,EAAA,MAAA;AAAA,QACN,MAAQ,EAAA,QAAA;AAAA,QACR,YAAc,EAAA,KAAA;AAAA,QACd,WAAa,EAAA,qCAAA;AAAA,OACf;AAAA,KACF;AAAA,GACF;AACF,EAAA;AACO,MAAM,mBAAsB,GAAA,OACjC,OACG,KAAAA,gDAAA,CAA0C,MAAM,OAAO;;;;;"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var rootHttpRouter = require('@backstage/backend-defaults/rootHttpRouter');
|
|
4
|
+
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
5
|
+
var errors = require('@backstage/errors');
|
|
6
|
+
var pluginPermissionCommon = require('@backstage/plugin-permission-common');
|
|
7
|
+
var pluginPermissionNode = require('@backstage/plugin-permission-node');
|
|
8
|
+
var express = require('express');
|
|
9
|
+
var pluginOcmCommon = require('@backstage-community/plugin-ocm-common');
|
|
10
|
+
var config = require('../helpers/config.cjs.js');
|
|
11
|
+
var kubernetes = require('../helpers/kubernetes.cjs.js');
|
|
12
|
+
var parser = require('../helpers/parser.cjs.js');
|
|
13
|
+
var openapi_generated = require('../schema/openapi.generated.cjs.js');
|
|
14
|
+
|
|
15
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
16
|
+
|
|
17
|
+
var express__default = /*#__PURE__*/_interopDefaultCompat(express);
|
|
18
|
+
|
|
19
|
+
async function createRouter(deps) {
|
|
20
|
+
const { config: config$1, logger, httpAuth, permissions } = deps;
|
|
21
|
+
const router = await openapi_generated.createOpenApiRouter();
|
|
22
|
+
const permissionsIntegrationRouter = pluginPermissionNode.createPermissionIntegrationRouter({
|
|
23
|
+
permissions: pluginOcmCommon.ocmEntityPermissions
|
|
24
|
+
});
|
|
25
|
+
router.use(express__default.default.json());
|
|
26
|
+
router.use(permissionsIntegrationRouter);
|
|
27
|
+
const clients = Object.fromEntries(
|
|
28
|
+
config.readOcmConfigs(config$1).map((provider) => [
|
|
29
|
+
provider.id,
|
|
30
|
+
{
|
|
31
|
+
client: kubernetes.hubApiClient(provider, logger),
|
|
32
|
+
hubResourceName: provider.hubResourceName
|
|
33
|
+
}
|
|
34
|
+
])
|
|
35
|
+
);
|
|
36
|
+
const authorize = async (request, permission) => {
|
|
37
|
+
const decision = (await permissions.authorize([{ permission }], {
|
|
38
|
+
credentials: await httpAuth.credentials(request)
|
|
39
|
+
}))[0];
|
|
40
|
+
return decision;
|
|
41
|
+
};
|
|
42
|
+
router.get("/status/:providerId/:clusterName", async (request, response) => {
|
|
43
|
+
const decision = await authorize(request, pluginOcmCommon.ocmEntityReadPermission);
|
|
44
|
+
if (decision.result === pluginPermissionCommon.AuthorizeResult.DENY) {
|
|
45
|
+
throw new errors.NotAllowedError("Unauthorized");
|
|
46
|
+
}
|
|
47
|
+
const { clusterName, providerId } = request.params;
|
|
48
|
+
logger.debug(
|
|
49
|
+
`Incoming status request for ${clusterName} cluster on ${providerId} hub`
|
|
50
|
+
);
|
|
51
|
+
if (!clients.hasOwnProperty(providerId)) {
|
|
52
|
+
throw Object.assign(new Error("Hub not found"), {
|
|
53
|
+
statusCode: 404,
|
|
54
|
+
name: "HubNotFound"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const normalizedClusterName = parser.translateResourceToOCM(
|
|
58
|
+
clusterName,
|
|
59
|
+
clients[providerId].hubResourceName
|
|
60
|
+
);
|
|
61
|
+
const mc = await kubernetes.getManagedCluster(
|
|
62
|
+
clients[providerId].client,
|
|
63
|
+
normalizedClusterName
|
|
64
|
+
);
|
|
65
|
+
const mci = await kubernetes.getManagedClusterInfo(
|
|
66
|
+
clients[providerId].client,
|
|
67
|
+
normalizedClusterName
|
|
68
|
+
);
|
|
69
|
+
response.send({
|
|
70
|
+
name: clusterName,
|
|
71
|
+
...parser.parseManagedCluster(mc),
|
|
72
|
+
...parser.parseUpdateInfo(mci)
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
router.get("/status", async (request, response) => {
|
|
76
|
+
const decision = await authorize(request, pluginOcmCommon.ocmClusterReadPermission);
|
|
77
|
+
if (decision.result === pluginPermissionCommon.AuthorizeResult.DENY) {
|
|
78
|
+
throw new errors.NotAllowedError("Unauthorized");
|
|
79
|
+
}
|
|
80
|
+
logger.debug(`Incoming status request for all clusters`);
|
|
81
|
+
const allClusters = await Promise.all(
|
|
82
|
+
Object.values(clients).map(async (c) => {
|
|
83
|
+
const mcs = await kubernetes.listManagedClusters(c.client);
|
|
84
|
+
const mcis = await kubernetes.listManagedClusterInfos(c.client);
|
|
85
|
+
return mcs.items.map((mc) => {
|
|
86
|
+
const mci = mcis.items.find(
|
|
87
|
+
(info) => info.metadata?.name === mc.metadata.name
|
|
88
|
+
) || {};
|
|
89
|
+
return {
|
|
90
|
+
name: parser.translateOCMToResource(mc.metadata.name, c.hubResourceName),
|
|
91
|
+
status: parser.parseClusterStatus(mc),
|
|
92
|
+
platform: parser.getClaim(mc, "platform.open-cluster-management.io"),
|
|
93
|
+
openshiftVersion: mc.metadata.labels?.openshiftVersion ?? parser.getClaim(mc, "version.openshift.io"),
|
|
94
|
+
nodes: parser.parseNodeStatus(mci),
|
|
95
|
+
...parser.parseUpdateInfo(mci)
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
return response.send(allClusters.flat());
|
|
101
|
+
});
|
|
102
|
+
const middleware = rootHttpRouter.MiddlewareFactory.create({ logger, config: config$1 });
|
|
103
|
+
router.use(middleware.error());
|
|
104
|
+
return router;
|
|
105
|
+
}
|
|
106
|
+
const ocmPlugin = backendPluginApi.createBackendPlugin({
|
|
107
|
+
pluginId: "ocm",
|
|
108
|
+
register(env) {
|
|
109
|
+
env.registerInit({
|
|
110
|
+
deps: {
|
|
111
|
+
logger: backendPluginApi.coreServices.logger,
|
|
112
|
+
config: backendPluginApi.coreServices.rootConfig,
|
|
113
|
+
http: backendPluginApi.coreServices.httpRouter,
|
|
114
|
+
httpAuth: backendPluginApi.coreServices.httpAuth,
|
|
115
|
+
permissions: backendPluginApi.coreServices.permissions
|
|
116
|
+
},
|
|
117
|
+
async init({ config, logger, http, httpAuth, permissions }) {
|
|
118
|
+
http.use(await createRouter({ config, logger, httpAuth, permissions }));
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
exports.ocmPlugin = ocmPlugin;
|
|
125
|
+
//# sourceMappingURL=router.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.cjs.js","sources":["../../src/service/router.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MiddlewareFactory } from '@backstage/backend-defaults/rootHttpRouter';\nimport {\n coreServices,\n createBackendPlugin,\n HttpAuthService,\n LoggerService,\n PermissionsService,\n} from '@backstage/backend-plugin-api';\nimport type { Config } from '@backstage/config';\nimport { NotAllowedError } from '@backstage/errors';\nimport {\n AuthorizeResult,\n BasicPermission,\n} from '@backstage/plugin-permission-common';\nimport { createPermissionIntegrationRouter } from '@backstage/plugin-permission-node';\n\nimport express, { Request } from 'express';\n\nimport {\n Cluster,\n ClusterOverview,\n ocmClusterReadPermission,\n ocmEntityPermissions,\n ocmEntityReadPermission,\n} from '@backstage-community/plugin-ocm-common';\n\nimport { readOcmConfigs } from '../helpers/config';\nimport {\n getManagedCluster,\n getManagedClusterInfo,\n hubApiClient,\n listManagedClusterInfos,\n listManagedClusters,\n} from '../helpers/kubernetes';\nimport {\n getClaim,\n parseClusterStatus,\n parseManagedCluster,\n parseNodeStatus,\n parseUpdateInfo,\n translateOCMToResource,\n translateResourceToOCM,\n} from '../helpers/parser';\nimport { createOpenApiRouter } from '../schema/openapi.generated';\nimport { ManagedClusterInfo } from '../types';\n\nasync function createRouter(deps: {\n config: Config;\n logger: LoggerService;\n httpAuth: HttpAuthService;\n permissions: PermissionsService;\n}) {\n const { config, logger, httpAuth, permissions } = deps;\n const router = await createOpenApiRouter();\n\n const permissionsIntegrationRouter = createPermissionIntegrationRouter({\n permissions: ocmEntityPermissions,\n });\n\n router.use(express.json());\n router.use(permissionsIntegrationRouter);\n\n const clients = Object.fromEntries(\n readOcmConfigs(config).map(provider => [\n provider.id,\n {\n client: hubApiClient(provider, logger),\n hubResourceName: provider.hubResourceName,\n },\n ]),\n );\n\n const authorize = async (request: Request, permission: BasicPermission) => {\n const decision = (\n await permissions.authorize([{ permission: permission }], {\n credentials: await httpAuth.credentials(request),\n })\n )[0];\n\n return decision;\n };\n\n router.get('/status/:providerId/:clusterName', async (request, response) => {\n const decision = await authorize(request, ocmEntityReadPermission);\n\n if (decision.result === AuthorizeResult.DENY) {\n throw new NotAllowedError('Unauthorized');\n }\n\n const { clusterName, providerId } = request.params;\n logger.debug(\n `Incoming status request for ${clusterName} cluster on ${providerId} hub`,\n );\n\n if (!clients.hasOwnProperty(providerId)) {\n throw Object.assign(new Error('Hub not found'), {\n statusCode: 404,\n name: 'HubNotFound',\n });\n }\n\n const normalizedClusterName = translateResourceToOCM(\n clusterName,\n clients[providerId].hubResourceName,\n );\n\n const mc = await getManagedCluster(\n clients[providerId].client,\n normalizedClusterName,\n );\n const mci = await getManagedClusterInfo(\n clients[providerId].client,\n normalizedClusterName,\n );\n\n response.send({\n name: clusterName,\n ...parseManagedCluster(mc),\n ...parseUpdateInfo(mci),\n } as Cluster);\n });\n\n router.get('/status', async (request, response) => {\n const decision = await authorize(request, ocmClusterReadPermission);\n\n if (decision.result === AuthorizeResult.DENY) {\n throw new NotAllowedError('Unauthorized');\n }\n\n logger.debug(`Incoming status request for all clusters`);\n\n const allClusters = await Promise.all(\n Object.values(clients).map(async c => {\n const mcs = await listManagedClusters(c.client);\n const mcis = await listManagedClusterInfos(c.client);\n\n return mcs.items.map(mc => {\n const mci =\n mcis.items.find(\n info => info.metadata?.name === mc.metadata!.name,\n ) || ({} as ManagedClusterInfo);\n\n return {\n name: translateOCMToResource(mc.metadata!.name!, c.hubResourceName),\n status: parseClusterStatus(mc),\n platform: getClaim(mc, 'platform.open-cluster-management.io'),\n openshiftVersion:\n mc.metadata!.labels?.openshiftVersion ??\n getClaim(mc, 'version.openshift.io'),\n nodes: parseNodeStatus(mci),\n ...parseUpdateInfo(mci),\n } as ClusterOverview;\n });\n }),\n );\n\n return response.send(allClusters.flat());\n });\n\n const middleware = MiddlewareFactory.create({ logger, config });\n\n router.use(middleware.error());\n return router;\n}\n\nexport const ocmPlugin = createBackendPlugin({\n pluginId: 'ocm',\n register(env) {\n env.registerInit({\n deps: {\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n http: coreServices.httpRouter,\n httpAuth: coreServices.httpAuth,\n permissions: coreServices.permissions,\n },\n async init({ config, logger, http, httpAuth, permissions }) {\n http.use(await createRouter({ config, logger, httpAuth, permissions }));\n },\n });\n },\n});\n"],"names":["config","createOpenApiRouter","createPermissionIntegrationRouter","ocmEntityPermissions","express","readOcmConfigs","hubApiClient","ocmEntityReadPermission","AuthorizeResult","NotAllowedError","translateResourceToOCM","getManagedCluster","getManagedClusterInfo","parseManagedCluster","parseUpdateInfo","ocmClusterReadPermission","listManagedClusters","listManagedClusterInfos","translateOCMToResource","parseClusterStatus","getClaim","parseNodeStatus","MiddlewareFactory","createBackendPlugin","coreServices"],"mappings":";;;;;;;;;;;;;;;;;;AA8DA,eAAe,aAAa,IAKzB,EAAA;AACD,EAAA,MAAM,UAAEA,QAAA,EAAQ,MAAQ,EAAA,QAAA,EAAU,aAAgB,GAAA,IAAA,CAAA;AAClD,EAAM,MAAA,MAAA,GAAS,MAAMC,qCAAoB,EAAA,CAAA;AAEzC,EAAA,MAAM,+BAA+BC,sDAAkC,CAAA;AAAA,IACrE,WAAa,EAAAC,oCAAA;AAAA,GACd,CAAA,CAAA;AAED,EAAO,MAAA,CAAA,GAAA,CAAIC,wBAAQ,CAAA,IAAA,EAAM,CAAA,CAAA;AACzB,EAAA,MAAA,CAAO,IAAI,4BAA4B,CAAA,CAAA;AAEvC,EAAA,MAAM,UAAU,MAAO,CAAA,WAAA;AAAA,IACrBC,qBAAe,CAAAL,QAAM,CAAE,CAAA,GAAA,CAAI,CAAY,QAAA,KAAA;AAAA,MACrC,QAAS,CAAA,EAAA;AAAA,MACT;AAAA,QACE,MAAA,EAAQM,uBAAa,CAAA,QAAA,EAAU,MAAM,CAAA;AAAA,QACrC,iBAAiB,QAAS,CAAA,eAAA;AAAA,OAC5B;AAAA,KACD,CAAA;AAAA,GACH,CAAA;AAEA,EAAM,MAAA,SAAA,GAAY,OAAO,OAAA,EAAkB,UAAgC,KAAA;AACzE,IAAM,MAAA,QAAA,GAAA,CACJ,MAAM,WAAY,CAAA,SAAA,CAAU,CAAC,EAAE,UAAA,EAAwB,CAAG,EAAA;AAAA,MACxD,WAAa,EAAA,MAAM,QAAS,CAAA,WAAA,CAAY,OAAO,CAAA;AAAA,KAChD,GACD,CAAC,CAAA,CAAA;AAEH,IAA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@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@backstage-community/plugin-ocm-backend",
|
|
3
|
+
"version": "5.2.1",
|
|
4
|
+
"main": "./dist/index.cjs.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"backstage": {
|
|
11
|
+
"role": "backend-plugin",
|
|
12
|
+
"supported-versions": "1.32.4",
|
|
13
|
+
"pluginId": "ocm",
|
|
14
|
+
"pluginPackages": [
|
|
15
|
+
"@backstage-community/plugin-ocm",
|
|
16
|
+
"@backstage-community/plugin-ocm-backend",
|
|
17
|
+
"@backstage-community/plugin-ocm-common"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"backstage": "@backstage/BackendFeature",
|
|
23
|
+
"require": "./dist/index.cjs.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.cjs.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "backstage-cli package build",
|
|
31
|
+
"clean": "backstage-cli package clean",
|
|
32
|
+
"lint:check": "backstage-cli package lint",
|
|
33
|
+
"lint:fix": "backstage-cli package lint --fix",
|
|
34
|
+
"postpack": "backstage-cli package postpack",
|
|
35
|
+
"prepack": "backstage-cli package prepack",
|
|
36
|
+
"start": "backstage-cli package start",
|
|
37
|
+
"test": "backstage-cli package test --passWithNoTests --coverage",
|
|
38
|
+
"tsc": "tsc",
|
|
39
|
+
"prettier:check": "prettier --ignore-unknown --check .",
|
|
40
|
+
"prettier:fix": "prettier --ignore-unknown --write .",
|
|
41
|
+
"build:api-docs": "./scripts/openapi-doc.sh",
|
|
42
|
+
"build:api-server": "yarn backstage-repo-tools package schema openapi generate --server"
|
|
43
|
+
},
|
|
44
|
+
"configSchema": "config.d.ts",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@backstage-community/plugin-ocm-common": "^3.6.1",
|
|
47
|
+
"@backstage/backend-defaults": "^0.5.2",
|
|
48
|
+
"@backstage/backend-openapi-utils": "^0.2.0",
|
|
49
|
+
"@backstage/backend-plugin-api": "^1.0.1",
|
|
50
|
+
"@backstage/catalog-model": "^1.7.0",
|
|
51
|
+
"@backstage/errors": "^1.2.4",
|
|
52
|
+
"@backstage/plugin-catalog-node": "^1.13.1",
|
|
53
|
+
"@backstage/plugin-permission-common": "^0.8.1",
|
|
54
|
+
"@backstage/plugin-permission-node": "^0.8.4",
|
|
55
|
+
"@kubernetes/client-node": "^0.22.1",
|
|
56
|
+
"express": "^4.18.2",
|
|
57
|
+
"semver": "^7.5.4"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@backstage/backend-dynamic-feature-service": "0.4.3",
|
|
61
|
+
"@backstage/backend-test-utils": "1.0.2",
|
|
62
|
+
"@backstage/cli": "0.28.2",
|
|
63
|
+
"@backstage/config": "1.2.0",
|
|
64
|
+
"@backstage/plugin-catalog-backend": "1.27.1",
|
|
65
|
+
"@openapitools/openapi-generator-cli": "2.13.4",
|
|
66
|
+
"@spotify/prettier-config": "^15.0.0",
|
|
67
|
+
"@types/express": "4.17.21",
|
|
68
|
+
"@types/supertest": "2.0.16",
|
|
69
|
+
"msw": "1.3.3",
|
|
70
|
+
"prettier": "3.3.3",
|
|
71
|
+
"supertest": "6.3.4"
|
|
72
|
+
},
|
|
73
|
+
"files": [
|
|
74
|
+
"dist",
|
|
75
|
+
"config.d.ts"
|
|
76
|
+
],
|
|
77
|
+
"repository": {
|
|
78
|
+
"type": "git",
|
|
79
|
+
"url": "https://github.com/backstage/community-plugins",
|
|
80
|
+
"directory": "workspaces/ocm/plugins/ocm-backend"
|
|
81
|
+
},
|
|
82
|
+
"keywords": [
|
|
83
|
+
"support:production",
|
|
84
|
+
"lifecycle:active",
|
|
85
|
+
"backstage",
|
|
86
|
+
"plugin"
|
|
87
|
+
],
|
|
88
|
+
"homepage": "https://red.ht/rhdh",
|
|
89
|
+
"bugs": "https://github.com/backstage/community-plugins/issues",
|
|
90
|
+
"maintainers": [
|
|
91
|
+
"@04kash"
|
|
92
|
+
],
|
|
93
|
+
"author": "Red Hat"
|
|
94
|
+
}
|