litmuschaos / litmus-helm

Helm Charts for the Litmus Chaos Operator & CRDs
Apache License 2.0
45 stars 85 forks source link

Installing in AWS EKS using CDK fails #278

Open rudpot opened 1 year ago

rudpot commented 1 year ago

Possibly related to #157

Trying to install litmus in AWS EKS using AWS CDK fails with the following error message:

Received response status [FAILED] from custom resource. Message returned: Error
: b'Error: UPGRADE FAILED: failed to create resource: ClusterRole.rbac.authoriz
ation.k8s.io "litmus-cluster-scope-for-fisstackeksclusterchartlitmuse35dacde-se
rver" is invalid: metadata.labels: Invalid value: "litmus-cluster-scope-for-fis
stackeksclusterchartlitmuse35dacde-server": must be no more than 63 characters\
n'

This seems to be caused by https://github.com/litmuschaos/litmus-helm/blob/master/charts/litmus/templates/server-cluster-role.yaml#L44 where the role name is expanded from name: litmus-cluster-scope-for-{{ include "litmus-portal.fullname" . }}-server. CDK generates a unique 38 character string like fisstackeksclusterchartlitmuse35dacde which in conjunction with the type extension -server exceeds the 63 character limit.

How to reproduce

Create EKS Cluser and add this

    // Currently does not work - somehow CDK+Litmus helm chart crate an illegal resource name 
    // Install Litmus via helm chart
    // https://chaos-mesh.org/docs/production-installation-using-helm/
    eksCluster.addHelmChart('Litmus', {
      chart: 'litmus,
      repository: 'https://litmuschaos.github.io/litmus-helm/',
      namespace: 'litmus',
    });
rudpot commented 1 year ago

Also tried using kube-aws. That doesn't barf but also doesn't start any resources when checking with kubectl get po -n litmus

rudpot commented 1 year ago

I won't venture an opinion on where the problem exists - it originates in CDK but really litmus should be validating the resource names it's trying to generate. Workaround until that happens: you can set "release" in CDK:

    // Install Litmus via helm chart
    // https://chaos-mesh.org/docs/production-installation-using-helm/
    eksCluster.addHelmChart('Litmus', {
      chart: 'litmus',
      repository: 'https://litmuschaos.github.io/litmus-helm/',
      namespace: 'litmus',
      // Override auto-generated hash from kubectl-provider to avoid name length issues
      release: 'litmus',
    });