SpEL expression issue: Must be of type string: "integer"


Issue

Error noticed: spec.endpoints.metricRelabelings.replacement in body must be of type string: "integer"

This error indicates that replacement expects a string instead of an integer.  In the CRD some values may contain Regex expressions like ${}.  These characters in Spinnaker are used to evaluate SPEL expressions.  

There is a way to escape these characters but doesn't work for numbers at this time.

Cause

Spinnaker is evaluating the expression and returning an integer causing the error.

Solution

This seems to be a known problem:

https://github.com/spinnaker/spinnaker/issues/5910


The PR that created this feature also says that it doesn’t stop expressions from being evaluated:

https://github.com/spinnaker/orca/pull/2761


Google says that they are actively working on this. It may not be considered a “fix”, though, since it’s part of a large refactor.

As Tested On Version

2.20.x