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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow caller to set name of services with createService method #73

Open
Oyelowo opened this issue Feb 17, 2022 · 2 comments
Open

Allow caller to set name of services with createService method #73

Oyelowo opened this issue Feb 17, 2022 · 2 comments
Labels
help-wanted We'd love your contributions on this issue kind/enhancement Improvements or new features

Comments

@Oyelowo
Copy link

Oyelowo commented Feb 17, 2022

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch @pulumi/kubernetesx@v0.1.6 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.

@danielrbradley
Copy link
Member

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.

@Oyelowo
Copy link
Author

Oyelowo commented Feb 17, 2022

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? #74

I also intend to implement the kx.CronJob at some point

@lukehoban lukehoban added the kind/enhancement Improvements or new features label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted We'd love your contributions on this issue kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

3 participants