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

rapid-soccer-18092

10/07/2021, 1:07 PM
I've refactored a bunch of code into a new component resource. It's basically creating a nicer abstraction over a Kubernetes helm chart. The problem now is that when I
pulumi up
I get the following types of errors:
Copy code
kubernetes:<http://rbac.authorization.k8s.io/v1:ClusterRole|rbac.authorization.k8s.io/v1:ClusterRole> (datadog-chart):
    error: resource datadog-chart was not successfully created by the Kubernetes API server : <http://clusterroles.rbac.authorization.k8s.io|clusterroles.rbac.authorization.k8s.io> "datadog-chart" already exists
 
  kubernetes:<http://rbac.authorization.k8s.io/v1:ClusterRole|rbac.authorization.k8s.io/v1:ClusterRole> (datadog-chart-cluster-agent):
    error: resource datadog-chart-cluster-agent was not successfully created by the Kubernetes API server : <http://clusterroles.rbac.authorization.k8s.io|clusterroles.rbac.authorization.k8s.io> "datadog-chart-cluster-agent" already exists
I guess this is expected since Pulumi cannot associate the old resource with the refactored resource. What is the best way to go about doing with without me manually deleting these resources from Kubernetes?
b

broad-dog-22463

10/07/2021, 1:09 PM
Hi @rapid-soccer-18092 you should be able to use an Alias to do this - one of our community members wrote a great blog post on how they achieved this style of refactoring
r

rapid-soccer-18092

10/07/2021, 1:09 PM
Thanks Paul! let me check this out
So this did work for the resources I have control over. But not for the dependencies created by the chart. What can I do about those which I cannot alias?
Copy code
kubernetes:core/v1:Service (default/datadog-chart-kube-state-metrics):
    error: resource default/datadog-chart-kube-state-metrics was not successfully created by the Kubernetes API server : services "datadog-chart-kube-state-metrics" already exists
 
  kubernetes:core/v1:Service (default/datadog-chart-cluster-agent):
    error: resource default/datadog-chart-cluster-agent was not successfully created by the Kubernetes API server : services "datadog-chart-cluster-agent" already exists
Changing the name of the chart results in changing the name of the dependency resources, so I did that. Wasn't exactly what I wanted, but alrighty