Skip to content

ramenctl validate clusters panics on duplicate profile name in ramen config #509

Description

@nirs

Describe the bug

If ramen config contains duplicate 33 profile, ramenctl validate clusters panics:

% ramenctl validate clusters -o out/v0.25-pre1/clusters-4
⭐ Using config "config.yaml"
⭐ Using report "out/v0.25-pre1/clusters-4"

🔎 Validate config ...
   ✅ Config validated

🔎 Validate clusters ...
   ✅ Gathered data from cluster "hub"
   ✅ Gathered data from cluster "dr2"
   ✅ Gathered data from cluster "dr1"
   ✅ Inspected S3 profiles
   ✅ Checked S3 profile "fake-profile-2"
   ✅ Checked S3 profile "minio-on-dr2"
   ✅ Checked S3 profile "minio-on-dr1"
   ✅ Checked S3 profile "fake-profile-2"
panic: step "check S3 profile \"fake-profile-2\"" exists

goroutine 1 [running]:
github.com/ramendr/ramenctl/pkg/report.(*Step).AddStep(0x1f4b47d466e0, 0x1f4b47d008c0)
	/github/workspace/pkg/report/report.go:237 +0x2f0
github.com/ramendr/ramenctl/pkg/validate/clusters.(*Command).checkS3(0x1f4b47e78130, {0x1f4b48688ca0, 0x4, 0x4})
	/github/workspace/pkg/validate/clusters/command.go:1116 +0x1dc
github.com/ramendr/ramenctl/pkg/validate/clusters.(*Command).checkS3Profiles(0x1f4b47e78130)
	/github/workspace/pkg/validate/clusters/command.go:122 +0x64
github.com/ramendr/ramenctl/pkg/validate/clusters.(*Command).validateClusters(0x1f4b47e78130)
	/github/workspace/pkg/validate/clusters/command.go:95 +0x1ac
github.com/ramendr/ramenctl/pkg/validate/clusters.(*Command).Run(0x1f4b47e78130)
	/github/workspace/pkg/validate/clusters/command.go:72 +0x30
github.com/ramendr/ramenctl/pkg/validate.Clusters({{0x106700b19, 0xb}, {0x16af2b7be, 0x19}, 0x1})
	/github/workspace/pkg/validate/validate.go:30 +0x154
github.com/ramendr/ramenctl/cmd/commands.init.func6(0x1f4b479fd200?, {0x1066f77eb?, 0x4?, 0x1066f77ef?})
	/github/workspace/cmd/commands/validate.go:24 +0x5c
github.com/spf13/cobra.(*Command).execute(0x10857fec0, {0x1f4b479dbc60, 0x2, 0x2})
	/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1019 +0x7fc
github.com/spf13/cobra.(*Command).ExecuteC(0x10857ed80)
	/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1148 +0x350
github.com/spf13/cobra.(*Command).Execute(0x10857ed80?)
	/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1071 +0x1c
main.main()
	/github/workspace/cmd/ramenctl.go:22 +0x74

How to reproduce

Steps to reproduce the behavior:

  1. Set up drenv clusters
  2. Add additional s3 profiles to ramen config
     s3StoreProfiles:
     - s3ProfileName: minio-on-dr1
       s3Bucket: bucket
       s3CompatibleEndpoint: http://192.168.64.28:30000
       s3Region: us-west-1
       s3SecretRef:
         name: ramen-s3-secret-dr1
         namespace: ramen-system
     - s3ProfileName: minio-on-dr2
       s3Bucket: bucket
       s3CompatibleEndpoint: http://192.168.64.27:30000
       s3Region: us-east-1
       s3SecretRef:
         name: ramen-s3-secret-dr2
         namespace: ramen-system
     - s3ProfileName: fake-profile-2
       s3Bucket: bucket
       s3CompatibleEndpoint: http://192.168.64.28:30000
       s3Region: us-west-1
       s3SecretRef:
         name: ramen-s3-secret-dr1
         namespace: ramen-system
     - s3ProfileName: fake-profile-2
       s3Bucket: bucket
       s3CompatibleEndpoint: http://192.168.64.27:30000
       s3Region: us-east-1
       s3SecretRef:
         name: ramen-s3-secret-dr2
         namespace: ramen-system
  3. Run: ramenctl validate clusters

Expected behavior

Duplicate profile displayed as validation error

Actual behavior

Panic, reports not created.

Output

v0.25.0-pre1-clusters-4.tar.gz

Workaround

Avoid duplicate s3 profiles names. This works:

    s3StoreProfiles:
    - s3ProfileName: minio-on-dr1
      s3Bucket: bucket
      s3CompatibleEndpoint: http://192.168.64.28:30000
      s3Region: us-west-1
      s3SecretRef:
        name: ramen-s3-secret-dr1
        namespace: ramen-system
    - s3ProfileName: minio-on-dr2
      s3Bucket: bucket
      s3CompatibleEndpoint: http://192.168.64.27:30000
      s3Region: us-east-1
      s3SecretRef:
        name: ramen-s3-secret-dr2
        namespace: ramen-system
    - s3ProfileName: fake-profile-1
      s3Bucket: bucket
      s3CompatibleEndpoint: http://192.168.64.28:30000
      s3Region: us-west-1
      s3SecretRef:
        name: ramen-s3-secret-dr1
        namespace: ramen-system
    - s3ProfileName: fake-profile-2
      s3Bucket: bucket
      s3CompatibleEndpoint: http://192.168.64.27:30000
      s3Region: us-east-1
      s3SecretRef:
        name: ramen-s3-secret-dr2
        namespace: ramen-system

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions