pulumi-kubernetesx
pulumi-kubernetesx copied to clipboard
Allow caller to set name of services with `createService` method
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @pulumi/[email protected] for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/@pulumi/kubernetesx/kx.d.ts b/node_modules/@pulumi/kubernetesx/kx.d.ts
index 2bbe265..4b677ea 100644
--- a/node_modules/@pulumi/kubernetesx/kx.d.ts
+++ b/node_modules/@pulumi/kubernetesx/kx.d.ts
@@ -35,6 +35,9 @@ export declare namespace types {
ports?: pulumi.Input<pulumi.Input<k8s.types.input.core.v1.ServicePort>[] | PortMap>;
type?: pulumi.Input<ServiceType | string>;
};
+ type CreateServiceArgs = types.ServiceSpec & {
+ metadata?: pulumi.Input<k8s.types.input.meta.v1.ObjectMeta>;
+ };
type Service = Omit<k8s.types.input.core.v1.Service, "spec"> & {
spec: pulumi.Input<ServiceSpec>;
};
@@ -70,7 +73,7 @@ export declare class Deployment extends k8s.apps.v1.Deployment {
private readonly name;
private readonly opts?;
constructor(name: string, args: types.Deployment, opts?: pulumi.CustomResourceOptions);
- createService(args?: types.ServiceSpec): Service;
+ createService(args?: types.CreateServiceArgs): Service;
}
export declare class Service extends k8s.core.v1.Service {
constructor(name: string, args: types.Service, opts?: pulumi.CustomResourceOptions);
diff --git a/node_modules/@pulumi/kubernetesx/kx.js b/node_modules/@pulumi/kubernetesx/kx.js
index 4aa2874..17f332f 100644
--- a/node_modules/@pulumi/kubernetesx/kx.js
+++ b/node_modules/@pulumi/kubernetesx/kx.js
@@ -186,8 +186,8 @@ class Deployment extends k8s.apps.v1.Deployment {
// TODO: probably need to unwrap args.type in case it's a computed value
type: args && args.type });
});
- return new Service(this.name, {
- metadata: { namespace: this.metadata.namespace },
+ return new Service(args?.metadata?.name, {
+ metadata: { namespace: this.metadata.namespace, ...args?.metadata },
spec: serviceSpec,
}, Object.assign(Object.assign({}, this.opts), { parent: this }));
}
This issue body was partially generated by patch-package.
If you're interested in submitting this as a Pull Request that'd be great!
It looks from an initial read that it should be backwards compatible and able to be incorporated.
If you're interested in submitting this as a Pull Request that'd be great!
It looks from an initial read that it should be backwards compatible and able to be incorporated.
Thanks! I just created a PR for this. Could you review that? https://github.com/pulumi/pulumi-kubernetesx/pull/74
I also intend to implement the kx.CronJob at some point