Skip to content

Problems with int32 conversion? #975

@strowi

Description

@strowi

Hi,

running krane-3.6.0 i ran into the following issue:

Using grafana/tanka i get the following json to apply to k8s-1.30.

...
      "priority_class_postgres_operator_pod": {
        "apiVersion": "scheduling.k8s.io/v1",
        "description": "Use only for databases controlled by Postgres operator",
        "globalDefault": false,
        "kind": "PriorityClass",
        "metadata": {
          "labels": {
            "app.kubernetes.io/instance": "postgres-operator",
            "app.kubernetes.io/managed-by": "Helmraiser",
            "app.kubernetes.io/name": "postgres-operator",
            "helm.sh/chart": "postgres-operator-1.14.0"
          },
          "name": "postgres-operator-pod",
          "namespace": "app"
        },
        "preemptionPolicy": "PreemptLowerPriority",
        "value": 1000000
      },
...

But deploying with krane fails with the following error:

[FATAL][2025-02-17 12:00:50 +0000]	Invalid template: PriorityClass-postgres-operator-pod20250217-589-k00em4.yml
[FATAL][2025-02-17 12:00:50 +0000]	> Error message:
[FATAL][2025-02-17 12:00:50 +0000]	    Error from server (BadRequest): error when creating "/tmp/d20250217-589-vzxhvs/PriorityClass-postgres-operator-pod20250217-589-k00em4.yml": PriorityClass in version "v1" cannot be handled as a PriorityClass: json: cannot unmarshal string into Go struct field PriorityClass.value of type int32
[FATAL][2025-02-17 12:00:50 +0000]	> Template content:
[FATAL][2025-02-17 12:00:50 +0000]	    ---
[FATAL][2025-02-17 12:00:50 +0000]	    apiVersion: scheduling.k8s.io/v1
[FATAL][2025-02-17 12:00:50 +0000]	    description: Use only for databases controlled by Postgres operator
[FATAL][2025-02-17 12:00:50 +0000]	    globalDefault: false
[FATAL][2025-02-17 12:00:50 +0000]	    kind: PriorityClass
[FATAL][2025-02-17 12:00:50 +0000]	    metadata:
[FATAL][2025-02-17 12:00:50 +0000]	      labels:
[FATAL][2025-02-17 12:00:50 +0000]	        app.kubernetes.io/instance: postgres-operator
[FATAL][2025-02-17 12:00:50 +0000]	        app.kubernetes.io/managed-by: Helmraiser
[FATAL][2025-02-17 12:00:50 +0000]	        app.kubernetes.io/name: postgres-operator
[FATAL][2025-02-17 12:00:50 +0000]	        helm.sh/chart: postgres-operator-1.14.0
[FATAL][2025-02-17 12:00:50 +0000]	        tanka.dev/environment: 809e5090a4bc8f682ecfaf6007b78d885458f3576feecf7a
[FATAL][2025-02-17 12:00:50 +0000]	      name: postgres-operator-pod
[FATAL][2025-02-17 12:00:50 +0000]	      namespace: app
[FATAL][2025-02-17 12:00:50 +0000]	    preemptionPolicy: PreemptLowerPriority
[FATAL][2025-02-17 12:00:50 +0000]	    value: "1e+06"

Which looks to me like krane is converting the 10000 to a string "1e+06" which kubernetes doesn't like?

regards,
strowi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions