stackabletech / operator-rs

A simple wrapper/framework around kube-rs to make implementing Operators/Controllers easier
Apache License 2.0
116 stars 12 forks source link

Cannot change tcp liveness probes with pod overrides #747

Open razvan opened 6 months ago

razvan commented 6 months ago

Affected version

0.0.0-dev

Current and expected behavior

  1. When using an integer as as port property:
....
      automatic-log-config:
        podOverrides:
          spec:
            containers:
              - name: airflow
                livenessProbe:
                  tcpSocket:
                    port: 8080
                  initialDelaySeconds: 30
                  periodSeconds: 5
                  failureThreshold: 6

An error is raised complaining that the property must be a string:

    case.go:366: AirflowCluster.airflow.stackable.tech "airflow" is invalid: [spec.webservers.roleGroups.automatic-log-config.podOverrides.spec.containers[0].livenessProbe.tcpSocket.port: Invalid value: "integer": spec.webservers.roleGroups.automatic-log-config.podOverrides.spec.containers[0].livenessProbe.tcpSocket.port in body must be of type string: "integer", spec.webservers.roleGroups.custom-log-config.podOverrides.spec.containers[0].livenessProbe.tcpSocket.port: Invalid value: "integer": spec.webservers.roleGroups.custom-log-config.podOverrides.spec.containers[0].livenessProbe.tcpSocket.port in body must be of type string: "integer"]
  1. When using a string as the tcpSocket.port property, the value must contain the name of the port and not the port number. So "http" and not "8080"

Possible solution

Maybe use k8s-openapi 0.21.1 to pull in https://github.com/Arnavion/k8s-openapi/pull/153

Additional context

It is apparently a known bug: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#intorstring

Environment

No response

Would you like to work on fixing this bug?

maybe