HoustonPutman opened a new pull request, #933:
URL: https://github.com/apache/solr-operator/pull/933
The operator compares the resources it wants against the ones in the
cluster, which Kubernetes has filled in defaults for. Any field that the
operator leaves unset, but that Kubernetes defaults, looked like a change. So
the operator sent an Update on every reconcile and logged `Update required
because field changed`, even though the Update changed nothing. For example:
```
"field":"Spec.Template.Spec.Volumes[0].VolumeSource",
"from":{"configMap":{"name":"solr-exporter-config", ..., "defaultMode":420}},
"to":{"configMap":{"name":"solr-exporter-config", ...}}
```
These are the fields that caused it:
| Where | Field Kubernetes defaults |
|---|---|
| ConfigMap, Secret, DownwardAPI and projected volumes | `defaultMode` |
| DownwardAPI volumes and env vars | the `apiVersion` of a `fieldRef` |
| Projected service account tokens | `expirationSeconds` |
| HostPath volumes, including the operator's own ephemeral `hostPath` data
volume | `type` |
| AzureDisk volumes | `cachingMode`, `kind` |
| Volumes without a source | become an `emptyDir` |
| Probes | `timeoutSeconds`, `periodSeconds`, `successThreshold`,
`failureThreshold`, the HTTP GET `scheme` and the gRPC `service` |
| Lifecycle hooks | the HTTP GET `scheme` |
| Services with `ClientIP` session affinity | `sessionAffinityConfig` |
Where the desired container, volume or Service leaves one of these fields
unset, the operator now keeps the value it finds in the cluster. So these
fields are only reconciled when a value is explicitly set. This follows what
`CopyServiceFields` already did for `sessionAffinity`. `sessionAffinityConfig`
is still removed when the session affinity is no longer `ClientIP`, since
Kubernetes only allows it with `ClientIP`.
The trade-off is that if one of these fields is set and later removed, the
old value stays on the cluster instead of going back to the Kubernetes default.
The operator now also logs when one of its Updates doesn't change anything.
That message, with the `Update required because field changed` lines before it,
points at a field that is still compared wrongly, e.g. one that a mutating
webhook fills in, which envtest can't see.
The tests are in a separate PR, #TESTS_PR. They found most of these fields:
every envtest spec fails if the operator sends an Update that changes nothing,
and new specs set every option of the CRDs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]