Skip to content

kluctlDeployment name length issues #1290

@elixxx

Description

@elixxx

Operating system

Ubuntu 24.10

Kluctl Version

2.25.1 - controller

Kubernetes Version

v1.31.5

kubectl Version

v1.31

Bug description

The kluctl gitops diff command ends up in a error when a kluctlDeployment is create with a name more then 63 Characters.
This happening because the controller can not create a result-secret as it reuse the name of the deployment for a label of the result-secret.
Names of resources and label keys/values are not compatible types and we need some sort of "type-conversion". see: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/

I think the biggest difference we have to care about are:

  • Length:
    • Name: 253 chars
    • label-value: 63 chars
  • For some cases label-values should not start with numbers

Steps to reproduce

  1. Create a kluctlDeployment with a name more than 63 charecters
  2. execute kluctl gitops diff --namespace --name
  3. expecting error in controller log

Relevant log output

{
  "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