@platform-mesh/portal-server-lib 0.5.44 → 0.5.46
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/dist/portal-options/auth-config-provider.d.ts +5 -3
- package/dist/portal-options/auth-config-provider.js +29 -11
- package/dist/portal-options/auth-config-provider.js.map +1 -1
- package/dist/portal-options/models/k8s.d.ts +25 -0
- package/dist/portal-options/models/k8s.js +2 -0
- package/dist/portal-options/models/k8s.js.map +1 -0
- package/dist/portal-options/service-providers/kubernetes-service-providers.service.d.ts +1 -1
- package/dist/portal-options/service-providers/kubernetes-service-providers.service.js +15 -32
- package/dist/portal-options/service-providers/kubernetes-service-providers.service.js.map +1 -1
- package/dist/portal-options/services/kcp-k8s.service.d.ts +18 -5
- package/dist/portal-options/services/kcp-k8s.service.js +106 -11
- package/dist/portal-options/services/kcp-k8s.service.js.map +1 -1
- package/package.json +1 -1
- package/src/portal-options/auth-config-provider.spec.ts +480 -58
- package/src/portal-options/auth-config-provider.ts +41 -12
- package/src/portal-options/models/k8s.ts +27 -0
- package/src/portal-options/pm-portal-context.service.spec.ts +4 -0
- package/src/portal-options/service-providers/kubernetes-service-providers.service.spec.ts +500 -203
- package/src/portal-options/service-providers/kubernetes-service-providers.service.ts +30 -40
- package/src/portal-options/services/kcp-k8s.service.spec.ts +502 -89
- package/src/portal-options/services/kcp-k8s.service.ts +147 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { K8sRequestContext, K8sResourceDescriptor } from '../models/k8s.js';
|
|
1
2
|
import { KcpKubernetesService } from '../services/kcp-k8s.service.js';
|
|
2
3
|
import { processContentConfigurationForAccountHierarchy } from '../utils/account-hierarchy-resolver.js';
|
|
3
4
|
import { welcomeNodeConfig } from './models/welcome-node-config.js';
|
|
4
|
-
import { PromiseMiddlewareWrapper } from '@kubernetes/client-node/dist/gen/middleware.js';
|
|
5
5
|
import { Injectable } from '@nestjs/common';
|
|
6
6
|
import {
|
|
7
7
|
ContentConfiguration,
|
|
@@ -31,20 +31,11 @@ export class KubernetesServiceProvidersService implements ServiceProviderService
|
|
|
31
31
|
throw new Error('Context with organization is required');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.error(error);
|
|
41
|
-
|
|
42
|
-
if (error.code == 429 || error.statusCode == 429) {
|
|
43
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
44
|
-
console.log('Retry after 1 second reading kubernetes resources.');
|
|
45
|
-
response = await this.getKubernetesResources(entity, context, token);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
34
|
+
const response = await this.listContentConfigurationsForEntity(
|
|
35
|
+
token,
|
|
36
|
+
entities,
|
|
37
|
+
context as K8sRequestContext,
|
|
38
|
+
);
|
|
48
39
|
|
|
49
40
|
if (!response.items) {
|
|
50
41
|
return {
|
|
@@ -86,40 +77,39 @@ export class KubernetesServiceProvidersService implements ServiceProviderService
|
|
|
86
77
|
};
|
|
87
78
|
}
|
|
88
79
|
|
|
89
|
-
private async
|
|
90
|
-
entity: string,
|
|
91
|
-
requestContext: Record<string, any>,
|
|
80
|
+
private async listContentConfigurationsForEntity(
|
|
92
81
|
token: string,
|
|
82
|
+
entities: string[],
|
|
83
|
+
context: K8sRequestContext,
|
|
93
84
|
) {
|
|
94
|
-
const
|
|
85
|
+
const entity = !entities || !entities.length ? 'main' : entities[0];
|
|
86
|
+
const gvr: K8sResourceDescriptor = {
|
|
95
87
|
group: 'ui.platform-mesh.io',
|
|
96
88
|
version: 'v1alpha1',
|
|
97
89
|
plural: 'contentconfigurations',
|
|
98
90
|
labelSelector: `ui.platform-mesh.io/entity=${entity}`,
|
|
99
91
|
};
|
|
100
92
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
93
|
+
try {
|
|
94
|
+
return await this.kcpKubernetesService.listClusterCustomObjectInKcpVirtualWorkspace(
|
|
95
|
+
gvr,
|
|
96
|
+
context,
|
|
97
|
+
token,
|
|
98
|
+
);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error(error);
|
|
109
101
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
102
|
+
if (error.code == 429 || error.statusCode == 429) {
|
|
103
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
104
|
+
console.log('Retry after 1 second reading kubernetes resources.');
|
|
105
|
+
return await this.kcpKubernetesService.listClusterCustomObjectInKcpVirtualWorkspace(
|
|
106
|
+
gvr,
|
|
107
|
+
context,
|
|
108
|
+
token,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
115
112
|
|
|
116
|
-
|
|
117
|
-
context.setHeaderParam('Authorization', `Bearer ${token}`);
|
|
118
|
-
return context;
|
|
119
|
-
},
|
|
120
|
-
post: async (context) => context,
|
|
121
|
-
}),
|
|
122
|
-
],
|
|
123
|
-
});
|
|
113
|
+
return {};
|
|
124
114
|
}
|
|
125
115
|
}
|