Skip to content

Unexpected handling of integer/long parameters #1779

Open
@bearpaws

Description

@bearpaws

What happened:
Defined a parameter of type integer with a default value:

- name: MY_PARAM
  default: 432000000
  type: integer

Packaging the operator resulted in this error:

parameter "MY_PARAM" has an invalid default value:
type is "integer" but format of %!s(float64=4.32e+08) is invalid

Changed the type to long which solved the first error. But when the param is used in a template:

myParam={{ .Params.MY_PARAM }}

It is rendered as:

myParam=4.32e+08

Same thing happens when trying this:

myParam={{ .Params.MY_PARAM | toString }}

What you expected to happen:
The default value of an integer parameter should not be parsed as a float.

When rendering an integer or long, it should not be formatted using scientific notation.

How to reproduce it (as minimally and precisely as possible):

  1. Define a param of type integer with a valid default value
  2. Reference the param in a template.
  3. Build the operator: kubectl-kudo package create ./operator --destination /tmp

Anything else we need to know?:
It's not clear if integer/long types are actually supported.

The docs show only array and map types: https://kudo.dev/docs/developing-operators/parameters.html#declaring-parameters

Yet this KEP (#988) has been completed and kudo allows integer and long params to be defined.

Environment:

  • Kubernetes version (use kubectl version): 1.19.3
  • Kudo version (use kubectl kudo version): 0.18.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions