8000 "gitops diff" endup in Stacktrace if no result-secret is created · Issue #1289 · kluctl/kluctl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
"gitops diff" endup in Stacktrace if no result-secret is created #1289
Closed
@elixxx

Description

@elixxx

Operating system

Ubuntu 25.10 and other Linux based

Kluctl Version

2.26.0

Kubernetes Version

v1.31

kubectl Version

v1.31

Bug description

We are using kluctl-controller to deploy services from different repositories. Today i was working on implementing a gitlab-job which should run on an open MR and executes "kluctl gitops diff --namespace --name ". After solving all permissions issue the pipeline works nice in the testing repository.

When using the same code in another repository and execution "kluctl gitops diff" i getting a Stacktrace. Same is also the case if i executing the command locally with admin permissions.

The error is happening because no result-secret is created and missing result-secret is not handled by the application.

Steps to reproduce

  1. Create a kluctlDeployment with a name more than 63 charecters (this leads to error in creating secret labels)
  2. execute kluctl gitops diff --namespace <namespace> --name <deploymentName>
  3. expecting a stack trace

Relevant log output

# local kluctl command results:
Writing command result 707290f9-8564-442c-b16c-944fb9856a28
Writing command result failed
command finished with 0 errors and 2 warnings
Finishing handling of manual request
Reconciliation finished in 2.305470514s, next run in 0s
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x258 pc=0x2924b30]

goroutine 1 [running]:
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.formatCommandResultText(0x0, 0x0)
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/command_result.go:28 +0x50
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.formatCommandResult(0x4?, {0x31fa619?, 0x31fa619?}, 0x40?)
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/command_result.go:135 +0x3f
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.outputCommandResult2.func1({0x31fa619?, 0x4?})
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/command_result.go:272 +0x29
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.outputHelper({0x827aa30, 0xc000b30660}, {0xa007980?, 0x827aa30?, 0x24?}, 0xc000bed470)
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/command_result.go:211 +0xea
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.outputCommandResult2({0x827aa30, 0xc000b30660}, {{0xa007980?, 0xc000b30660?, 0xc001080f90?}, 0x90?, 0xf?}, 0x0)
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/command_result.go:271 +0xd9
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.(*gitopsDiffCmd).Run(0xc00049f960, {0x827aa30, 0xc000b30660})
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/cmd_gitops_diff.go:58 +0x3d6
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.(*rootCommand).buildCobraCmd.func1(0xc000994908?, {0x31fa601?, 0x4?, 0x31fa709?})
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/cobra_utils.go:73 +0x2d
github.com/spf13/cobra.(*Command).execute(0xc000994908, {0xc00039e0e0, 0x7, 0x7})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:985 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc00041f808)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.1/command.go:1041
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.Execute({0x827a9f8, 0xa007980}, {0xc000072150, 0x9, 0x9}, 0xc000814810)
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/root.go:386 +0x2aa
github.com/kluctl/kluctl/v2/cmd/kluctl/commands.Main()
        /home/runner/work/kluctl/kluctl/cmd/kluctl/commands/root.go:267 +0xfe
main.main()
        /home/runner/work/kluctl/kluctl/cmd/main.go:27 +0x47

# log of the kluctl controller: 
  "level": "error",
  "ts": "2025-03-04T06:46:13Z",
  "msg": "Writing validate result failed",
  "controller": "kluctldeployment",
  "controllerGroup": "gitops.kluctl.io",
  "controllerKind": "KluctlDeployment",
  "KluctlDeployment": {
    "name": "cloud-services-backend-third-party-api-documentation-third-party",
    "namespace": "staging-third-party-api"
  },
  "namespace": "staging-third-party-api",
  "name": "cloud-services │-backend-third-party-api-documentation-third-party",
  "reconcileID": "490995ec-724f-43ba-b7c0-ba0c1cca10ca",
  "error": "Secret \"vr-documentation-fa4aebd0-5592-40e6-8553-15384d4cfda9\" is invalid: metadata.labels: Invalid value: \"cloud-services-backend-third-party-api-documentation-third-party\": must be no more than 63 characters",
  "stacktrace": ""
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0