Skip to content

Commit

Permalink
Revert "Kubernetes client package upgrade (opendatahub-io#3323)" due …
Browse files Browse the repository at this point in the history
…to incompatibilities caused.

This reverts commit 63e8206.
  • Loading branch information
alexcreasy committed Oct 14, 2024
1 parent 6ec1b1b commit a4c8d78
Show file tree
Hide file tree
Showing 10 changed files with 2,484 additions and 4,291 deletions.
6,745 changes: 2,474 additions & 4,271 deletions backend/package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 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.22.0",
"@kubernetes/client-node": "^0.12.2",
"dotenv": "^8.2.0",
"fastify": "^4.28.1",
"fastify-plugin": "^4.5.1",
Expand Down Expand Up @@ -85,7 +85,6 @@
"overrides": {
"tough-cookie": "^4.1.3",
"ws": "^8.17.1",
"@types/tar": "^6.1.13",
"jsonpath-plus": "^10.0.0"
"@types/tar": "^6.1.13"
}
}
6 changes: 3 additions & 3 deletions backend/src/plugins/kube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ 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 @@ -57,9 +58,7 @@ 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]) as {
customization?: { branding?: string };
};
const consoleConfigData = jsYaml.load(consoleConfig.data[CONSOLE_CONFIG_YAML_FIELD]);
clusterBranding = consoleConfigData.customization?.branding || 'okd';
fastify.log.info(`Cluster Branding: ${clusterBranding}`);
}
Expand All @@ -72,6 +71,7 @@ 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,7 +197,6 @@ 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,7 +157,6 @@ export const patchConnectionType = async (
undefined,
undefined,
undefined,
undefined,
options,
);
return { success: true, error: '' };
Expand Down
1 change: 0 additions & 1 deletion backend/src/routes/api/namespaces/namespaceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ 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 { CoreV1Event, V1SelfSubjectAccessReview } from '@kubernetes/client-node';
import { V1Event, 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<CoreV1Event[]> => {
): Promise<V1Event[]> => {
if (podUID) {
const response = await fastify.kube.coreV1Api.listNamespacedPod(
namespace,
Expand Down
6 changes: 2 additions & 4 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: WebSocket.RawData, binary: boolean) =>
source.on('message', (data: unknown, binary: boolean) =>
waitConnection(target, () => target.send(data, { binary })),
);
source.on('ping', (data) => waitConnection(target, () => target.ping(data)));
Expand All @@ -95,9 +95,7 @@ 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: WebSocket.RawData, binary: boolean) =>
source.send(data, { binary }),
);
target.on('message', (data: unknown, 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: 1 addition & 0 deletions backend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ 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: 0 additions & 5 deletions backend/src/utils/resourceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ const fetchSubscriptions = (fastify: KubeFastifyInstance): Promise<SubscriptionS
'',
'subscriptions',
undefined,
undefined,
_continue,
undefined,
undefined,
Expand Down Expand Up @@ -282,7 +281,6 @@ const fetchQuickStarts = async (fastify: KubeFastifyInstance): Promise<QuickStar
fastify.kube.namespace,
quickStartsPlural,
undefined,
undefined,
_continue,
undefined,
undefined,
Expand Down Expand Up @@ -336,7 +334,6 @@ const fetchApplicationDefs = async (fastify: KubeFastifyInstance): Promise<OdhAp
fastify.kube.namespace,
applicationsPlural,
undefined,
undefined,
_continue,
undefined,
undefined,
Expand Down Expand Up @@ -442,7 +439,6 @@ const fetchDocs = async (fastify: KubeFastifyInstance): Promise<OdhDocument[]> =
fastify.kube.namespace,
documentationsPlural,
undefined,
undefined,
_continue,
undefined,
undefined,
Expand Down Expand Up @@ -1058,7 +1054,6 @@ export const cleanupDSPSuffix = async (fastify: KubeFastifyInstance): Promise<vo
undefined,
undefined,
undefined,
undefined,
{
headers: { 'Content-type': PatchUtils.PATCH_FORMAT_JSON_MERGE_PATCH },
},
Expand Down

0 comments on commit a4c8d78

Please sign in to comment.