Skip to content

Commit a799d14

Browse files
committed
Fix typos linter: rename ot to xfer
1 parent f44ca9e commit a799d14

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

docs/TESTING_TFTP.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ apiVersion: networking.metal.ironcore.dev/v1alpha1
2323
kind: Device
2424
metadata:
2525
name: device-tftp-test
26-
labels:
27-
networking.metal.ironcore.dev/device-ip: "100.100.5.155"
2826
spec:
2927
endpoint:
3028
address: 100.100.5.155:22
@@ -43,6 +41,10 @@ kubectl -n netop-dev-minmin patch device device-tftp-test \
4341
--type=merge -p '{"status":{"serialNumber":"tftp-test-serial"}}' --subresource=status
4442
```
4543

44+
Note: the controller automatically sets `device-ip` and `device-serial` labels from
45+
`spec.endpoint.address` and `status.serialNumber` on every reconcile — no need to add
46+
them manually.
47+
4648
Verify server logs
4749
```
4850
kubectl -n netop-dev-minmin logs deployment/network-operator-controller-manager --tail=200 | grep -E "TFTP|tftp"
@@ -69,12 +71,16 @@ kubectl -n netop-dev-minmin exec tftp-test -- sh -c \
6971
```
7072
Expected: server error (unknown serial).
7173

72-
2) **Wrong client IP** (simulate by changing `DeviceIPLabel` or use a pod from a different IP):
74+
2) **Wrong client IP** (simulate by changing `spec.endpoint.address` to a different IP):
7375
```
7476
kubectl -n netop-dev-minmin patch device device-tftp-test \
75-
--type=merge -p '{"metadata":{"labels":{"networking.metal.ironcore.dev/device-ip":"203.0.113.10"}}}'
77+
--type=merge -p '{"spec":{"endpoint":{"address":"203.0.113.10:22"}}}'
7678
```
77-
Then retry TFTP; expect IP mismatch error.
79+
The controller will update `DeviceIPLabel` to `203.0.113.10` on the next reconcile.
80+
Then retry TFTP from the original pod; expect IP mismatch error.
81+
82+
Note: do not patch `DeviceIPLabel` directly — the controller reconciles it from
83+
`spec.endpoint.address` and will overwrite any manual change.
7884

7985
Cleanup
8086
```

internal/tftp/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func New(addr string, verify bool, reader client.Reader, logger *log.Logger) *Se
3838
func (s *Server) Start(ctx context.Context) error {
3939
readHandler := func(filename string, rf io.ReaderFrom) error {
4040
srcIP := ""
41-
if ot, ok := rf.(tftp.OutgoingTransfer); ok {
42-
ra := ot.RemoteAddr()
41+
if xfer, ok := rf.(tftp.OutgoingTransfer); ok {
42+
ra := xfer.RemoteAddr()
4343
srcIP = ra.IP.String()
4444
}
4545
if srcIP == "" {
@@ -91,8 +91,8 @@ func (s *Server) Start(ctx context.Context) error {
9191
return errors.New("empty bootscript")
9292
}
9393

94-
if ot, ok := rf.(tftp.OutgoingTransfer); ok {
95-
ot.SetSize(int64(len(bootScript)))
94+
if xfer, ok := rf.(tftp.OutgoingTransfer); ok {
95+
xfer.SetSize(int64(len(bootScript)))
9696
}
9797

9898
n, err := rf.ReadFrom(bytes.NewReader(bootScript))

0 commit comments

Comments
 (0)