kubernetes-client / kubernetes-client/javascript

Since 1.2.0 NetworkPolicies are not rendered correctly (and not applied correctly)

Đang mở
#2,825 6 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Ngôn ngữ chính
TypeScript
Star
2.3k
Fork
568
Merge trung bình
17 giờ 57 phút
Pull request đã merge (30 ngày)
41

Mô tả

**Describe the bug**
When using the library, the replace functionality does not correctly propragate to the cluster. Set fields are removed unexpectedly. Confirmed 1.1.2 does not have this behaviour, 1.2.0 (up to 1.4.0) starts to have it (most likely due to https://github.com/kubernetes-client/javascript/issues/2396)

**Client Version**
e.g. `1.4.0`

**Server Version**
e.g. `1.33.0`

**To Reproduce**
Apply
```
{
"apiVersion": "networking.k8s.io/v1",
"kind": "NetworkPolicy",
"metadata": {
"name": "np",
"namespace": "default",
},
"spec": {
"ingress": [
{
"from": [
{
"namespaceSelector": {
"matchLabels": {
"kubernetes.io/metadata.name": "nginx"
}
},
"podSelector": {
"matchLabels": {
"app.kubernetes.io/component": "controller"
}
}
}
],
"ports": [
{
"port": 9000,
"protocol": "TCP"
}
]
}
],
"podSelector": {},
"policyTypes": [
"Ingress"
]
}
}
```

Observe the applied is (output is different based on version). The NS selector is gone:

```
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: np
namespace: default
spec:
ingress:
ports:
- port: 9000
protocol: TCP
podSelector: {}
policyTypes:
- Ingress
```

**Expected behavior**
The NS selector to be valid.

**Example Code**
Code snippet for what you are doing

**Environment (please complete the following information):**

AWS Lambda on Node 22.x

**Additional context**
1.1.2 works, 1.2.0 changes the output, 1.4.0 has even different output.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện việc thay thế NetworkPolicy bằng manifest trong issue trên các phiên bản client 1.1.2, 1.2.0 và 1.4.0 trên Kubernetes 1.33.0. Đọc issue kubernetes-client/javascript #2396 được liên kết và so sánh resource đã được áp dụng, đặc biệt là namespaceSelector. Hoàn thành có nghĩa là việc thay thế vẫn giữ nguyên namespace selector và các trường NetworkPolicy liên quan.

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

Đánh giá

Công nghệ
aws, kubernetes, node.js, typescript
Lĩnh vực
devops, networking, security
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

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.