Use reflector for all repeated read operations, set read timeout & a test timeout greater than that, CI stress edition - #330
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Jakob-Naucke The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideRefactors the operator to use a unified OperatorContext backed by reflector caches for repeated reads, switches several config/deployment mutations to server-side apply patches, adjusts controllers and tests accordingly, and tightens CI and runtime timeouts for more reliable stress testing. Sequence diagram for keygen_reconcile using reflector-backed OperatorContextsequenceDiagram
actor Operator
participant Machine
participant KeygenController as keygen_reconcile
participant OperatorContext
participant Trustee as trustee
participant TecStore as tec_store
Operator->>Machine: create/update Machine
Machine-->>KeygenController: event
KeygenController->>OperatorContext: access client
KeygenController->>Machine: inspect spec.id
alt Event::Apply
KeygenController->>Machine: generate_owner_reference(machine)
KeygenController->>trustee: generate_secret(client, id, owner_reference)
KeygenController->>trustee: mount_secret(OperatorContext, id)
KeygenController-->>Operator: Action::await_change
else Event::Cleanup
KeygenController->>Machine: read owner_references
KeygenController->>TecStore: get(ObjectRef::new(tec_name).within(ns))
alt TEC deleting or missing
KeygenController-->>Operator: Action::await_change
else TEC active
KeygenController->>trustee: unmount_secret(OperatorContext, id)
KeygenController-->>Operator: Action::await_change
end
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
ee8469d to
0a80458
Compare
Extend the use of a reflector cache from attestation keys to the entire operator. Replace AkContextData with OperatorContext to pass caches. Use server-side apply patches instead of get+replace. - Updating image-pcrs without the cache is only used in compute-pcrs now, thus inline the macro - trustee::update_reference_values receives PCRs from argument, it is sometimes available from the call site anyhow Fixes: trusted-execution-clusters#251 Signed-off-by: Jakob Naucke <jnaucke@redhat.com> Assisted-by: AI
so that status is updated in a timely manner Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
0a80458 to
7ec60fc
Compare
|
Had one VM that didn't boot up, cause cannot be uncovered from logs (from dmesg one can only tell it has failed, and Trustee was restarted). We are working on improving observability of Trustee, but should also log failures from trustee-attester without leaking secrets. FWIW, the failure could be explained by a missing secret which has been seen on Azure and should improve with #248. For now, rerun. |
7ec60fc to
1f4f137
Compare
| "metadata": { "name": TRUSTEE_DATA_MAP }, | ||
| "data": { REFERENCE_VALUES_FILE: rv_json } | ||
| })); | ||
| let pp = PatchParams::apply("trusted-cluster-operator").force(); |
There was a problem hiding this comment.
Yes, this is an apply patch, not a merge patch:
[2026-08-19T13:28:45Z WARN operator::reference_values] PCR computation for coreos-approved-primary failed: ApiError: PatchOptions.meta.k8s.io "" is invalid: fieldManager: Required value: is required for apply patch: Invalid (Status { status: Some(Failure), code: 422, message: "PatchOptions.meta.k8s.io \"\" is invalid: fieldManager: Required value: is required for apply patch", metadata: Some(ListMeta { continue_: None, remaining_item_count: None, resource_version: None, self_link: None }), reason: "Invalid", details: Some(StatusDetails { name: "", group: "meta.k8s.io", kind: "PatchOptions", uid: "", causes: [StatusCause { reason: "FieldValueRequired", message: "Required value: is required for apply patch", field: "fieldManager" }], retry_after_seconds: 0 }) })
| } | ||
| })); | ||
| let deployments: Api<Deployment> = Api::default_namespaced(client.clone()); | ||
| let pp = PatchParams::apply("trusted-cluster-operator").force(); |
There was a problem hiding this comment.
same is the force necessary?
| }], | ||
| path: format!("default/{id}/root"), | ||
| num_retries: None, | ||
| num_retries: Some(NumRetries::Finite(RETRIES)), |
There was a problem hiding this comment.
We can also set it to infinite, not sure we are ready for this though. If not can you please add a todo so we don't forget it
| ATTESTATION_KEY_REGISTER_IMAGE=$(REGISTRY)/attestation-key-register:$(TAG) | ||
| TRUSTEE_IMAGE ?= quay.io/trusted-execution-clusters/key-broker-service:v0.17.0 | ||
| TEST_IMAGE ?= quay.io/trusted-execution-clusters/fedora-coreos-kubevirt:42.20260622 | ||
| TEST_IMAGE ?= quay.io/trusted-execution-clusters/fedora-coreos-kubevirt:42.20251012.2.0-console-fwd |
There was a problem hiding this comment.
I want to mention I only meant this for the CI debugging and would have removed before moving out of draft, but I built this with
[Journal]
ForwardToConsole=yesin /usr/lib/systemd/journald.conf.d
|
@Jakob-Naucke do we plan to merge this after #248 ? It will cause /again) a lot of rebase otherwise |
I'll respond to your other comments later but I have no objections against merging #248 first and rebasing this |
for reuse Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
Add a label to secrets and watch only by the label Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
Set read timeout of 295s (same as write) so that hanging operations can retry. Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
| deployments | ||
| .patch( | ||
| TRUSTEE_DEPLOYMENT, | ||
| &PatchParams::apply("trusted-cluster-operator").force(), |
There was a problem hiding this comment.
Is the force necessary?
@alicefr I'll test without but I'd also like to ask why you added it here itfp see other response
| ATTESTATION_KEY_REGISTER_IMAGE=$(REGISTRY)/attestation-key-register:$(TAG) | ||
| TRUSTEE_IMAGE ?= quay.io/trusted-execution-clusters/key-broker-service:v0.17.0 | ||
| TEST_IMAGE ?= quay.io/trusted-execution-clusters/fedora-coreos-kubevirt:42.20260622 | ||
| TEST_IMAGE ?= quay.io/trusted-execution-clusters/fedora-coreos-kubevirt:42.20251012.2.0-console-fwd |
There was a problem hiding this comment.
I want to mention I only meant this for the CI debugging and would have removed before moving out of draft, but I built this with
[Journal]
ForwardToConsole=yesin /usr/lib/systemd/journald.conf.d
Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
Local network on GHA has been seen to be less reliable than local development and production clusters. Set a test timeout multiplier large enough to let one read time out and retry. Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
Signed-off-by: Jakob Naucke <jnaucke@redhat.com>
1f4f137 to
6c1745b
Compare
Summary by Sourcery
Consolidate controller caching and timeout handling to reduce repeated Kubernetes reads and improve retry resilience.
Bug Fixes:
Enhancements:
Build:
CI:
Tests:
Chores: