Commit Graph

134 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
57e68a76e3 Merge pull request #135842 from liyuerich/commentstartauthentication
enable commentstart check on authentication API group
2026-01-17 08:35:22 +05:30
Patrick Ohly
e058fbdd99 golangci-lint: enforce control over ginkgo.ReportBeforeSuite/ReportAfterSuite
https://git.k8s.io/enhancements/keps/sig-testing/5468-invariant-testing
introduced a mechanism for tests which hook into the test suite run via
ginkgo.ReportAfterSuite. Usage was limited to code in test/e2e/invariants with
stricter reviews.

However, this was not enforced mechanically. With forbidigo we can be sure that
nothing slips through.

ginkgo.ReportBeforeSuite has similar restrictions.
2026-01-16 13:32:05 +01:00
Kubernetes Prow Robot
8b1496ac62 Merge pull request #136184 from yongruilin/master_dependenttag
feat(kube-api-linter): add dependenttags linter for k8s:unionMember
2026-01-15 11:09:45 +05:30
yongruilin
49be15534e feat: Enforce +k8s:optional on +k8s:unionMember fields via dependenttag linter 2026-01-14 20:08:59 +00:00
Kubernetes Prow Robot
b639540931 Merge pull request #135432 from pohly/apimachinery-featuregate-contextual-logging
featuregate: contextual logging
2026-01-14 01:11:35 +05:30
Patrick Ohly
c16a07a8b1 featuregate: contextual logging
This is primarily useful in unit tests and therefore supported by
featuregate/testing. Without this, all warnings are emitted to stderr, with no
connection to the test which caused the warning to be emitted.

When a single test fails, `go test` started by showing all warnings triggered by
any test, not just the failed test:

    I1121 18:50:28.112284  396950 feature_gate.go:466] feature gates: {map[DRADeviceTaintRules:true DRADeviceTaints:true]}
    ...
    I1121 18:50:29.704907  396950 feature_gate.go:466] feature gates: {map[DRADeviceTaintRules:false DRADeviceTaints:false]}
    --- FAIL: TestAll (1.58s)
        --- FAIL: TestAll/Eviction (0.02s)

This warning was actually slightly broken: it passed an atomic.Value to Infof,
not the map. This violates the "must not be copied after first use" rule
for atomic.Value (thus wasn't thread-safe) and printed the value in an awkward
way (extra {}).

Now it shows that the feature gates are modified inside TestAll (in this example):

    --- FAIL: TestAll (1.56s)
        feature_gate.go:170: I1124 17:31:27.245108] Updated featureGates={"DRADeviceTaintRules":true,"DRADeviceTaints":true}
        --- FAIL: TestAll/Eviction (0.02s)
            --- FAIL: TestAll/Eviction/initial (0.00s)
        ...

        feature_gate.go:170: I1124 17:31:28.821975] Updated featureGates={"DRADeviceTaintRules":false,"DRADeviceTaints":false}
    FAIL
    FAIL	k8s.io/kubernetes/pkg/controller/devicetainteviction	1.602s
