From 461e2b8897a0e1e21724a7571bf946b533e2fd6a Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 13:49:02 +0400 Subject: [PATCH 1/9] add in-cluster relevant example in README --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d8f8c5b..61f90916 100644 --- a/README.md +++ b/README.md @@ -513,9 +513,14 @@ spec: image: derailed/popeye:vX.Y.Z imagePullPolicy: IfNotPresent args: - - -o + - --out - yaml - --force-exit-zero + - --logs + - none + - --cluster-name + - my-cluster + - --all-namespaces resources: limits: cpu: 500m From eec00244306bf69422c1e36d26221e3b599d5f02 Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 13:53:09 +0400 Subject: [PATCH 2/9] fixed contentType for some minio objects --- pkg/config/s3.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/config/s3.go b/pkg/config/s3.go index cce15a3a..be253b49 100644 --- a/pkg/config/s3.go +++ b/pkg/config/s3.go @@ -90,6 +90,17 @@ func (s *S3Info) minioUpload(ctx context.Context, bucket, key, asset string, rwc } contentType := "application/octet-stream" + fileExtension := filepath.Ext(asset) + + switch fileExtension { + case ".html": + contentType = "text/html" + case ".json": + contentType = "application/json" + case ".yaml", ".yml": + contentType = "application/yaml" + } + info, err := minioClient.PutObject(ctx, bucket, filepath.Join(key, asset), From 6553f7f4ebc5d5af9cd06b932bb16aadbb26f920 Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 15:35:13 +0400 Subject: [PATCH 3/9] modified: pkg/config/s3.go --- pkg/config/s3.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/config/s3.go b/pkg/config/s3.go index be253b49..faf4a2eb 100644 --- a/pkg/config/s3.go +++ b/pkg/config/s3.go @@ -92,6 +92,10 @@ func (s *S3Info) minioUpload(ctx context.Context, bucket, key, asset string, rwc contentType := "application/octet-stream" fileExtension := filepath.Ext(asset) + log.Debug().Msgf("Filepath: %q", asset) + log.Debug().Msgf("Filepath: %q", fullFilePath) + log.Debug().Msgf("File Extension: %q", fileExtension) + switch fileExtension { case ".html": contentType = "text/html" From b17614cc3bbedcada2e4a97b1be8c82f90c3a426 Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 17:01:58 +0400 Subject: [PATCH 4/9] modified: pkg/config/s3.go --- pkg/config/s3.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/config/s3.go b/pkg/config/s3.go index faf4a2eb..40b8acf5 100644 --- a/pkg/config/s3.go +++ b/pkg/config/s3.go @@ -92,9 +92,7 @@ func (s *S3Info) minioUpload(ctx context.Context, bucket, key, asset string, rwc contentType := "application/octet-stream" fileExtension := filepath.Ext(asset) - log.Debug().Msgf("Filepath: %q", asset) - log.Debug().Msgf("Filepath: %q", fullFilePath) - log.Debug().Msgf("File Extension: %q", fileExtension) + log.Info().Msgf("s3 file metadata: %q\n%q\n%q", filepath, fileExtension, asset) switch fileExtension { case ".html": From eda601358f1aaa966ab38b7db1370a6484413f5f Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 17:12:36 +0400 Subject: [PATCH 5/9] modified: pkg/config/s3.go --- pkg/config/s3.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/config/s3.go b/pkg/config/s3.go index 40b8acf5..0ab0d1c0 100644 --- a/pkg/config/s3.go +++ b/pkg/config/s3.go @@ -91,8 +91,7 @@ func (s *S3Info) minioUpload(ctx context.Context, bucket, key, asset string, rwc contentType := "application/octet-stream" fileExtension := filepath.Ext(asset) - - log.Info().Msgf("s3 file metadata: %q\n%q\n%q", filepath, fileExtension, asset) + log.Debug().Msgf("s3 file metadata: %q\n%q\n%q", filepath, fileExtension, asset) switch fileExtension { case ".html": From 43d9cf9ec3c48ae3ad0b52929fd003fc4e86a5c8 Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 18:38:01 +0400 Subject: [PATCH 6/9] modified: pkg/config/s3.go --- pkg/config/s3.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/config/s3.go b/pkg/config/s3.go index 0ab0d1c0..d5c359fc 100644 --- a/pkg/config/s3.go +++ b/pkg/config/s3.go @@ -91,7 +91,9 @@ func (s *S3Info) minioUpload(ctx context.Context, bucket, key, asset string, rwc contentType := "application/octet-stream" fileExtension := filepath.Ext(asset) - log.Debug().Msgf("s3 file metadata: %q\n%q\n%q", filepath, fileExtension, asset) + log.Debug().Msgf("s3 local report file: %q", asset) + log.Debug().Msgf("s3 local report file extension: %q", fileExtension) + log.Debug().Msgf("s3 local report file path: %q", filepath.Join(key, asset)) switch fileExtension { case ".html": From ed76b7c1661cde7185ac2d527b541bb89eb3ce47 Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 19:41:05 +0400 Subject: [PATCH 7/9] removed debug logging --- Makefile | 2 +- pkg/config/s3.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f72ab00b..8fad8077 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ NAME := popeye PACKAGE := github.com/derailed/$(NAME) -VERSION := v0.22.1 +VERSION := v0.22.2 GIT := $(shell git rev-parse --short HEAD) DATE := $(shell date +%FT%T%Z) IMG_NAME := derailed/popeye diff --git a/pkg/config/s3.go b/pkg/config/s3.go index d5c359fc..be253b49 100644 --- a/pkg/config/s3.go +++ b/pkg/config/s3.go @@ -91,9 +91,6 @@ func (s *S3Info) minioUpload(ctx context.Context, bucket, key, asset string, rwc contentType := "application/octet-stream" fileExtension := filepath.Ext(asset) - log.Debug().Msgf("s3 local report file: %q", asset) - log.Debug().Msgf("s3 local report file extension: %q", fileExtension) - log.Debug().Msgf("s3 local report file path: %q", filepath.Join(key, asset)) switch fileExtension { case ".html": From 9a1472b8092e7c8474d2eb553c3dbaba344ef501 Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 20:00:05 +0400 Subject: [PATCH 8/9] modified: README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 61f90916..226310d7 100644 --- a/README.md +++ b/README.md @@ -528,6 +528,9 @@ spec: ``` The `--force-exit-zero` should be set. Otherwise, the pods will end up in an error state. +The `--logs none` argument must be set to output the log to stdout. Otherwise `kubectl logs -f` will return an empty result. +The `--cluster-name` should be set to the name of your cluster for in-cluster usage. + > NOTE! Popeye exits with a non-zero error code if any lint errors are detected. From ac794e79ee69c3b51ab0af586a3d7d781bbd2124 Mon Sep 17 00:00:00 2001 From: obervinov Date: Sat, 10 May 2025 20:25:28 +0400 Subject: [PATCH 9/9] updated example cronjob --- k8s/popeye/cronjob.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/k8s/popeye/cronjob.yml b/k8s/popeye/cronjob.yml index cff405b5..1404704b 100644 --- a/k8s/popeye/cronjob.yml +++ b/k8s/popeye/cronjob.yml @@ -20,10 +20,16 @@ spec: imagePullPolicy: IfNotPresent command: ["/bin/popeye"] args: - - -f + - --file - /etc/config/popeye/spinach.yml - - -o + - --out - yaml + - --force-exit-zero + - --logs + - none + - --cluster-name + - my-cluster + - --all-namespaces resources: limits: cpu: 500m