Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubernetes client package upgrade #3323

Merged
Merged
Show file tree
Hide file tree
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
6,749 changes: 4,273 additions & 2,476 deletions backend/package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@fastify/sensible": "^5.2.0",
"@fastify/static": "^6.10.2",
"@fastify/websocket": "^8.3.1",
"@kubernetes/client-node": "^0.12.2",
"@kubernetes/client-node": "^0.22.0",
"dotenv": "^8.2.0",
"fastify": "^4.28.1",
"fastify-plugin": "^4.5.1",
Expand Down Expand Up @@ -85,6 +85,7 @@
"overrides": {
"tough-cookie": "^4.1.3",
"ws": "^8.17.1",
"@types/tar": "^6.1.13"
"@types/tar": "^6.1.13",
"jsonpath-plus": "^10.0.0"
}
}
6 changes: 3 additions & 3 deletions backend/src/plugins/kube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const currentContext = kc.getCurrentContext();
const customObjectsApi = kc.makeApiClient(k8s.CustomObjectsApi);
const coreV1Api = kc.makeApiClient(k8s.CoreV1Api);
const batchV1Api = kc.makeApiClient(k8s.BatchV1Api);
const batchV1beta1Api = kc.makeApiClient(k8s.BatchV1beta1Api);
const currentUser = kc.getCurrentUser();
const rbac = kc.makeApiClient(k8s.RbacAuthorizationV1Api);

Expand Down Expand Up @@ -58,7 +57,9 @@ export default fp(async (fastify: FastifyInstance) => {
.readNamespacedConfigMap('console-config', 'openshift-console')
.then((result) => result.body);
if (consoleConfig.data?.[CONSOLE_CONFIG_YAML_FIELD]) {
const consoleConfigData = jsYaml.load(consoleConfig.data[CONSOLE_CONFIG_YAML_FIELD]);
const consoleConfigData = jsYaml.load(consoleConfig.data[CONSOLE_CONFIG_YAML_FIELD]) as {
customization?: { branding?: string };
};
clusterBranding = consoleConfigData.customization?.branding || 'okd';
fastify.log.info(`Cluster Branding: ${clusterBranding}`);
}
Expand All @@ -71,7 +72,6 @@ export default fp(async (fastify: FastifyInstance) => {
currentContext,
namespace,
coreV1Api,
batchV1beta1Api,
batchV1Api,
customObjectsApi,
currentUser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ const patchCM = async (
undefined,
undefined,
undefined,
undefined,
{
headers: {
'Content-Type': 'application/merge-patch+json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export const patchConnectionType = async (
undefined,
undefined,
undefined,
undefined,
options,
);
return { success: true, error: '' };
Expand Down
1 change: 1 addition & 0 deletions backend/src/routes/api/namespaces/namespaceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export const applyNamespaceChange = async (
dryRun,
undefined,
undefined,
undefined,
{
headers: { 'Content-type': PatchUtils.PATCH_FORMAT_JSON_MERGE_PATCH },
},
Expand Down
4 changes: 2 additions & 2 deletions backend/src/routes/api/nb-events/eventUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { V1Event, V1SelfSubjectAccessReview } from '@kubernetes/client-node';
import { CoreV1Event, V1SelfSubjectAccessReview } from '@kubernetes/client-node';
import { K8sStatus, KubeFastifyInstance, OauthFastifyRequest } from '../../../types';
import { createSelfSubjectAccessReview } from '../namespaces/namespaceUtils';
import { createCustomError } from '../../../utils/requestUtils';
Expand All @@ -8,7 +8,7 @@ export const getNotebookEvents = async (
namespace: string,
notebookName: string,
podUID: string | undefined,
): Promise<V1Event[]> => {
): Promise<CoreV1Event[]> => {
if (podUID) {
const response = await fastify.kube.coreV1Api.listNamespacedPod(
namespace,
Expand Down
6 changes: 4 additions & 2 deletions backend/src/routes/wss/k8s/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default async (fastify: KubeFastifyInstance): Promise<void> => {
);

// attach source socket listeners and forward requests to the target
source.on('message', (data: unknown, binary: boolean) =>
source.on('message', (data: WebSocket.RawData, binary: boolean) =>
waitConnection(target, () => target.send(data, { binary })),
);
source.on('ping', (data) => waitConnection(target, () => target.ping(data)));
Expand All @@ -95,7 +95,9 @@ export default async (fastify: KubeFastifyInstance): Promise<void> => {
target.on('unexpected-response', onUnexpectedResponse);

// attach target socket listeners and forward requests to the source
target.on('message', (data: unknown, binary: boolean) => source.send(data, { binary }));
target.on('message', (data: WebSocket.RawData, binary: boolean) =>
source.send(data, { binary }),
);
target.on('ping', (data) => source.ping(data));
target.on('pong', (data) => source.pong(data));
target.on('close', close);
Expand Down
1 change: 0 additions & 1 deletion backend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ export type KubeStatus = {
export type KubeDecorator = KubeStatus & {
config: k8s.KubeConfig;
coreV1Api: k8s.CoreV1Api;
batchV1beta1Api: k8s.BatchV1beta1Api;
batchV1Api: k8s.BatchV1Api;
customObjectsApi: k8s.CustomObjectsApi;
rbac: k8s.RbacAuthorizationV1Api;
Expand Down
5 changes: 5 additions & 0 deletions backend/src/utils/resourceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ const fetchSubscriptions = (fastify: KubeFastifyInstance): Promise<SubscriptionS
'',
'subscriptions',
undefined,
undefined,
_continue,
undefined,
undefined,
Expand Down Expand Up @@ -281,6 +282,7 @@ const fetchQuickStarts = async (fastify: KubeFastifyInstance): Promise<QuickStar
fastify.kube.namespace,
quickStartsPlural,
undefined,
undefined,
_continue,
undefined,
undefined,
Expand Down Expand Up @@ -334,6 +336,7 @@ const fetchApplicationDefs = async (fastify: KubeFastifyInstance): Promise<OdhAp
fastify.kube.namespace,
applicationsPlural,
undefined,
undefined,
_continue,
undefined,
undefined,
Expand Down Expand Up @@ -439,6 +442,7 @@ const fetchDocs = async (fastify: KubeFastifyInstance): Promise<OdhDocument[]> =
fastify.kube.namespace,
documentationsPlural,
undefined,
undefined,
_continue,
undefined,
undefined,
Expand Down Expand Up @@ -1054,6 +1058,7 @@ export const cleanupDSPSuffix = async (fastify: KubeFastifyInstance): Promise<vo
undefined,
undefined,
undefined,
undefined,
{
headers: { 'Content-type': PatchUtils.PATCH_FORMAT_JSON_MERGE_PATCH },
},
Expand Down
Loading