Is there a way to specify "latest" chart version w...
# general
e
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
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
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
@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
No, I think you're right - this was created outside of Pulumi. Do you have a
.get
example I can use?
w
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)