Skip to content

Commit c4e44b6

Browse files
authored
Merge pull request #285 from derailed/popeye/release_v0.20.3
Popeye/release v0.20.3
2 parents dd8eafd + f0630f7 commit c4e44b6

File tree

6 files changed

+62
-28
lines changed

6 files changed

+62
-28
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
NAME := popeye
22
PACKAGE := github.com/derailed/$(NAME)
3-
VERSION := v0.20.2
3+
VERSION := v0.20.3
44
GIT := $(shell git rev-parse --short HEAD)
55
DATE := $(shell date +%FT%T%Z)
66
IMG_NAME := derailed/popeye

README.md

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,31 @@ Popeye is available on Linux, OSX and Windows platforms.
110110

111111
---
112112

113+
## The Command Line
114+
115+
You can use Popeye wide open or using a spinach yaml config to
116+
tune your linters. Details about the Popeye configuration file are below.
117+
118+
```shell
119+
# Dump version info and logs location
120+
popeye version
121+
# Popeye a cluster using your current kubeconfig environment.
122+
# NOTE! This will run Popeye in the context namespace if set or like kubectl will use the default namespace
123+
popeye
124+
# Run Popeye in the `fred` namespace
125+
popeye -n fred
126+
# Run Popeye in all namespaces
127+
popeye -A
128+
# Popeye uses a spinach config file of course! aka spinachyaml!
129+
popeye -f spinach.yaml
130+
# Popeye a cluster using a kubeconfig context.
131+
popeye --context olive
132+
# Stuck?
133+
popeye help
134+
```
135+
136+
---
137+
113138
## Linters
114139

115140
Popeye scans your cluster for best practices and potential issues.
@@ -274,26 +299,6 @@ cat /tmp/popeye/my_report.txt
274299

275300
---
276301

277-
## The Command Line
278-
279-
You can use Popeye wide open or using a spinach yaml config to
280-
tune your linters. Details about the Popeye configuration file are below.
281-
282-
```shell
283-
# Dump version info and logs location
284-
popeye version
285-
# Popeye a cluster using your current kubeconfig environment.
286-
popeye
287-
# Popeye uses a spinach config file of course! aka spinachyaml!
288-
popeye -f spinach.yaml
289-
# Popeye a cluster using a kubeconfig context.
290-
popeye --context olive
291-
# Stuck?
292-
popeye help
293-
```
294-
295-
---
296-
297302
## Output Formats
298303

299304
Popeye can generate linter reports in a variety of formats. You can use the -o cli option and pick your poison from there.

change_logs/release_v0.20.3.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<img src="https://raw.githubusercontent.com/derailed/popeye/master/assets/popeye_logo.png" align="right" width="200" height="auto"/>
2+
3+
# Release v0.20.3
4+
5+
## Notes
6+
7+
Thank you to all that contributed with flushing out issues and enhancements for Popeye! I'll try to mark some of these issues as fixed. But if you don't mind grab the latest rev and see if we're happier with some of the fixes! If you've filed an issue please help me verify and close. Your support, kindness and awesome suggestions to make Popeye better is as ever very much noticed and appreciated!
8+
9+
This project offers a GitHub Sponsor button (over here 👆). As you well know this is not pimped out by big corps with deep pockets. If you feel `Popeye` is saving you cycles diagnosing potential cluster issues please consider sponsoring this project!! It does go a long way in keeping our servers lights on and beers in our fridge.
10+
11+
Also if you dig this tool, please make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)
12+
13+
---
14+
15+
## Maintenance Release
16+
17+
---
18+
19+
## Resolved Issues
20+
21+
. [#284](https://github.com/derailed/popeye/issues/284) Db get failed for ""
22+
23+
---
24+
25+
<img src="https://raw.githubusercontent.com/derailed/popeye/master/assets/imhotep_logo.png" width="32" height="auto"/>&nbsp; © 2024 Imhotep Software LLC. All materials licensed under [Apache v2.0](http://www.apache.org/licenses/LICENSE-2.0)

internal/db/db.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ func NewDB(db *memdb.MemDB) *DB {
3030

3131
func (db *DB) ITFor(gvr types.GVR) (*memdb.Txn, memdb.ResultIterator, error) {
3232
if gvr == types.BlankGVR {
33-
panic(fmt.Errorf("invalid table"))
33+
return nil, nil, fmt.Errorf("invalid table")
3434
}
35+
3536
txn := db.Txn(false)
3637
it, err := txn.Get(gvr.String(), "id")
3738
if err != nil {
@@ -45,7 +46,7 @@ func (db *DB) MustITForNS(gvr types.GVR, ns string) (*memdb.Txn, memdb.ResultIte
4546
txn := db.Txn(false)
4647
it, err := txn.Get(gvr.String(), "ns", ns)
4748
if err != nil {
48-
panic(fmt.Errorf("Db get failed for %q: %w", gvr, err))
49+
panic(fmt.Errorf("db ns iterator failed for %q: %w", gvr, err))
4950
}
5051

5152
return txn, it
@@ -55,7 +56,7 @@ func (db *DB) MustITFor(gvr types.GVR) (*memdb.Txn, memdb.ResultIterator) {
5556
txn := db.Txn(false)
5657
it, err := txn.Get(gvr.String(), "id")
5758
if err != nil {
58-
panic(fmt.Errorf("Db get failed for %q: %w", gvr, err))
59+
panic(fmt.Errorf("db iterator failed for %q: %w", gvr, err))
5960
}
6061

6162
return txn, it

internal/lint/cronjob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func jobResourceUsage(ctx context.Context, dba *db.DB, c Collector, jobs []*batc
125125
mx.RequestMEM.Add(mem)
126126

127127
pmx, err := dba.FindPMX(fqn)
128-
if err != nil {
128+
if err != nil || pmx == nil {
129129
continue
130130
}
131131
for _, cx := range pmx.Containers {

internal/lint/gw.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/derailed/popeye/internal/client"
1212
"github.com/derailed/popeye/internal/db"
1313
"github.com/derailed/popeye/internal/issues"
14+
"github.com/rs/zerolog/log"
1415
gwv1 "sigs.k8s.io/gateway-api/apis/v1"
1516
)
1617

@@ -47,9 +48,11 @@ func (s *Gateway) Lint(ctx context.Context) error {
4748
}
4849

4950
func (s *Gateway) checkRefs(ctx context.Context, gw *gwv1.Gateway) {
50-
txn := s.db.Txn(false)
51-
defer txn.Abort()
52-
txn, it := s.db.MustITFor(internal.Glossary[internal.GWC])
51+
txn, it, err := s.db.ITFor(internal.Glossary[internal.GWC])
52+
if err != nil {
53+
log.Warn().Err(err).Msg("no gateway class located. Skipping gw ref check")
54+
return
55+
}
5356
defer txn.Abort()
5457

5558
for o := it.Next(); o != nil; o = it.Next() {

0 commit comments

Comments
 (0)