gloo icon indicating copy to clipboard operation
gloo copied to clipboard

socketOptions transformed into Integers

Open juli-vert opened this issue 2 years ago • 0 comments

Gloo Edge Version

1.10.x

Kubernetes Version

1.19.x

Describe the bug

We use socketOptions like:

socketOptions:
            - description: "enable keep-alive"
              level: 1
              name: 9
              intValue: 1
              state: STATE_PREBIND
            - description: "idle time before first keep-alive probe is sent"
              level: 6
              name: 4
              intValue: 60
              state: STATE_PREBIND
            - description: "keep-alive interval"
              level: 6
              name: 5
              intValue: 20
              state: STATE_PREBIND
            - description: "keep-alive probes count"
              level: 6
              name: 6
              intValue: 2
              state: STATE_PREBIND

It is working fine for some of the installations we have, but some are reporting (ArgoCD) a mismatch due the type of value (String instead of Integer).

socketOptions:
--
description: enable keep-alive
- intValue: '1'
- level: '1'
- name: '9'
+ intValue: 1
+ level: 1
+ name: 9
+ state: STATE_PREBIND

The actual gateway object has configured the Strings with no complains from the validation webhook:

k get gw gateway-proxy-internal-ssl -o jsonpath='{.spec.options.socketOptions}' | jq
[
  {
    "description": "enable keep-alive",
    "intValue": "1",
    "level": "1",
    "name": "9"
  },
  {
    "description": "idle time before first keep-alive probe is sent",
    "intValue": "60",
    "level": "6",
    "name": "4"
  },
  {
    "description": "keep-alive interval",
    "intValue": "20",
    "level": "6",
    "name": "5"
  },
  {
    "description": "keep-alive probes count",
    "intValue": "2",
    "level": "6",
    "name": "6"
  }
]

Steps to reproduce the bug

if I try to make any silly modification, then it complains about having strings when expecting integers:

# gateways.gateway.solo.io "gateway-proxy-internal-ssl" was not valid:
# * <nil>: Invalid value: "The edited file failed validation": [ValidationError(Gateway.spec.options.socketOptions[0].intValue): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.intValue: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[0].level): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.level: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[1].intValue): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.intValue: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[1].level): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.level: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[1].name): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.name: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[2].intValue): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.intValue: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[2].level): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.level: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[2].name): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.name: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[3].intValue): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.intValue: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[3].level): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.level: got "string", expected "integer", ValidationError(Gateway.spec.options.socketOptions[3].name): invalid type for io.solo.gateway.v1.Gateway.spec.options.socketOptions.name: got "string", expected "integer"]

Expected Behavior

Fields type being respected and state being preserved

Additional Context

Same behavior was reported #5081

juli-vert avatar Apr 21 '22 15:04 juli-vert