2026-01-13 18:20:59 +01:00
Kubernetes Prow Robot
b9e2575a54 Merge pull request #135992 from bart0sh/PR212-migrate-remaining-kubelet-subdirs-to-contextual-logging
Migrate remaining kubelet subdirs to contextual logging
2026-01-12 19:58:41 +05:30
Ed Bartosh
0dc83930de logcheck: move all kubelet subdirs to contextual logging 2026-01-12 12:36:59 +02:00
Joel Speed
a64e802673 Enable nonullable rule for Kube API Linter 2026-01-09 10:38:15 +00:00
Kubernetes Prow Robot
26fd963327 Merge pull request #135664 from pohly/dra-upgrade-downgrade-refactor
DRA e2e: upgrade/downgrade refactor
2026-01-08 19:31:47 +05:30
Matteo Fari
a1d638ea11 Enable nomaps rule for Kube API Linter (#134852)
* tested how many errors

* added exceptions

* added scoped exceptions per API group

* added struct.field specification

* improved regex match and included core and resources with the new struct.field format

* condensed exceptions using regex as requested

* fixed the scope kal nomaps exceptions to match existing fields
2026-01-06 23:59:39 +05:30
Patrick Ohly
e0514f6656 lint: don't ignore go vet printf
Our current code does not have any such issues related to printf and
we want to keep it that way.
2026-01-05 13:44:57 +01:00
liyuerich
dfef76d018 enable commentstart check on authentication API group
Signed-off-by: liyuerich <yue.li@daocloud.io>
2026-01-04 16:58:51 +08:00
Joel Speed
b75c2ed9cc Enable integers rule for Kube API Linter 2025-12-19 17:46:24 +00:00
Joel Speed
aa1dfd0ab8 Update NoTimestamp exceptions for qualified names 2025-12-19 14:57:24 +00:00
Kubernetes Prow Robot
be49637f88 Merge pull request #135385 from PatrickLaabs/132086-denypointerpkg
chore: Denying deprecated pointer package in golangci-linters config
2025-12-17 21:42:31 -08:00
Kubernetes Prow Robot
907f9d26c7 Merge pull request #135302 from liyuerich/commentstartapidiscovery
enable commentstart check on apidiscovery API group
2025-12-17 20:00:46 -08:00
Kubernetes Prow Robot
1c0eb534ca Merge pull request #135219 from skitt/valswap
Enforce Golang a, b = b, a swaps
2025-12-17 19:59:46 -08:00
PatrickLaabs
7402fc23db Denying deprecated pointer package in golangci-linters config 2025-11-21 09:51:20 +01:00
liyuerich
a9085f7358 enable commentstart check on apidiscovery API group
Signed-off-by: liyuerich <yue.li@daocloud.io>
2025-11-14 15:10:30 +08:00
Stephen Kitt
55c337637e Enforce Golang a, b = b, a swaps
This eliminates the last two remaining three-step value swaps (t =
a; a = b; b = t instead of a, b = b, a) and enables linting to prevent
new ones being added in future.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2025-11-13 06:38:23 -05:00
shwetha-s-poojary
84baa7143e Enable notimestamp rule for Kube API Linter 2025-11-07 09:09:51 +05:30
liyuerich
18967f53dd enable commentstart check on adminssion API group
Signed-off-by: liyuerich <yue.li@daocloud.io>
2025-11-05 14:12:49 +08:00
Kevin Hannon
fda069a5d6 update kal to fix markdown table bug 2025-10-30 12:01:09 -04:00
Kevin Hannon
9cc3a06f0b enable duplicate tags for kal and add exceptions 2025-10-30 11:15:35 -04:00
Francesco Romani
816eee64e8 cpumanager: hack: add golang ci config for contextual logging
add cpumanager to contextual logging linter
regenerate with
```hack/update-golangci-lint-config.sh```

Signed-off-by: Francesco Romani <fromani@redhat.com>
2025-10-27 08:38:58 +01:00
Kubernetes Prow Robot
60e1f61a63 Merge pull request #133511 from BenTheElder/no-md5
eliminate md5 usage, block new usage
2025-10-24 10:59:35 -07:00
Kubernetes Prow Robot
ee58e792cc Merge pull request #134812 from skitt/enable-gocritic-unlambda
Avoid no-change lambdas
2025-10-23 15:43:34 -07:00
Kubernetes Prow Robot
ab34215bab Merge pull request #134229 from yongruilin/kal-vg
Use kube-api-linter linting for declarative validation tags
2025-10-23 08:11:35 -07:00
Stephen Kitt
1e2817d589 Avoid no-change lambdas
This replaces functions that wrap another function with no change with
a direct reference to the wrapped function.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2025-10-23 09:46:15 +02:00
yongruilin
7d1500bb1e feat: Add exceptions for conflicting markers in kube-api-linter 2025-10-22 18:02:06 +00:00
yongruilin
5fc2f3e5a9 feat: Enable conflicting markers linter to detect mutually exclusive field markers 2025-10-22 17:06:11 +00:00
Stephen Kitt
5bfc9aba9f Disable unwanted gocritic checks instead of filtering them
The golangci-lint docs indicate that, for gocritic, disabled-checks
and enabled-checks can't be combined. That is however not accurate;
enabled-checks adds checks, disabled-checks disables them, in that
order. If disable-all isn't set, then the setup starts with the checks
enabled by default, adds any additional checks specified in
enabled-checks, and removes checks specified in disabled-checks.

This means that instead of filtering unwanted checks, we can disable
them entirely. This makes the set of disabled checks easier to read,
and perhaps easier to clean up in future.

For singleCaseSwitch and wrapperFunc, we only want to ignore specific
instances, so this is still done by filtering.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2025-10-22 15:00:53 +02:00
Benjamin Elder
886fdeefae forbid new use of md5 2025-10-21 15:25:11 -07:00
Tim Hockin
b1c85ef2fe golangci-lint: no need to enable deprecatedComment 2025-10-21 12:47:38 -07:00
phuhung273
7ed61cfde1 chore(kubelet): migrate topologymanager to contextual logging 2025-10-14 18:32:20 +07:00
Ed Bartosh
bb91913017 Migrate sample-device-lugin to contextual logging 2025-09-28 21:13:41 +03:00
Ed Bartosh
d45a4557c1 Migrate device manager to contextual logging 2025-09-26 16:50:34 +03:00
Joel Speed
4e71993917 Enable SSATags linter to enforce +listType on lists in APIs 2025-09-19 13:57:07 +01:00
Kubernetes Prow Robot
d1af46054f Merge pull request #133605 from JoelSpeed/enable-conditions-kal
Enforce API conventions around Conditions fields via Kube API Linter
2025-09-16 08:08:13 -07:00
Joel Speed
d2ba13dac9 Add exceptions for existing issues for conditions linter 2025-09-12 18:07:54 +01:00
Joel Speed
894d724f98 Enable conditions linter for Kube API Linter 2025-09-12 18:06:55 +01:00
Joel Speed
e3b08f9871 Update KAL to latest and add shadow config for new options 2025-09-12 18:06:17 +01:00
Ed Bartosh
bf0429ed07 migrate kubelet/certificate to contextual logging 2025-09-10 12:33:33 +03:00
Ed Bartosh
b276c96ef8 Migrate kubelet/server to contextual logging 2025-09-09 12:49:42 +03:00
Kubernetes Prow Robot
3b687533aa Merge pull request #133217 from bart0sh/PR187-migrate-utils-logs-to-contextual-logging
Kubelet: Migrate util/ and logs/ to contextual logging
2025-09-05 14:37:34 -07:00
Kubernetes Prow Robot
078a8f1894 Merge pull request #130581 from zhifei92/migrate-kubelet-config-to-contextual-logging
chore(kubelet):  migrate config to contextual logging
2025-09-05 05:25:26 -07:00
Omer Aplatony
d75d4860e7 kubelet: migrate module logs to contextual logging
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
Co-authored-by: Ed Bartosh <eduard.bartosh@intel.com>
2025-09-05 13:22:00 +03:00
Omer Aplatony
9c1cf79d74 kubelet: migrate utils to contextual logging
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
Co-authored-by: Ed Bartosh <eduard.bartosh@intel.com>
2025-09-05 13:19:56 +03:00
Kubernetes Prow Robot
b8257c1667 Merge pull request #133699 from pohly/log-check-update
hack/logcheck.conf: add several converted packages
2025-08-29 08:17:16 -07:00