Skip to content

Commit 0486aaa

Browse files
authored
Merge branch 'kubernetes-sigs:main' into main
2 parents 9779ed5 + 0e3f6b5 commit 0486aaa

39 files changed

Lines changed: 508 additions & 377 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.so
66
*.dylib
77
bin/*
8+
hack/tools/bin
89
Dockerfile.cross
910

1011
# Test binary, built with `go test -c`

.golangci-kal.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: "2"
2+
run:
3+
go: "1.24"
4+
allow-parallel-runners: true
5+
linters:
6+
default: none
7+
enable:
8+
- kubeapilinter # linter for Kube API conventions
9+
settings:
10+
custom:
11+
kubeapilinter:
12+
type: module
13+
description: KAL is the Kube-API-Linter and lints Kube like APIs based on API conventions and best practices.
14+
settings:
15+
linters:
16+
enable:
17+
- "nophase" # Phase fields are discouraged by the Kube API conventions, use conditions instead.
18+
disable:
19+
- "*" # We will manually enable new linters after understanding the impact. Disable all by default.
20+
exclusions:
21+
generated: strict
22+
paths:
23+
- ".*_test.go" # Exclude test files.
24+
rules:
25+
## KAL should only run on API folders.
26+
- path-except: "api//*"
27+
linters:
28+
- kubeapilinter
29+
30+
issues:
31+
max-same-issues: 0
32+
max-issues-per-linter: 0

CONTEXT.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This project implements a Kubernetes controller that manages node taints based o
88

99
### Core Components
1010

11-
1. **NodeReadinessGateRule CRD**: Defines rules mapping multiple node conditions to a single taint
11+
1. **NodeReadinessRule CRD**: Defines rules mapping multiple node conditions to a single taint
1212
2. **ReadinessGateController**: Main controller that processes rules and manages node taints
1313
3. **NPD Integration**: Works with Node Problem Detector for condition monitoring
1414
4. **Validation Webhook**: Prevents conflicting rule configurations
@@ -26,28 +26,28 @@ This project implements a Kubernetes controller that manages node taints based o
2626

2727
```
2828
├── api/v1alpha1/
29-
│ ├── nodereadinessgaterule_types.go # CRD type definitions
29+
│ ├── nodereadinessrule_types.go # CRD type definitions
3030
│ ├── groupversion_info.go # API version info
3131
│ └── zz_generated.deepcopy.go # Generated deep copy methods
3232
├── internal/controller/
33-
│ ├── nodereadinessgaterule_controller.go # Rule reconciler
33+
│ ├── nodereadinessrule_controller.go # Rule reconciler
3434
│ ├── node_controller.go # Node reconciler
35-
│ ├── nodereadinessgaterule_controller_test.go # Rule controller tests
35+
│ ├── nodereadinessrule_controller_test.go # Rule controller tests
3636
│ ├── node_controller_test.go # Node controller tests
3737
│ └── suite_test.go # Test suite setup
3838
├── cmd/
3939
│ └── main.go # Controller entrypoint
4040
├── config/
4141
│ ├── crd/bases/
42-
│ │ └── readiness.node.x-k8s.io_nodereadinessgaterules.yaml # Generated CRD
42+
│ │ └── readiness.node.x-k8s.io_nodereadinessrules.yaml # Generated CRD
4343
│ ├── rbac/
4444
│ │ ├── role.yaml # Controller RBAC
4545
│ │ ├── role_binding.yaml # RBAC binding
4646
│ │ └── service_account.yaml # Service account
4747
│ ├── manager/
4848
│ │ └── manager.yaml # Controller deployment
4949
│ ├── samples/
50-
│ │ └── v1alpha1_nodereadinessgaterule.yaml # Example rule
50+
│ │ └── v1alpha1_nodereadinessrule.yaml # Example rule
5151
│ └── default/
5252
│ └── kustomization.yaml # Default kustomize config
5353
├── test/
@@ -64,7 +64,7 @@ This project implements a Kubernetes controller that manages node taints based o
6464

6565
### Controller Implementation
6666

67-
Files: internal/controller/nodereadinessgaterule_controller.go + internal/controller/node_controller.go
67+
Files: internal/controller/nodereadinessrule_controller.go + internal/controller/node_controller.go
6868
Content: Controller logic split into two files - rule reconciler and node reconciler
6969

7070
### Main Entry
@@ -73,7 +73,7 @@ Controller logic start here: cmd/main.go
7373

7474
### Generated CRD
7575

76-
Kubebuilder generated schema: config/crd/bases/readiness.node.x-k8s.io_nodereadinessgaterules.yaml
76+
Kubebuilder generated schema: config/crd/bases/readiness.node.x-k8s.io_nodereadinessrules.yaml
7777

7878
### RBAC
7979

@@ -102,18 +102,18 @@ generated: config/rbac/*.yaml (multiple files via kubebuilder)
102102

103103
### Development Workflow
104104

105-
* Modify types in `api/v1alpha1/nodereadinessgaterule_types.go`
105+
* Modify types in `api/v1alpha1/nodereadinessrule_types.go`
106106
* Run `make generate manifests` to update generated files
107107
* Updated controller logic in `internal/controller/*.go`
108108
* Test with `make test`
109109
* Deploy with `make deploy`
110110

111111
## Key Types and Data Structures
112112

113-
### NodeReadinessGateRule CRD
113+
### NodeReadinessRule CRD
114114

115115
```go
116-
type NodeReadinessGateRuleSpec struct {
116+
type NodeReadinessRuleSpec struct {
117117
// Multiple conditions that must ALL be satisfied
118118
Conditions []ConditionRequirement `json:"conditions"`
119119

@@ -154,7 +154,7 @@ const (
154154
### Status Tracking
155155

156156
```go
157-
type NodeReadinessGateRuleStatus struct {
157+
type NodeReadinessRuleStatus struct {
158158
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
159159
Conditions []metav1.Condition `json:"conditions,omitempty"`
160160
AppliedNodes []string `json:"appliedNodes,omitempty"`
@@ -186,7 +186,7 @@ type ConditionEvaluationResult struct {
186186

187187
The controller uses multiple reconcilers:
188188

189-
1. **RuleReconciler**: Handles NodeReadinessGateRule changes
189+
1. **RuleReconciler**: Handles NodeReadinessRule changes
190190
- Updates rule cache
191191
- Processes dry run evaluations
192192
- Re-evaluates all applicable nodes when rules change
@@ -247,7 +247,7 @@ if shouldRemoveTaint && currentlyHasTaint {
247247
### CNI Readiness Rule
248248
```yaml
249249
apiVersion: readiness.node.x-k8s.io/v1alpha1
250-
kind: NodeReadinessGateRule
250+
kind: NodeReadinessRule
251251
metadata:
252252
name: cni-readiness-rule
253253
spec:
@@ -269,7 +269,7 @@ spec:
269269
### Storage Readiness Rule
270270
```yaml
271271
apiVersion: readiness.node.x-k8s.io/v1alpha1
272-
kind: NodeReadinessGateRule
272+
kind: NodeReadinessRule
273273
metadata:
274274
name: storage-readiness-rule
275275
spec:

0 commit comments

Comments
 (0)