Skip to content
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
12 changes: 11 additions & 1 deletion src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ import { PatchStrategy } from './patch.js';
/** Kubernetes API verbs. */
type KubernetesApiAction = 'create' | 'delete' | 'patch' | 'read' | 'list' | 'replace';

type KubernetesObjectHeader<T extends KubernetesObject | KubernetesObject> = Pick<
T,
'apiVersion' | 'kind'
> & {
metadata: {
name: string;
namespace?: string;
};
};

interface GroupVersion {
group: string;
version: string;
Expand Down Expand Up @@ -278,7 +288,7 @@ export class KubernetesObjectApi {
* @return Promise containing the request response and [[KubernetesObject]].
*/
public async read<T extends KubernetesObject | KubernetesObject>(
spec: T,
spec: KubernetesObjectHeader<T>,
pretty?: string,
exact?: boolean,
exportt?: boolean,
Expand Down
2 changes: 1 addition & 1 deletion src/object_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,7 @@ describe('KubernetesObject', () => {

it('should read a custom resource', async () => {
interface CustomTestResource extends KubernetesObject {
spec?: {
spec: {
key: string;
};
}
Expand Down
Loading