Skip to content

fix(operator): prevent panic on empty ingress, improve concurrency, and add unit tests - #6

Open
Aphelios01-sdk wants to merge 1 commit into
zenith-network:mainfrom
Aphelios01-sdk:fix/operator-robustness-and-cleanup
Open

Aphelios01-sdk wants to merge 1 commit into
zenith-network:mainfrom
Aphelios01-sdk:fix/operator-robustness-and-cleanup

Conversation

@Aphelios01-sdk

Copy link
Copy Markdown

Summary of Changes

  1. Prevent Panic on Empty Ingress:
    • In crates/operator-common/src/types/load_balancer.rs, Kubernetes can return an empty ingress vector (ingress: []). Indexing ingress[0].ip directly panicked the operator pod. Replaced with safe slice access (ingress.first() && first.ip.is_some()).
  2. Robust wait() Loop:
    • Replaced unsafe chain of .unwrap() calls in wait() with safe Option checking and specific error propagation (IngressListMissing, IngressListEmpty, IPTimeout).
  3. True Concurrency & Error Propagation in _create():
    • Moved join_next().await out of the task spawn loop so tasks execute concurrently across load balancers. Propagated inner kube errors using res??; instead of swallowing them.
  4. Cleanups:
    • Fixed copy-pasted error reason strings in crates/operator/src/types/storage.rs.
    • Removed redundant double deletion of {name}-identities configmap in crates/operator/src/types/bootstrap.rs.
  5. Unit Tests:
    • Added 12 passing unit tests covering labels, address names, error metric conversions, safe ingress checks, and identity serialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant