https://pulumi.com logo
#general
Title
# general
e

early-musician-41645

10/31/2018, 9:05 PM
Is there a way to specify "latest" chart version when using new
k8s.helm.v2.Chart
? I couldn't find the possible values from a cursory look at https://github.com/pulumi/pulumi-kubernetes/blob/master/sdk/nodejs/helm.ts
w

white-balloon-205

10/31/2018, 9:51 PM
Looks like
version
is currently required, but probably shouldn't be as Helm doesn't require the version. Opened https://github.com/pulumi/pulumi-kubernetes/issues/255 to track, and you can should be able to work around in the meantime by passing
version: <any>undefined
.
e

early-musician-41645

10/31/2018, 10:13 PM
I think I saw an issue on this already, but is there a way for the chart deployments to do an
upgrade --install
instead of an
install
? meaning, if something already exists in kubernetes then we just ignore it as if we were doing
helm upgrade -i
?
Right now I'm getting an error when running my chart deployment:
Copy code
Updating (poc):

     Type                                  Name                  Status                  Info
     pulumi:pulumi:Stack                   eks-cluster-poc
 +   ├─ kubernetes:helm.sh:Chart           aws-k8s-cni           created
 +   │  └─ kubernetes:core:ServiceAccount  kube-system/aws-node  **creating failed**     1 error
 ~   └─ kubernetes:helm.sh:Chart           splunk-forwarder      updated                 [diff: -version]

Diagnostics:
  kubernetes:core:ServiceAccount (kube-system/aws-node):
    error: Plan apply failed: serviceaccounts "aws-node" already exists
helm just says
unchanged
and does a no-op
but pulumi is erroring out
w

white-balloon-205

10/31/2018, 10:24 PM
@early-musician-41645 Is it the case here that you already have this installed separately from your Pulumi program, but then want the Pulumi program to indicate it wants to install it as well, and for that to succeed if it's already there (presumably updating it if needed to the state specified by the Pulumi program)? Any reason you want to specify it again here if it already available? In general (for all cloud providers not just Kubernetes) we tend to encourage a pattern of using
.get
to look up a resource if already there, instead of attempting to recreate it. I suspect there's a reason why that doesn't make sense in your scenario, but curious to understand more.
e

early-musician-41645

10/31/2018, 10:26 PM
No, I think you're right - this was created outside of Pulumi. Do you have a
.get
example I can use?
w

white-balloon-205

10/31/2018, 10:34 PM
Copy code
import * as k8s  from "@pulumi/kubernetes";

const serviceaccount = k8s.core.v1.ServiceAccount.get("aws-node", "kube-system/aws-node");
export const serviceaccountSercrets = serviceaccount.secrets;
(actually - not 100% sure that's the right second argument to pass - but I think it is - I don't have a cluster available right now with that service account to try this out on)
2 Views