Kubernetes reference chart: an operator command can leave an unowned NetworkPolicy when the policy create times out

Đang mở Phù hợp với người mới
#2,761 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
62/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
kubernetes, python
Lĩnh vực
devops, infrastructure

Hướng nghiên cứu

Bắt đầu trong deploy/stack_operator.py tại Installation.job() và đi theo thứ tự tạo NetworkPolicy, tạo Job và gán active_job; sau đó tìm đường đi giải phóng Lease khi thất bại. Tìm các bài kiểm thử operator hiện có xung quanh việc tạo job để xem các lệnh gọi kubectl được stub như thế nào, vì bạn sẽ cần một trường hợp policy bị lỗi. Bản sửa là hoặc thử kubectl delete networkpolicy --ignore-not-found trước khi giải phóng Lease, hoặc giữ Lease và báo cáo cần kiểm tra đối tượng nào, vậy hoàn tất nghĩa là đường đi tạo không chắc chắn không để lại policy nào không có chủ và lỗi được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Installation.job() in deploy/stack_operator.py creates an operation Job's NetworkPolicy before it sets active_job. If kubectl create for the policy fails with an uncertain outcome, such as a server timeout or a lost connection, the operator releases its Lease. The policy may still exist.

That policy has no owner reference yet, because the owner is set to the Job only after the Job is created, and it has no TTL. So it stays until someone deletes it by hand.

Impact: low. The policy selects only the unique registrystack.org/operation-id label of an operation that never ran, so it affects no other workload. It is clutter, and it is left over after an operator command that did not report it.

Possible fixes:

  • On a failed policy create, try once to kubectl delete networkpolicy <name> --ignore-not-found before releasing the Lease, and report if that delete also fails.
  • Or treat an uncertain policy create like an uncertain Job create: keep the Lease and tell the operator which object to check.

Found during the review of #2758. It is older than #2758 and was left out of that PR.

Ngôn ngữ chính
Rust
Star
2
Fork
0
Merge trung bình
9 giờ 48 phút
Pull request đã merge (30 ngày)
151

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của registrystack/registry-stack

Tất cả issue của registrystack/registry-stack

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.