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

Bump @kubernetes/client-node from 0.15.1 to 0.22.3 #305

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"typescript": "^4.5.5"
},
"dependencies": {
"@kubernetes/client-node": "^0.15.1",
"@kubernetes/client-node": "^0.22.3",
"bored-mplex": "^0.1.3",
"got": "^11.8.5",
"http-parser-js": "^0.5.8",
Expand Down
17 changes: 15 additions & 2 deletions src/updater-yml.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import * as k8s from "@kubernetes/client-node";
import type { KubeConfig } from "@kubernetes/client-node";
import type { KubeConfig, KubernetesObject, V1ObjectMeta } from "@kubernetes/client-node";
import type { Got } from "got";
import isUrl from "is-url";
import yaml, { Scalar } from "yaml";

/**
* KubernetesObject with metadata.name as required field, as opposed to the V1ObjectMeta interface
* which has it as optional field. KubernetesObjectHeader requires non optional field for name and
* KubernetesObjectApi.read takes KubernetesObjectHeader as input.
*
* @see https://github.com/kubernetes-client/javascript/issues/367#issuecomment-2322098513
*/
export type KubernetesObjectWithMetadata = KubernetesObject & {
metadata: V1ObjectMeta & {
name: string;
};
};

/**
* Replicate the functionality of `kubectl apply`. That is, create the resources defined in the `specString` if they do
* not exist, patch them if they do exist.
Expand All @@ -19,7 +32,7 @@ export async function applyBoredAgentYml(
): Promise<k8s.KubernetesObject[]> {
console.log("Applying bored-agent.yml...");
const client = k8s.KubernetesObjectApi.makeApiClient(kc);
const specs = k8s.loadAllYaml(specString) as k8s.KubernetesObject[];
const specs = k8s.loadAllYaml(specString) as KubernetesObjectWithMetadata[];
const validSpecs = specs.filter((spec) => spec && spec.kind && spec.metadata);
const created: k8s.KubernetesObject[] = [];

Expand Down
Loading
Loading