https://pulumi.com logo
#typescript
Title
# typescript
b

bored-furniture-11856

02/29/2020, 10:46 PM
Did I miss a thing, or why does kubernetesx.Deployment.createService() use autonaming?
Copy code
metadata  : {
    annotations: {
        <http://pulumi.com/autonamed|pulumi.com/autonamed>: "true"
    }
    labels     : {
        <http://app.kubernetes.io/managed-by|app.kubernetes.io/managed-by>: "pulumi"
    }
    name       : "foo-api-2rwgcw01"
    namespace  : "backend"
}
Is there any way around that? Or is it a missing feature? Any chance to set the Service name to
foo-api
? https://github.com/pulumi/pulumi-kubernetesx/blob/master/nodejs/kubernetesx/kx.ts#L260
g

gorgeous-egg-16927

03/02/2020, 3:26 PM
Autonaming is the default for Pulumi, but the intent is to allow overrides as needed. This feature is tracked in https://github.com/pulumi/pulumi-kubernetesx/issues/52 In the meantime, you’d have to specify the Service the usual way if you need a specific name. Something like this should work:
Copy code
const svc = new kx.Service("nginx", {
    metadata: { name: "nginx" },
    spec: {
        ports: { http: 80 },
        selector: deployment.spec.selector.matchLabels,
        type: kx.types.ServiceType.LoadBalancer,
    }
})
👍 1
4 Views