Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rel v0.21.6 #403

Merged
merged 8 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/dependabot.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
NAME := popeye
PACKAGE := github.com/derailed/$(NAME)
VERSION := v0.21.5
VERSION := v0.21.6
GIT := $(shell git rev-parse --short HEAD)
DATE := $(shell date +%FT%T%Z)
IMG_NAME := derailed/popeye
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,14 @@ popeye
popeye -n fred
# Run Popeye in all namespaces
popeye -A
# Popeye uses a spinach config file of course! aka spinachyaml!
# Run Popeye uses a spinach config file of course! aka spinachyaml!
popeye -f spinach.yaml
# Popeye a cluster using a kubeconfig context.
# Run Popeye a cluster using a kubeconfig context.
popeye --context olive
# Run Popeye with specific linters and log to the console
popeye -n ns1 -s pod,svc --logs none
# Run Popeye for a given namespace in a given log file and debug logs
popeye -n ns1 --logs /tmp/fred.log -v4
# Stuck?
popeye help
```
Expand Down
32 changes: 32 additions & 0 deletions change_logs/release_v0.21.6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<img src="https://raw.githubusercontent.com/derailed/popeye/master/assets/popeye_logo.png" align="right" width="200" height="auto"/>

# Release v0.21.6

## Notes

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!

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.

Also if you dig this tool, please make some noise on social! [@kitesurfer](https://twitter.com/kitesurfer)

---

## Maintenance Release

---

## Resolved Issues

* [#370](https://github.com/derailed/popeye/issues/370) default service account check
* [#356](https://github.com/derailed/popeye/issues/356) Allow foreground execution, with output to STDOUT/STDERR and disabling output to popeye.log file
* [#341](https://github.com/derailed/popeye/issues/341) Linter Node : no linters matched query
* [#337](https://github.com/derailed/popeye/issues/337) Output logs in stdout instead of file
* [#301](https://github.com/derailed/popeye/issues/301) Allow Popeye to be used by more than one user on a host (/tmp/popeye.log permission problem)
* [#267](https://github.com/derailed/popeye/issues/267) Allow container exclusions based on regex
* [#200](https://github.com/derailed/popeye/issues/200) Can't filter containers in spinach.yaml for deployments
* [#168](https://github.com/derailed/popeye/issues/168) Skip checks at container level

---

<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)
57 changes: 55 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ func Execute() {

// Doit runs the scans and lints pass over the specified cluster.
func doIt(cmd *cobra.Command, args []string) {
bomb(initLogs())

defer func() {
if err := recover(); err != nil {
pkg.BailOut(err.(error))
}
}()

zerolog.SetGlobalLevel(zerolog.DebugLevel)
clearScreen()
bomb(flags.Validate())
flags.StandAlone = true
Expand All @@ -84,7 +85,7 @@ func bomb(err error) {
if err == nil {
return
}
panic(fmt.Errorf("💥 %s\n", report.Colorize(err.Error(), report.ColorRed)))
panic(fmt.Errorf("💥 %s", report.Colorize(err.Error(), report.ColorRed)))
}

func initPopeyeFlags() {
Expand Down Expand Up @@ -166,6 +167,15 @@ func initPopeyeFlags() {
[]string{},
"Specify which resources to include in the scan ie -s po,svc",
)

rootCmd.Flags().IntVarP(flags.LogLevel, "log-level", "v",
1,
"Specify log level. Use 0|1|2|3|4 for disable|info|warn|error|debug",
)
rootCmd.Flags().StringVarP(flags.LogFile, "logs", "",
pkg.LogFile,
"Specify log file location. Use `none` for stdout",
)
}

func initKubeConfigFlags() {
Expand Down Expand Up @@ -212,6 +222,49 @@ func initKubeConfigFlags() {
)
}

func initLogs() error {
var logs string
if *flags.LogFile != "none" {
logs = *flags.LogFile
}

var file = os.Stdout
if logs != "" {
mod := os.O_CREATE | os.O_APPEND | os.O_WRONLY
var err error
file, err = os.OpenFile(logs, mod, 0644)
if err != nil {
return fmt.Errorf("unable to create Popeye log file: %w", err)
}
}
log.Logger = log.Output(zerolog.ConsoleWriter{Out: file})

if flags.LogLevel == nil {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
} else {
zerolog.SetGlobalLevel(toLogLevel(*flags.LogLevel))
}

return nil
}

func toLogLevel(level int) zerolog.Level {
switch level {
case -1:
return zerolog.TraceLevel
case 0:
return zerolog.Disabled
case 1:
return zerolog.InfoLevel
case 2:
return zerolog.WarnLevel
case 3:
return zerolog.ErrorLevel
default:
return zerolog.DebugLevel
}
}

func initFlags() {
initPopeyeFlags()
initKubeConfigFlags()
Expand Down
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ require (
github.com/stretchr/testify v1.10.0
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/net v0.31.0
golang.org/x/text v0.21.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.32.0
k8s.io/apimachinery v0.32.0
k8s.io/cli-runtime v0.31.1
k8s.io/cli-runtime v0.32.0
k8s.io/client-go v0.32.0
k8s.io/metrics v0.31.1
k8s.io/metrics v0.32.0
sigs.k8s.io/gateway-api v1.2.0
sigs.k8s.io/yaml v1.4.0
)
Expand Down Expand Up @@ -114,7 +115,6 @@ require (
go.opentelemetry.io/otel v1.27.0 // indirect
go.opentelemetry.io/otel/metric v1.27.0 // indirect
go.opentelemetry.io/otel/trace v1.27.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/dig v1.17.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
Expand All @@ -123,7 +123,6 @@ require (
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.7.0 // indirect
google.golang.org/protobuf v1.35.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
Expand All @@ -133,7 +132,7 @@ require (
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/kustomize/api v0.17.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect
sigs.k8s.io/kustomize/api v0.18.0 // indirect
sigs.k8s.io/kustomize/kyaml v0.18.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
)
Loading
Loading