Skip to content

Commit e4e3816

Browse files
authored
Rel v0.50.4 (#3293)
* fix#3278 honor ns ovewride * refactor column exclude * [feat] add configurable api server timeout * clean * fix#3285 - add restart option for flux support * fix#3283 fix dp ready state * update vulscan deps * fix#3288 fix cust view filter * fix#3286 match-exp * rel notes
1 parent c2694ee commit e4e3816

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+428
-286
lines changed

.golangci.yml

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -239,77 +239,3 @@ formatters:
239239
- internal/x # extracted from x/tools code
240240
- pkg/goformatters/gci/internal # extracted from gci code
241241
- pkg/goanalysis/runner_checker.go # extracted from x/tools code
242-
243-
# linters:
244-
# default: none
245-
# enable:
246-
# - sloglint
247-
248-
# exclusions:
249-
# generated: lax
250-
# paths:
251-
# - third_party$
252-
# - builtin$
253-
# - examples$
254-
# - \\.(generated\\.deepcopy|pb)\\.go$
255-
256-
# settings:
257-
# gocyclo:
258-
# min-complexity: 35
259-
260-
# govet:
261-
# enable:
262-
# - nilness
263-
264-
# goimports:
265-
# local-prefixes: github.com/derailed/k9s
266-
267-
# unused:
268-
# parameters-are-used: true
269-
# local-variables-are-used: true
270-
# field-writes-are-uses: true
271-
# post-statements-are-reads: true
272-
# exported-fields-are-used: true
273-
# generated-is-used: true
274-
275-
# goheader:
276-
# values:
277-
# regexp:
278-
# PROJECT: 'K9s'
279-
# template: |-
280-
# SPDX-License-Identifier: Apache-2.0
281-
# Copyright Authors of {{ PROJECT }}
282-
283-
# gosec:
284-
# includes:
285-
# - G402
286-
287-
288-
289-
# issues:
290-
291-
# # default is true. Enables skipping of directories:
292-
# # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
293-
# # exclude-dirs-use-default: true
294-
295-
# # Excluding configuration per-path, per-linter, per-text and per-source
296-
# # exclude-rules:
297-
# # - linters: [staticcheck]
298-
# # text: "SA1019" # this is rule for deprecated method
299-
300-
# # - linters: [staticcheck]
301-
# # text: "SA9003: empty branch"
302-
303-
# # - linters: [staticcheck]
304-
# # text: "SA2001: empty critical section"
305-
306-
# # - linters: [err113]
307-
# # text: "do not define dynamic errors, use wrapped static errors instead" # This rule to avoid opinionated check fmt.Errorf("text")
308-
# # # Skip goimports check on generated files
309-
# # - path: \\.(generated\\.deepcopy|pb)\\.go$
310-
# # linters:
311-
# # - goimports
312-
# # # Skip goheader check on files imported and modified from upstream k8s
313-
# # - path: "pkg/ipam/(cidrset|service)/.+\\.go"
314-
# # linters:
315-
# # - goheader

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DATE ?= $(shell TZ=UTC date -j -f "%s" ${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:
1111
else
1212
DATE ?= $(shell date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ")
1313
endif
14-
VERSION ?= v0.50.3
14+
VERSION ?= v0.50.4
1515
IMG_NAME := derailed/k9s
1616
IMAGE := ${IMG_NAME}:${VERSION}
1717

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,10 @@ You can now override the context portForward default address configuration by se
409409
liveViewAutoRefresh: false
410410
# The path to screen dump. Default: '%temp_dir%/k9s-screens-%username%' (k9s info)
411411
screenDumpDir: /tmp/dumps
412-
# Represents ui poll intervals. Default 2secs
412+
# Represents ui poll intervals in seconds. Default 2secs
413413
refreshRate: 2
414+
# Overrides the default k8s api server requests timeout. Defaults 120s
415+
apiServerTimeout: 15s
414416
# Number of retries once the connection to the api-server is lost. Default 15.
415417
maxConnRetry: 5
416418
# Indicates whether modification commands like delete/kill/edit are disabled. Default is false
@@ -431,6 +433,7 @@ You can now override the context portForward default address configuration by se
431433
crumbsless: false
432434
# Set to true to suppress the K9s splash screen on start. Default false. Note that for larger clusters or higher latency connections, there may be no resources visible initially until local caches have finished populating.
433435
splashless: false
436+
# Toggles icons display as not all terminal support these chars. Default: true
434437
noIcons: false
435438
# Toggles reactive UI. This option provide for watching on disk artifacts changes and update the UI live Defaults to false.
436439
reactive: false

change_logs/release_v0.50.4.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/k9s.png" align="center" width="800" height="auto"/>
2+
3+
# Release v0.50.4
4+
5+
## Notes
6+
7+
Thank you to all that contributed with flushing out issues and enhancements for K9s!
8+
I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev
9+
and see if we're happier with some of the fixes!
10+
If you've filed an issue please help me verify and close.
11+
12+
Your support, kindness and awesome suggestions to make K9s better are, as ever, very much noted and appreciated!
13+
Also big thanks to all that have allocated their own time to help others on both slack and on this repo!!
14+
15+
As you may know, K9s is not pimped out by corps with deep pockets, thus if you feel K9s is helping your Kubernetes journey,
16+
please consider joining our [sponsorship program](https://github.com/sponsors/derailed) and/or make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)
17+
18+
On Slack? Please join us [K9slackers](https://join.slack.com/t/k9sers/shared_invite/zt-3360a389v-ElLHrb0Dp1kAXqYUItSAFA)
19+
20+
## Maintenance Release!
21+
22+
---
23+
24+
## Resolved Issues
25+
26+
* [#3288](https://github.com/derailed/k9s/issues/3288) Resource search doesn't filter by name in custom view
27+
* [#3286](https://github.com/derailed/k9s/issues/3286) K9S doesn't understand matchExpressions selector in Deployment to Pod navigation
28+
* [#3285](https://github.com/derailed/k9s/issues/3285) Rollout Restart method conflicts with GitOps (Flux, ArgoCD)
29+
* [#3283](https://github.com/derailed/k9s/issues/3283) Deployment status showing wrong ready state
30+
* [#3278](https://github.com/derailed/k9s/issues/3278) k9s doesn't honor the --namespace parameter
31+
32+
---
33+
34+
## Contributed PRs
35+
36+
Please be sure to give `Big Thanks!` and `ATTA Girls/Boys!` to all the fine contributors for making K9s better for all of us!!
37+
38+
* [#3292](https://github.com/derailed/k9s/pull/3292) fix: respect insecure flag when switch context
39+
* [#3277](https://github.com/derailed/k9s/pull/3277) feat: add hostPathVolume (docker)
40+
* [#3253](https://github.com/derailed/k9s/pull/3253) fix: set default request timeout to 120 seconds
41+
* [#2866](https://github.com/derailed/k9s/pull/2866) Feature/default_view
42+
43+
---
44+
<img src="https://raw.githubusercontent.com/derailed/k9s/master/assets/imhotep_logo.png" width="32" height="auto"/> © 2025 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

cmd/root.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ import (
1212
"strings"
1313
"time"
1414

15-
"github.com/lmittmann/tint"
16-
"github.com/mattn/go-colorable"
17-
"github.com/spf13/cobra"
18-
"k8s.io/cli-runtime/pkg/genericclioptions"
19-
"k8s.io/client-go/tools/clientcmd/api"
20-
2115
"github.com/derailed/k9s/internal/client"
2216
"github.com/derailed/k9s/internal/color"
2317
"github.com/derailed/k9s/internal/config"
2418
"github.com/derailed/k9s/internal/config/data"
2519
"github.com/derailed/k9s/internal/slogs"
2620
"github.com/derailed/k9s/internal/view"
21+
"github.com/lmittmann/tint"
22+
"github.com/mattn/go-colorable"
23+
"github.com/spf13/cobra"
24+
"k8s.io/cli-runtime/pkg/genericclioptions"
25+
"k8s.io/client-go/tools/clientcmd/api"
2726
)
2827

2928
const (

go.mod

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.24.1
55
require (
66
github.com/adrg/xdg v0.5.3
77
github.com/anchore/clio v0.0.0-20250319180342-2cfe4b0cb716
8-
github.com/anchore/grype v0.87.0
8+
github.com/anchore/grype v0.91.0
99
github.com/anchore/syft v1.22.0
1010
github.com/atotto/clipboard v0.1.4
1111
github.com/cenkalti/backoff/v4 v4.3.0
@@ -152,7 +152,7 @@ require (
152152
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
153153
github.com/gdamore/encoding v1.0.1 // indirect
154154
github.com/github/go-spdx/v2 v2.3.2 // indirect
155-
github.com/glebarez/go-sqlite v1.21.2 // indirect
155+
github.com/glebarez/go-sqlite v1.22.0 // indirect
156156
github.com/glebarez/sqlite v1.11.0 // indirect
157157
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
158158
github.com/go-git/go-billy/v5 v5.6.2 // indirect
@@ -232,8 +232,6 @@ require (
232232
github.com/mitchellh/go-homedir v1.1.0 // indirect
233233
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
234234
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
235-
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
236-
github.com/mitchellh/mapstructure v1.5.0 // indirect
237235
github.com/mitchellh/reflectwalk v1.0.2 // indirect
238236
github.com/moby/docker-image-spec v1.3.1 // indirect
239237
github.com/moby/locker v1.0.1 // indirect
@@ -262,6 +260,7 @@ require (
262260
github.com/openvex/go-vex v0.2.5 // indirect
263261
github.com/owenrumney/go-sarif v1.1.2-0.20231003122901-1000f5e05554 // indirect
264262
github.com/package-url/packageurl-go v0.1.1 // indirect
263+
github.com/pandatix/go-cvss v0.6.2 // indirect
265264
github.com/pborman/indent v1.2.1 // indirect
266265
github.com/pelletier/go-toml v1.9.5 // indirect
267266
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
@@ -336,7 +335,7 @@ require (
336335
golang.org/x/sync v0.13.0 // indirect
337336
golang.org/x/sys v0.31.0 // indirect
338337
golang.org/x/term v0.30.0 // indirect
339-
golang.org/x/time v0.8.0 // indirect
338+
golang.org/x/time v0.11.0 // indirect
340339
golang.org/x/tools v0.31.0 // indirect
341340
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
342341
google.golang.org/api v0.215.0 // indirect

go.sum

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,8 @@ github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04 h1:VzprUTpc0v
712712
github.com/anchore/go-testutils v0.0.0-20200925183923-d5f45b0d3c04/go.mod h1:6dK64g27Qi1qGQZ67gFmBFvEHScy0/C8qhQhNe5B5pQ=
713713
github.com/anchore/go-version v1.2.2-0.20210903204242-51efa5b487c4 h1:rmZG77uXgE+o2gozGEBoUMpX27lsku+xrMwlmBZJtbg=
714714
github.com/anchore/go-version v1.2.2-0.20210903204242-51efa5b487c4/go.mod h1:Bkc+JYWjMCF8OyZ340IMSIi2Ebf3uwByOk6ho4wne1E=
715-
github.com/anchore/grype v0.87.0 h1:cdrNA4rnSMpBxP8NmKNF75VUlP/VWaOG8YJJjiIDwIs=
716-
github.com/anchore/grype v0.87.0/go.mod h1:Umw/9sZHnS+9mPLTnUFd/OzApR6dzE2CPlRsov7kSmQ=
715+
github.com/anchore/grype v0.91.0 h1:x6/jweLDNp+jy6ufyCukBJbFAlVefxSUOqb2eFsJdQY=
716+
github.com/anchore/grype v0.91.0/go.mod h1:O+lJcLV4OWTPwA8Rvr8U1utnqqNA0WgvVgc0q0QbpJw=
717717
github.com/anchore/packageurl-go v0.1.1-0.20250220190351-d62adb6e1115 h1:ZyRCmiEjnoGJZ1+Ah0ZZ/mKKqNhGcUZBl0s7PTTDzvY=
718718
github.com/anchore/packageurl-go v0.1.1-0.20250220190351-d62adb6e1115/go.mod h1:KoYIv7tdP5+CC9VGkeZV4/vGCKsY55VvoG+5dadg4YI=
719719
github.com/anchore/stereoscope v0.1.2 h1:0+Jcf7hoImYKfrH2XzN6vvbmbpm68A/woabC43gZ4eU=
@@ -1001,8 +1001,8 @@ github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZ
10011001
github.com/gkampitakis/go-diff v1.3.2/go.mod h1:LLgOrpqleQe26cte8s36HTWcTmMEur6OPYerdAAS9tk=
10021002
github.com/gkampitakis/go-snaps v0.5.11 h1:LFG0ggUKR+KEiiaOvFCmLgJ5NO2zf93AxxddkBn3LdQ=
10031003
github.com/gkampitakis/go-snaps v0.5.11/go.mod h1:PcKmy8q5Se7p48ywpogN5Td13reipz1Iivah4wrTIvY=
1004-
github.com/glebarez/go-sqlite v1.21.2 h1:3a6LFC4sKahUunAmynQKLZceZCOzUthkRkEAl9gAXWo=
1005-
github.com/glebarez/go-sqlite v1.21.2/go.mod h1:sfxdZyhQjTM2Wry3gVYWaW072Ri1WMdWJi0k6+3382k=
1004+
github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ=
1005+
github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc=
10061006
github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw=
10071007
github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ=
10081008
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
@@ -1438,13 +1438,9 @@ github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJ
14381438
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
14391439
github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
14401440
github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
1441-
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
1442-
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
14431441
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
14441442
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
14451443
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
1446-
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
1447-
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
14481444
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
14491445
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
14501446
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
@@ -1523,6 +1519,8 @@ github.com/owenrumney/go-sarif v1.1.2-0.20231003122901-1000f5e05554 h1:FvA4bwjKp
15231519
github.com/owenrumney/go-sarif v1.1.2-0.20231003122901-1000f5e05554/go.mod h1:n73K/hcuJ50MiVznXyN4rde6fZY7naGKWBXOLFTyc94=
15241520
github.com/package-url/packageurl-go v0.1.1 h1:KTRE0bK3sKbFKAk3yy63DpeskU7Cvs/x/Da5l+RtzyU=
15251521
github.com/package-url/packageurl-go v0.1.1/go.mod h1:uQd4a7Rh3ZsVg5j0lNyAfyxIeGde9yrlhjF78GzeW0c=
1522+
github.com/pandatix/go-cvss v0.6.2 h1:TFiHlzUkT67s6UkelHmK6s1INKVUG7nlKYiWWDTITGI=
1523+
github.com/pandatix/go-cvss v0.6.2/go.mod h1:jDXYlQBZrc8nvrMUVVvTG8PhmuShOnKrxP53nOFkt8Q=
15261524
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
15271525
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
15281526
github.com/pborman/indent v1.2.1 h1:lFiviAbISHv3Rf0jcuh489bi06hj98JsVMtIDZQb9yM=
@@ -2184,8 +2182,8 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb
21842182
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
21852183
golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
21862184
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
2187-
golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=
2188-
golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
2185+
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
2186+
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
21892187
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
21902188
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
21912189
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

internal/client/config.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,23 @@ package client
66
import (
77
"errors"
88
"fmt"
9+
"log/slog"
910
"net/http"
1011
"net/url"
1112
"strings"
1213
"sync"
1314
"time"
1415

16+
"github.com/derailed/k9s/internal/slogs"
1517
"k8s.io/cli-runtime/pkg/genericclioptions"
1618
restclient "k8s.io/client-go/rest"
1719
"k8s.io/client-go/tools/clientcmd"
1820
"k8s.io/client-go/tools/clientcmd/api"
1921
)
2022

2123
const (
22-
defaultCallTimeoutDuration = 120 * time.Second
24+
// DefaultCallTimeoutDuration is the default api server call timeout duration.
25+
DefaultCallTimeoutDuration time.Duration = 15 * time.Second
2326

2427
// UsePersistentConfig caches client config to avoid reloads.
2528
UsePersistentConfig = true
@@ -42,12 +45,13 @@ func NewConfig(f *genericclioptions.ConfigFlags) *Config {
4245
// CallTimeout returns the call timeout if set or the default if not set.
4346
func (c *Config) CallTimeout() time.Duration {
4447
if !isSet(c.flags.Timeout) {
45-
return defaultCallTimeoutDuration
48+
return DefaultCallTimeoutDuration
4649
}
4750
dur, err := time.ParseDuration(*c.flags.Timeout)
4851
if err != nil {
49-
return defaultCallTimeoutDuration
52+
return DefaultCallTimeoutDuration
5053
}
54+
slog.Debug("APIServer timeout", slogs.Duration, dur)
5155

5256
return dur
5357
}
@@ -95,6 +99,8 @@ func (c *Config) SwitchContext(name string) error {
9599
flags.ImpersonateGroup = c.flags.ImpersonateGroup
96100
flags.ImpersonateUID = c.flags.ImpersonateUID
97101
flags.Insecure = c.flags.Insecure
102+
flags.BearerToken = c.flags.BearerToken
103+
98104
c.flags = flags
99105

100106
return nil

internal/client/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestCallTimeout(t *testing.T) {
3232
e: 1 * time.Minute,
3333
},
3434
"default": {
35-
e: 10 * time.Second,
35+
e: 15 * time.Second,
3636
},
3737
}
3838

internal/client/gvr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"k8s.io/apimachinery/pkg/runtime/schema"
1818
)
1919

20-
var NoGVR = &GVR{}
20+
var NoGVR = new(GVR)
2121

2222
// GVR represents a kubernetes resource schema as a string.
2323
// Format is group/version/resources:subresource.

0 commit comments

Comments
 (0)