pulumi-kubernetes
pulumi-kubernetes copied to clipboard
Helm chart deployment fails with deserializing error
Problem description
- When trying to install the kubernetes-dashboard helm chart version "2.8.1" on a EKS cluster using this code I get a exception
var kubernetesDashboard = new Chart("kubernetes-dashboard", new ChartArgs
{
Chart = "kubernetes-dashboard",
Version = "2.8.1",
Namespace = "kube-system",
FetchOptions = new ChartFetchArgs
{
Repo = "https://kubernetes.github.io/dashboard/"
},
Values = new Dictionary<string, object>
{
{ "rbac.clusterReadOnlyRole",true },
{ "metricsScraper.enabled",false }
}
});
Errors & Logs
System.InvalidOperationException: Expected System.String but got System.Double deserializing Pulumi.Kubernetes.Types.Outputs.Core.V1.ResourceRequirements(limits)
at Pulumi.Serialization.Converter.ConvertObject(String context, Object val, Type targetType)
at Pulumi.Serialization.Converter.ConvertValue(String context, Value value, Type targetType, ImmutableHashSet`1 resources)
at Pulumi.Deployment.CompleteResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary`2 completionSources)
at Pulumi.Deployment.Runner.<>c__DisplayClass9_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Pulumi.Deployment.Runner.WhileRunningAsync()
Affected product version(s)
pulumi v2.15.1
pulumi.kubernetes 2.7.3
Reproducing the issue
Suggestions for a fix
Hi
It seams that the cpu limits of the deployment resource is set to 2 in this chart. The Yaml serializer converts that value to a double and not a string which is a expected when it is converted to a ResourceRequirements object later on.
The problem appears to be fixed, the provided program works as expected.
+ kubernetes:apps/v1:Deployment: (create)
[urn=urn:pulumi:dev2::issue-1396-dotnet::kubernetes:helm.sh/v3:Chart$kubernetes:apps/v1:Deployment::kube-system/kubernetes-dashboard]
[provider=urn:pulumi:dev2::issue-1396-dotnet::pulumi:providers:kubernetes::default_4_9_1::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
apiVersion: "apps/v1"
kind : "Deployment"
metadata : {
labels : {
app.kubernetes.io/component : "kubernetes-dashboard"
app.kubernetes.io/instance : "kubernetes-dashboard"
app.kubernetes.io/managed-by: "Helm"
app.kubernetes.io/name : "kubernetes-dashboard"
app.kubernetes.io/version : "2.0.4"
helm.sh/chart : "kubernetes-dashboard-2.8.1"
}
name : "kubernetes-dashboard"
namespace: "kube-system"
}
spec : {
replicas: 1
selector: {
matchLabels: {
app.kubernetes.io/component: "kubernetes-dashboard"
app.kubernetes.io/instance : "kubernetes-dashboard"
app.kubernetes.io/name : "kubernetes-dashboard"
}
}
strategy: {
rollingUpdate: {
maxSurge : 0
maxUnavailable: 1
}
type : "RollingUpdate"
}
template: {
metadata: {
annotations: {
seccomp.security.alpha.kubernetes.io/pod: "runtime/default"
}
labels : {
app.kubernetes.io/component : "kubernetes-dashboard"
app.kubernetes.io/instance : "kubernetes-dashboard"
app.kubernetes.io/managed-by: "Helm"
app.kubernetes.io/name : "kubernetes-dashboard"
app.kubernetes.io/version : "2.0.4"
helm.sh/chart : "kubernetes-dashboard-2.8.1"
}
}
spec : {
containers : [
[0]: {
args : [
[0]: "--namespace=kube-system"
[1]: "--auto-generate-certificates"
]
image : "kubernetesui/dashboard:v2.0.4"
imagePullPolicy: "IfNotPresent"
livenessProbe : {
httpGet : {
path : "/"
port : 8443
scheme: "HTTPS"
}
initialDelaySeconds: 30
timeoutSeconds : 30
}
name : "kubernetes-dashboard"
ports : [
[0]: {
containerPort: 8443
name : "https"
protocol : "TCP"
}
]
resources : {
limits : {
cpu : "2"
memory: "200Mi"
}
requests: {
cpu : "100m"
memory: "200Mi"
}
}
securityContext: {
allowPrivilegeEscalation: false
readOnlyRootFilesystem : true
runAsGroup : 2001
runAsUser : 1001
}
volumeMounts : [
[0]: {
mountPath: "/certs"
name : "kubernetes-dashboard-certs"
}
[1]: {
mountPath: "/tmp"
name : "tmp-volume"
}
]
}
]
serviceAccountName: "kubernetes-dashboard"
volumes : [
[0]: {
name : "kubernetes-dashboard-certs"
secret: {
secretName: "kubernetes-dashboard-certs"
}
}
[1]: {
emptyDir: {}
name : "tmp-volume"
}
]
}
}
}