diff --git a/examples/my-k8s-app/ConfigMap.my-config-map.yaml b/examples/my-k8s-app/ConfigMap.my-config-map.yaml new file mode 100644 index 0000000..56bdf71 --- /dev/null +++ b/examples/my-k8s-app/ConfigMap.my-config-map.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: fooo + name: my-config-map diff --git a/examples/my-k8s-app/Deployment.my-nginx-deployment.yaml b/examples/my-k8s-app/Deployment.my-nginx-deployment.yaml index 09f122f..19ceb7b 100644 --- a/examples/my-k8s-app/Deployment.my-nginx-deployment.yaml +++ b/examples/my-k8s-app/Deployment.my-nginx-deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: my-nginx-deployment + namespace: my-app-namespace spec: selector: matchLabels: diff --git a/examples/src/main.ts b/examples/src/main.ts index 4e393b3..d7cdab2 100644 --- a/examples/src/main.ts +++ b/examples/src/main.ts @@ -1,8 +1,9 @@ import { Helm, K8sApp } from '@k8skonf/core'; +import { ConfigMapv1 } from '@k8skonf/core/ConfigMapv1'; import { Deploymentv1 } from '@k8skonf/core/Deploymentv1'; import { log } from 'node:console'; -const app = new K8sApp('my-k8s-app', 'filePerResource'); +const app = new K8sApp('my-k8s-app', { namespace: 'my-app-namespace' }); const chart = new Helm(app, 'ingress-nginx', { chart: 'ingress-nginx', @@ -30,7 +31,18 @@ chart.resources.forEach((resource) => { console.log(resource.apiVersion); }); +new ConfigMapv1(app, 'my-config-map', { + metadata: { + // name: 'my-config-map2', // inferred from resource name + namespace: 'fooo', + }, +}); + const d = new Deploymentv1(app, 'my-nginx-deployment', { + metadata: { + // name: 'my-nginx-deployment2', // inferred from resource name + // namespace: 'fooo', // inferred from app namespace + }, spec: { selector: { matchLabels: { diff --git a/package.json b/package.json index d7e63c6..250b3b0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@types/node": "22.10.2", "typescript": "5.7.2" }, - "packageManager": "pnpm@9.15.0", + "packageManager": "pnpm@9.15.1", "engines": { "node": ">=20.18.0" } diff --git a/packages/cli/src/generateCore.ts b/packages/cli/src/generateCore.ts index 77db1a3..620a7cd 100644 --- a/packages/cli/src/generateCore.ts +++ b/packages/cli/src/generateCore.ts @@ -238,7 +238,7 @@ function morph() { interfaceProps.push(interfaceProp); } sourceFile.insertInterface(classDeclaration.getChildIndex(), i); - c.statements.push('app.resources.push(this);'); + c.statements.push('app.addResource(this);'); classDeclaration.addConstructor(c); } else { if (className === 'ObjectMetav1') { diff --git a/packages/core/src/Helm.ts b/packages/core/src/Helm.ts index 11a1a71..14af593 100644 --- a/packages/core/src/Helm.ts +++ b/packages/core/src/Helm.ts @@ -91,7 +91,7 @@ export class Helm { } if (file.toJS() !== null) { this.resources.push(file.toJS()); - app.resources.push(file.toJS()); + app.addResource(file.toJS()); } } diff --git a/packages/core/src/K8sApp.ts b/packages/core/src/K8sApp.ts index cfb3cb9..b750f9d 100644 --- a/packages/core/src/K8sApp.ts +++ b/packages/core/src/K8sApp.ts @@ -2,33 +2,48 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; import pc from 'picocolors'; import * as yaml from 'yaml'; -import { ApiObject } from './ApiObject.js'; +import { ApiObject, NamespacedApiObject } from './ApiObject.js'; + +interface K8sAppArgs { + readonly namespace?: string; + /** + * @default 'filePerResource' + */ + readonly outputType?: 'singleFile' | 'filePerResource'; +} /** * Each Kubernetes Api Object must belong to an instance of this class. * So we know where to save the resources. */ export class K8sApp { - readonly resources: ApiObject[] = []; + private readonly resources: ApiObject[] | NamespacedApiObject[] = []; + readonly namespace?: string; constructor( readonly outputName: string, - /** - * @default 'filePerResource' - */ - readonly outputType?: 'singleFile' | 'filePerResource', - ) {} + private readonly args?: K8sAppArgs, + ) { + this.namespace = args?.namespace; + } - addResource(resource: ApiObject) { + addResource(resource: ApiObject | NamespacedApiObject) { + if (resource instanceof NamespacedApiObject && !resource.metadata.namespace) { + resource.metadata.namespace = this.namespace; + } this.resources.push(resource); } + getResources() { + return this.resources; + } + toYaml() { return `---\n${this.resources.map((resource) => yaml.stringify(resource, { schema: 'yaml-1.1' })).join('---\n')}`; } save() { - if (this.outputType === 'singleFile') { + if (this.args?.outputType === 'singleFile') { console.log(pc.blueBright(`Saving to ${this.outputName}.yaml`)); fs.writeFileSync(`${this.outputName}.yaml`, this.toYaml()); } else { diff --git a/packages/core/src/models/APIServicev1.ts b/packages/core/src/models/APIServicev1.ts index 874e8b1..e8595ca 100644 --- a/packages/core/src/models/APIServicev1.ts +++ b/packages/core/src/models/APIServicev1.ts @@ -34,6 +34,6 @@ export class APIServicev1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/AuthenticationTokenRequestv1.ts b/packages/core/src/models/AuthenticationTokenRequestv1.ts index 53d44df..99e3f12 100644 --- a/packages/core/src/models/AuthenticationTokenRequestv1.ts +++ b/packages/core/src/models/AuthenticationTokenRequestv1.ts @@ -33,6 +33,6 @@ export class AuthenticationTokenRequestv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Bindingv1.ts b/packages/core/src/models/Bindingv1.ts index 3a6151a..c8c60d9 100644 --- a/packages/core/src/models/Bindingv1.ts +++ b/packages/core/src/models/Bindingv1.ts @@ -33,6 +33,6 @@ export class Bindingv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.target = args.target; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/CSIDriverv1.ts b/packages/core/src/models/CSIDriverv1.ts index 8ab4015..0e0f0e9 100644 --- a/packages/core/src/models/CSIDriverv1.ts +++ b/packages/core/src/models/CSIDriverv1.ts @@ -34,6 +34,6 @@ export class CSIDriverv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/CSINodev1.ts b/packages/core/src/models/CSINodev1.ts index 13dc964..2b0ed8a 100644 --- a/packages/core/src/models/CSINodev1.ts +++ b/packages/core/src/models/CSINodev1.ts @@ -34,6 +34,6 @@ export class CSINodev1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/CSIStorageCapacityv1.ts b/packages/core/src/models/CSIStorageCapacityv1.ts index 34d5815..e72664b 100644 --- a/packages/core/src/models/CSIStorageCapacityv1.ts +++ b/packages/core/src/models/CSIStorageCapacityv1.ts @@ -51,6 +51,6 @@ export class CSIStorageCapacityv1 extends NamespacedApiObject { this.metadata.name ??= name; this.nodeTopology = args.nodeTopology; this.storageClassName = args.storageClassName; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/CertificateSigningRequestv1.ts b/packages/core/src/models/CertificateSigningRequestv1.ts index 512f039..12be8b0 100644 --- a/packages/core/src/models/CertificateSigningRequestv1.ts +++ b/packages/core/src/models/CertificateSigningRequestv1.ts @@ -31,6 +31,6 @@ export class CertificateSigningRequestv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ClusterRoleBindingv1.ts b/packages/core/src/models/ClusterRoleBindingv1.ts index cbc847b..fcab100 100644 --- a/packages/core/src/models/ClusterRoleBindingv1.ts +++ b/packages/core/src/models/ClusterRoleBindingv1.ts @@ -41,6 +41,6 @@ export class ClusterRoleBindingv1 extends ApiObject { this.metadata.name ??= name; this.roleRef = args.roleRef; this.subjects = args.subjects; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ClusterRolev1.ts b/packages/core/src/models/ClusterRolev1.ts index 2cf208c..9470e4a 100644 --- a/packages/core/src/models/ClusterRolev1.ts +++ b/packages/core/src/models/ClusterRolev1.ts @@ -41,6 +41,6 @@ export class ClusterRolev1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.rules = args.rules; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ClusterTrustBundlev1alpha1.ts b/packages/core/src/models/ClusterTrustBundlev1alpha1.ts index 9b40b6c..3086f5d 100644 --- a/packages/core/src/models/ClusterTrustBundlev1alpha1.ts +++ b/packages/core/src/models/ClusterTrustBundlev1alpha1.ts @@ -34,6 +34,6 @@ export class ClusterTrustBundlev1alpha1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ConfigMapv1.ts b/packages/core/src/models/ConfigMapv1.ts index 13c80c3..b53b13a 100644 --- a/packages/core/src/models/ConfigMapv1.ts +++ b/packages/core/src/models/ConfigMapv1.ts @@ -44,6 +44,6 @@ export class ConfigMapv1 extends NamespacedApiObject { this.immutable = args.immutable; this.metadata = args.metadata || { name }; this.metadata.name ??= name; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ControllerRevisionv1.ts b/packages/core/src/models/ControllerRevisionv1.ts index 7c14656..45d333c 100644 --- a/packages/core/src/models/ControllerRevisionv1.ts +++ b/packages/core/src/models/ControllerRevisionv1.ts @@ -38,6 +38,6 @@ export class ControllerRevisionv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.revision = args.revision; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/CoreEventv1.ts b/packages/core/src/models/CoreEventv1.ts index 76095c7..0b728e0 100644 --- a/packages/core/src/models/CoreEventv1.ts +++ b/packages/core/src/models/CoreEventv1.ts @@ -113,6 +113,6 @@ export class CoreEventv1 extends NamespacedApiObject { this.series = args.series; this.source = args.source; this.type = args.type; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/CronJobv1.ts b/packages/core/src/models/CronJobv1.ts index 2d1d740..d3f1d7d 100644 --- a/packages/core/src/models/CronJobv1.ts +++ b/packages/core/src/models/CronJobv1.ts @@ -33,6 +33,6 @@ export class CronJobv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/CustomResourceDefinitionv1.ts b/packages/core/src/models/CustomResourceDefinitionv1.ts index a42a8ad..d8391f2 100644 --- a/packages/core/src/models/CustomResourceDefinitionv1.ts +++ b/packages/core/src/models/CustomResourceDefinitionv1.ts @@ -34,6 +34,6 @@ export class CustomResourceDefinitionv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/DaemonSetv1.ts b/packages/core/src/models/DaemonSetv1.ts index 0ff4a8e..6fd9d87 100644 --- a/packages/core/src/models/DaemonSetv1.ts +++ b/packages/core/src/models/DaemonSetv1.ts @@ -33,6 +33,6 @@ export class DaemonSetv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Deploymentv1.ts b/packages/core/src/models/Deploymentv1.ts index 8d33e51..82882fb 100644 --- a/packages/core/src/models/Deploymentv1.ts +++ b/packages/core/src/models/Deploymentv1.ts @@ -33,6 +33,6 @@ export class Deploymentv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/DeviceClassv1alpha3.ts b/packages/core/src/models/DeviceClassv1alpha3.ts index 329f39b..8df47e2 100644 --- a/packages/core/src/models/DeviceClassv1alpha3.ts +++ b/packages/core/src/models/DeviceClassv1alpha3.ts @@ -34,6 +34,6 @@ export class DeviceClassv1alpha3 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/DeviceClassv1beta1.ts b/packages/core/src/models/DeviceClassv1beta1.ts index 89f279d..0ad1b4f 100644 --- a/packages/core/src/models/DeviceClassv1beta1.ts +++ b/packages/core/src/models/DeviceClassv1beta1.ts @@ -34,6 +34,6 @@ export class DeviceClassv1beta1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/EndpointSlicev1.ts b/packages/core/src/models/EndpointSlicev1.ts index 6e7e5ad..ea23c62 100644 --- a/packages/core/src/models/EndpointSlicev1.ts +++ b/packages/core/src/models/EndpointSlicev1.ts @@ -46,6 +46,6 @@ export class EndpointSlicev1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.ports = args.ports; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Endpointsv1.ts b/packages/core/src/models/Endpointsv1.ts index 3bc09b9..15cf7e7 100644 --- a/packages/core/src/models/Endpointsv1.ts +++ b/packages/core/src/models/Endpointsv1.ts @@ -33,6 +33,6 @@ export class Endpointsv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.subsets = args.subsets; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/EventsEventv1.ts b/packages/core/src/models/EventsEventv1.ts index 06c78a0..dc43d34 100644 --- a/packages/core/src/models/EventsEventv1.ts +++ b/packages/core/src/models/EventsEventv1.ts @@ -113,6 +113,6 @@ export class EventsEventv1 extends NamespacedApiObject { this.reportingInstance = args.reportingInstance; this.series = args.series; this.type = args.type; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Evictionv1.ts b/packages/core/src/models/Evictionv1.ts index d53318b..7815328 100644 --- a/packages/core/src/models/Evictionv1.ts +++ b/packages/core/src/models/Evictionv1.ts @@ -33,6 +33,6 @@ export class Evictionv1 extends NamespacedApiObject { this.deleteOptions = args.deleteOptions; this.metadata = args.metadata || { name }; this.metadata.name ??= name; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/FlowSchemav1.ts b/packages/core/src/models/FlowSchemav1.ts index 5e276f9..045bcae 100644 --- a/packages/core/src/models/FlowSchemav1.ts +++ b/packages/core/src/models/FlowSchemav1.ts @@ -34,6 +34,6 @@ export class FlowSchemav1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/HorizontalPodAutoscalerv1.ts b/packages/core/src/models/HorizontalPodAutoscalerv1.ts index 1c2329c..2a590dc 100644 --- a/packages/core/src/models/HorizontalPodAutoscalerv1.ts +++ b/packages/core/src/models/HorizontalPodAutoscalerv1.ts @@ -33,6 +33,6 @@ export class HorizontalPodAutoscalerv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/HorizontalPodAutoscalerv2.ts b/packages/core/src/models/HorizontalPodAutoscalerv2.ts index cae9ae4..d34a13c 100644 --- a/packages/core/src/models/HorizontalPodAutoscalerv2.ts +++ b/packages/core/src/models/HorizontalPodAutoscalerv2.ts @@ -33,6 +33,6 @@ export class HorizontalPodAutoscalerv2 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/IPAddressv1beta1.ts b/packages/core/src/models/IPAddressv1beta1.ts index d30daf1..939640b 100644 --- a/packages/core/src/models/IPAddressv1beta1.ts +++ b/packages/core/src/models/IPAddressv1beta1.ts @@ -34,6 +34,6 @@ export class IPAddressv1beta1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/IngressClassv1.ts b/packages/core/src/models/IngressClassv1.ts index bc4d29d..bfa5a5a 100644 --- a/packages/core/src/models/IngressClassv1.ts +++ b/packages/core/src/models/IngressClassv1.ts @@ -34,6 +34,6 @@ export class IngressClassv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Ingressv1.ts b/packages/core/src/models/Ingressv1.ts index 5bcda5e..4ccf245 100644 --- a/packages/core/src/models/Ingressv1.ts +++ b/packages/core/src/models/Ingressv1.ts @@ -33,6 +33,6 @@ export class Ingressv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Jobv1.ts b/packages/core/src/models/Jobv1.ts index 9dc7046..6311d84 100644 --- a/packages/core/src/models/Jobv1.ts +++ b/packages/core/src/models/Jobv1.ts @@ -33,6 +33,6 @@ export class Jobv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/LeaseCandidatev1alpha2.ts b/packages/core/src/models/LeaseCandidatev1alpha2.ts index 75c8313..87f1a48 100644 --- a/packages/core/src/models/LeaseCandidatev1alpha2.ts +++ b/packages/core/src/models/LeaseCandidatev1alpha2.ts @@ -33,6 +33,6 @@ export class LeaseCandidatev1alpha2 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Leasev1.ts b/packages/core/src/models/Leasev1.ts index 1efc562..f61323b 100644 --- a/packages/core/src/models/Leasev1.ts +++ b/packages/core/src/models/Leasev1.ts @@ -33,6 +33,6 @@ export class Leasev1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/LimitRangev1.ts b/packages/core/src/models/LimitRangev1.ts index c9a0250..662bcaa 100644 --- a/packages/core/src/models/LimitRangev1.ts +++ b/packages/core/src/models/LimitRangev1.ts @@ -33,6 +33,6 @@ export class LimitRangev1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/LocalSubjectAccessReviewv1.ts b/packages/core/src/models/LocalSubjectAccessReviewv1.ts index 87e5ad5..f6bc24c 100644 --- a/packages/core/src/models/LocalSubjectAccessReviewv1.ts +++ b/packages/core/src/models/LocalSubjectAccessReviewv1.ts @@ -33,6 +33,6 @@ export class LocalSubjectAccessReviewv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/MutatingAdmissionPolicyBindingv1alpha1.ts b/packages/core/src/models/MutatingAdmissionPolicyBindingv1alpha1.ts index 069a5f4..e39d2ff 100644 --- a/packages/core/src/models/MutatingAdmissionPolicyBindingv1alpha1.ts +++ b/packages/core/src/models/MutatingAdmissionPolicyBindingv1alpha1.ts @@ -34,6 +34,6 @@ export class MutatingAdmissionPolicyBindingv1alpha1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/MutatingAdmissionPolicyv1alpha1.ts b/packages/core/src/models/MutatingAdmissionPolicyv1alpha1.ts index 6fa0531..ef5d964 100644 --- a/packages/core/src/models/MutatingAdmissionPolicyv1alpha1.ts +++ b/packages/core/src/models/MutatingAdmissionPolicyv1alpha1.ts @@ -34,6 +34,6 @@ export class MutatingAdmissionPolicyv1alpha1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/MutatingWebhookConfigurationv1.ts b/packages/core/src/models/MutatingWebhookConfigurationv1.ts index ab93e08..bdffdf8 100644 --- a/packages/core/src/models/MutatingWebhookConfigurationv1.ts +++ b/packages/core/src/models/MutatingWebhookConfigurationv1.ts @@ -34,6 +34,6 @@ export class MutatingWebhookConfigurationv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.webhooks = args.webhooks; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Namespacev1.ts b/packages/core/src/models/Namespacev1.ts index 170c85f..2e4d9a3 100644 --- a/packages/core/src/models/Namespacev1.ts +++ b/packages/core/src/models/Namespacev1.ts @@ -34,6 +34,6 @@ export class Namespacev1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/NetworkPolicyv1.ts b/packages/core/src/models/NetworkPolicyv1.ts index e145c58..5dba13c 100644 --- a/packages/core/src/models/NetworkPolicyv1.ts +++ b/packages/core/src/models/NetworkPolicyv1.ts @@ -33,6 +33,6 @@ export class NetworkPolicyv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Nodev1.ts b/packages/core/src/models/Nodev1.ts index 996b66a..4def378 100644 --- a/packages/core/src/models/Nodev1.ts +++ b/packages/core/src/models/Nodev1.ts @@ -34,6 +34,6 @@ export class Nodev1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/PersistentVolumev1.ts b/packages/core/src/models/PersistentVolumev1.ts index 8b61ad2..345ed42 100644 --- a/packages/core/src/models/PersistentVolumev1.ts +++ b/packages/core/src/models/PersistentVolumev1.ts @@ -34,6 +34,6 @@ export class PersistentVolumev1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/PodDisruptionBudgetv1.ts b/packages/core/src/models/PodDisruptionBudgetv1.ts index e9e7d98..2f284df 100644 --- a/packages/core/src/models/PodDisruptionBudgetv1.ts +++ b/packages/core/src/models/PodDisruptionBudgetv1.ts @@ -33,6 +33,6 @@ export class PodDisruptionBudgetv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/PodTemplatev1.ts b/packages/core/src/models/PodTemplatev1.ts index cb15197..a99021f 100644 --- a/packages/core/src/models/PodTemplatev1.ts +++ b/packages/core/src/models/PodTemplatev1.ts @@ -33,6 +33,6 @@ export class PodTemplatev1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.template = args.template; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Podv1.ts b/packages/core/src/models/Podv1.ts index 26d6fd2..cc153c9 100644 --- a/packages/core/src/models/Podv1.ts +++ b/packages/core/src/models/Podv1.ts @@ -33,6 +33,6 @@ export class Podv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/PriorityClassv1.ts b/packages/core/src/models/PriorityClassv1.ts index a583cd4..dab19e1 100644 --- a/packages/core/src/models/PriorityClassv1.ts +++ b/packages/core/src/models/PriorityClassv1.ts @@ -51,6 +51,6 @@ export class PriorityClassv1 extends ApiObject { this.metadata.name ??= name; this.preemptionPolicy = args.preemptionPolicy; this.value = args.value; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/PriorityLevelConfigurationv1.ts b/packages/core/src/models/PriorityLevelConfigurationv1.ts index 8b5b1a4..17caeec 100644 --- a/packages/core/src/models/PriorityLevelConfigurationv1.ts +++ b/packages/core/src/models/PriorityLevelConfigurationv1.ts @@ -34,6 +34,6 @@ export class PriorityLevelConfigurationv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ReplicaSetv1.ts b/packages/core/src/models/ReplicaSetv1.ts index 26263a6..90c670d 100644 --- a/packages/core/src/models/ReplicaSetv1.ts +++ b/packages/core/src/models/ReplicaSetv1.ts @@ -33,6 +33,6 @@ export class ReplicaSetv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ReplicationControllerv1.ts b/packages/core/src/models/ReplicationControllerv1.ts index 0484393..c997d6a 100644 --- a/packages/core/src/models/ReplicationControllerv1.ts +++ b/packages/core/src/models/ReplicationControllerv1.ts @@ -33,6 +33,6 @@ export class ReplicationControllerv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ResourceClaimTemplatev1alpha3.ts b/packages/core/src/models/ResourceClaimTemplatev1alpha3.ts index 47e487c..e13508d 100644 --- a/packages/core/src/models/ResourceClaimTemplatev1alpha3.ts +++ b/packages/core/src/models/ResourceClaimTemplatev1alpha3.ts @@ -33,6 +33,6 @@ export class ResourceClaimTemplatev1alpha3 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ResourceClaimTemplatev1beta1.ts b/packages/core/src/models/ResourceClaimTemplatev1beta1.ts index ac0974d..b5916ef 100644 --- a/packages/core/src/models/ResourceClaimTemplatev1beta1.ts +++ b/packages/core/src/models/ResourceClaimTemplatev1beta1.ts @@ -33,6 +33,6 @@ export class ResourceClaimTemplatev1beta1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ResourceClaimv1alpha3.ts b/packages/core/src/models/ResourceClaimv1alpha3.ts index fa9c426..2581fdb 100644 --- a/packages/core/src/models/ResourceClaimv1alpha3.ts +++ b/packages/core/src/models/ResourceClaimv1alpha3.ts @@ -33,6 +33,6 @@ export class ResourceClaimv1alpha3 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ResourceClaimv1beta1.ts b/packages/core/src/models/ResourceClaimv1beta1.ts index dcc30d0..eba207f 100644 --- a/packages/core/src/models/ResourceClaimv1beta1.ts +++ b/packages/core/src/models/ResourceClaimv1beta1.ts @@ -33,6 +33,6 @@ export class ResourceClaimv1beta1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ResourceQuotav1.ts b/packages/core/src/models/ResourceQuotav1.ts index 65b0587..e22b06a 100644 --- a/packages/core/src/models/ResourceQuotav1.ts +++ b/packages/core/src/models/ResourceQuotav1.ts @@ -33,6 +33,6 @@ export class ResourceQuotav1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ResourceSlicev1alpha3.ts b/packages/core/src/models/ResourceSlicev1alpha3.ts index d0a97cd..f70a5f3 100644 --- a/packages/core/src/models/ResourceSlicev1alpha3.ts +++ b/packages/core/src/models/ResourceSlicev1alpha3.ts @@ -34,6 +34,6 @@ export class ResourceSlicev1alpha3 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ResourceSlicev1beta1.ts b/packages/core/src/models/ResourceSlicev1beta1.ts index 8be0d6a..eb74a53 100644 --- a/packages/core/src/models/ResourceSlicev1beta1.ts +++ b/packages/core/src/models/ResourceSlicev1beta1.ts @@ -34,6 +34,6 @@ export class ResourceSlicev1beta1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/RoleBindingv1.ts b/packages/core/src/models/RoleBindingv1.ts index 82c5119..b208e38 100644 --- a/packages/core/src/models/RoleBindingv1.ts +++ b/packages/core/src/models/RoleBindingv1.ts @@ -40,6 +40,6 @@ export class RoleBindingv1 extends NamespacedApiObject { this.metadata.name ??= name; this.roleRef = args.roleRef; this.subjects = args.subjects; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Rolev1.ts b/packages/core/src/models/Rolev1.ts index 7cbe06b..8c1b6a5 100644 --- a/packages/core/src/models/Rolev1.ts +++ b/packages/core/src/models/Rolev1.ts @@ -33,6 +33,6 @@ export class Rolev1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.rules = args.rules; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/RuntimeClassv1.ts b/packages/core/src/models/RuntimeClassv1.ts index 236d2c5..cfab7fd 100644 --- a/packages/core/src/models/RuntimeClassv1.ts +++ b/packages/core/src/models/RuntimeClassv1.ts @@ -47,6 +47,6 @@ export class RuntimeClassv1 extends ApiObject { this.metadata.name ??= name; this.overhead = args.overhead; this.scheduling = args.scheduling; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Secretv1.ts b/packages/core/src/models/Secretv1.ts index 21688a3..48952a7 100644 --- a/packages/core/src/models/Secretv1.ts +++ b/packages/core/src/models/Secretv1.ts @@ -50,6 +50,6 @@ export class Secretv1 extends NamespacedApiObject { this.metadata.name ??= name; this.stringData = args.stringData; this.type = args.type; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/SelfSubjectAccessReviewv1.ts b/packages/core/src/models/SelfSubjectAccessReviewv1.ts index d9caf66..683ebb1 100644 --- a/packages/core/src/models/SelfSubjectAccessReviewv1.ts +++ b/packages/core/src/models/SelfSubjectAccessReviewv1.ts @@ -34,6 +34,6 @@ export class SelfSubjectAccessReviewv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/SelfSubjectReviewv1.ts b/packages/core/src/models/SelfSubjectReviewv1.ts index ccb1c47..b3b64e6 100644 --- a/packages/core/src/models/SelfSubjectReviewv1.ts +++ b/packages/core/src/models/SelfSubjectReviewv1.ts @@ -27,6 +27,6 @@ export class SelfSubjectReviewv1 extends ApiObject { super(); this.metadata = args.metadata || { name }; this.metadata.name ??= name; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/SelfSubjectReviewv1beta1.ts b/packages/core/src/models/SelfSubjectReviewv1beta1.ts index 93c4164..b3cdf87 100644 --- a/packages/core/src/models/SelfSubjectReviewv1beta1.ts +++ b/packages/core/src/models/SelfSubjectReviewv1beta1.ts @@ -27,6 +27,6 @@ export class SelfSubjectReviewv1beta1 extends ApiObject { super(); this.metadata = args.metadata || { name }; this.metadata.name ??= name; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/SelfSubjectRulesReviewv1.ts b/packages/core/src/models/SelfSubjectRulesReviewv1.ts index a5fb032..5287adb 100644 --- a/packages/core/src/models/SelfSubjectRulesReviewv1.ts +++ b/packages/core/src/models/SelfSubjectRulesReviewv1.ts @@ -34,6 +34,6 @@ export class SelfSubjectRulesReviewv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ServiceAccountv1.ts b/packages/core/src/models/ServiceAccountv1.ts index 5ae4cf8..835b2c4 100644 --- a/packages/core/src/models/ServiceAccountv1.ts +++ b/packages/core/src/models/ServiceAccountv1.ts @@ -46,6 +46,6 @@ export class ServiceAccountv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.secrets = args.secrets; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ServiceCIDRv1beta1.ts b/packages/core/src/models/ServiceCIDRv1beta1.ts index bc48251..030c137 100644 --- a/packages/core/src/models/ServiceCIDRv1beta1.ts +++ b/packages/core/src/models/ServiceCIDRv1beta1.ts @@ -34,6 +34,6 @@ export class ServiceCIDRv1beta1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/Servicev1.ts b/packages/core/src/models/Servicev1.ts index 36e357c..c9a49cf 100644 --- a/packages/core/src/models/Servicev1.ts +++ b/packages/core/src/models/Servicev1.ts @@ -33,6 +33,6 @@ export class Servicev1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/StatefulSetv1.ts b/packages/core/src/models/StatefulSetv1.ts index 7749530..59c45ab 100644 --- a/packages/core/src/models/StatefulSetv1.ts +++ b/packages/core/src/models/StatefulSetv1.ts @@ -33,6 +33,6 @@ export class StatefulSetv1 extends NamespacedApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/StorageClassv1.ts b/packages/core/src/models/StorageClassv1.ts index 8ede6ff..1e1fc1a 100644 --- a/packages/core/src/models/StorageClassv1.ts +++ b/packages/core/src/models/StorageClassv1.ts @@ -70,6 +70,6 @@ export class StorageClassv1 extends ApiObject { this.provisioner = args.provisioner; this.reclaimPolicy = args.reclaimPolicy; this.volumeBindingMode = args.volumeBindingMode; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/StorageVersionMigrationv1alpha1.ts b/packages/core/src/models/StorageVersionMigrationv1alpha1.ts index 6e7d6af..f3baea9 100644 --- a/packages/core/src/models/StorageVersionMigrationv1alpha1.ts +++ b/packages/core/src/models/StorageVersionMigrationv1alpha1.ts @@ -34,6 +34,6 @@ export class StorageVersionMigrationv1alpha1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/StorageVersionv1alpha1.ts b/packages/core/src/models/StorageVersionv1alpha1.ts index 1e6466d..c541e4f 100644 --- a/packages/core/src/models/StorageVersionv1alpha1.ts +++ b/packages/core/src/models/StorageVersionv1alpha1.ts @@ -33,6 +33,6 @@ export class StorageVersionv1alpha1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/SubjectAccessReviewv1.ts b/packages/core/src/models/SubjectAccessReviewv1.ts index e43b844..49a8589 100644 --- a/packages/core/src/models/SubjectAccessReviewv1.ts +++ b/packages/core/src/models/SubjectAccessReviewv1.ts @@ -34,6 +34,6 @@ export class SubjectAccessReviewv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/TokenReviewv1.ts b/packages/core/src/models/TokenReviewv1.ts index 7375cc0..3297c60 100644 --- a/packages/core/src/models/TokenReviewv1.ts +++ b/packages/core/src/models/TokenReviewv1.ts @@ -34,6 +34,6 @@ export class TokenReviewv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ValidatingAdmissionPolicyBindingv1.ts b/packages/core/src/models/ValidatingAdmissionPolicyBindingv1.ts index 822ebc5..d3fd95a 100644 --- a/packages/core/src/models/ValidatingAdmissionPolicyBindingv1.ts +++ b/packages/core/src/models/ValidatingAdmissionPolicyBindingv1.ts @@ -34,6 +34,6 @@ export class ValidatingAdmissionPolicyBindingv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ValidatingAdmissionPolicyBindingv1beta1.ts b/packages/core/src/models/ValidatingAdmissionPolicyBindingv1beta1.ts index 6e12c5d..bdeaf3d 100644 --- a/packages/core/src/models/ValidatingAdmissionPolicyBindingv1beta1.ts +++ b/packages/core/src/models/ValidatingAdmissionPolicyBindingv1beta1.ts @@ -34,6 +34,6 @@ export class ValidatingAdmissionPolicyBindingv1beta1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ValidatingAdmissionPolicyv1.ts b/packages/core/src/models/ValidatingAdmissionPolicyv1.ts index 8293b38..2910dbb 100644 --- a/packages/core/src/models/ValidatingAdmissionPolicyv1.ts +++ b/packages/core/src/models/ValidatingAdmissionPolicyv1.ts @@ -34,6 +34,6 @@ export class ValidatingAdmissionPolicyv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ValidatingAdmissionPolicyv1beta1.ts b/packages/core/src/models/ValidatingAdmissionPolicyv1beta1.ts index 27cd955..46fabc1 100644 --- a/packages/core/src/models/ValidatingAdmissionPolicyv1beta1.ts +++ b/packages/core/src/models/ValidatingAdmissionPolicyv1beta1.ts @@ -34,6 +34,6 @@ export class ValidatingAdmissionPolicyv1beta1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/ValidatingWebhookConfigurationv1.ts b/packages/core/src/models/ValidatingWebhookConfigurationv1.ts index 6f1fa22..1f6c107 100644 --- a/packages/core/src/models/ValidatingWebhookConfigurationv1.ts +++ b/packages/core/src/models/ValidatingWebhookConfigurationv1.ts @@ -34,6 +34,6 @@ export class ValidatingWebhookConfigurationv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.webhooks = args.webhooks; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/VolumeAttachmentv1.ts b/packages/core/src/models/VolumeAttachmentv1.ts index 72589d2..dda39a3 100644 --- a/packages/core/src/models/VolumeAttachmentv1.ts +++ b/packages/core/src/models/VolumeAttachmentv1.ts @@ -34,6 +34,6 @@ export class VolumeAttachmentv1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.spec = args.spec; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/VolumeAttributesClassv1alpha1.ts b/packages/core/src/models/VolumeAttributesClassv1alpha1.ts index c3e1810..6f4f373 100644 --- a/packages/core/src/models/VolumeAttributesClassv1alpha1.ts +++ b/packages/core/src/models/VolumeAttributesClassv1alpha1.ts @@ -39,6 +39,6 @@ export class VolumeAttributesClassv1alpha1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.parameters = args.parameters; - app.resources.push(this); + app.addResource(this); } } diff --git a/packages/core/src/models/VolumeAttributesClassv1beta1.ts b/packages/core/src/models/VolumeAttributesClassv1beta1.ts index f5f9db6..996ed17 100644 --- a/packages/core/src/models/VolumeAttributesClassv1beta1.ts +++ b/packages/core/src/models/VolumeAttributesClassv1beta1.ts @@ -39,6 +39,6 @@ export class VolumeAttributesClassv1beta1 extends ApiObject { this.metadata = args.metadata || { name }; this.metadata.name ??= name; this.parameters = args.parameters; - app.resources.push(this); + app.addResource(this); } }