-
Notifications
You must be signed in to change notification settings - Fork 36
feat: add generated-store flag and upgrade kubepug to v1.7.1 #376
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
Conversation
Signed-off-by: Ken Ng <ken.ng@zapier.com>
Temporary image deleted. |
Signed-off-by: Ken Ng <ken.ng@zapier.com>
Signed-off-by: Ken Ng <ken.ng@zapier.com>
Mergecat's ReviewClick to read mergecats review!😼 Mergecat review of pkg/config/config.go@@ -70,6 +70,7 @@ type ServerConfig struct {
// -- preupgrade
EnablePreupgrade bool `mapstructure:"enable-preupgrade"`
WorstPreupgradeState pkg.CommitState `mapstructure:"worst-preupgrade-state"`
+ GeneratedStore string `mapstructure:"generated-store"`
// misc
AdditionalAppsNamespaces []string `mapstructure:"additional-apps-namespaces"` Feedback & Suggestions:
😼 Mergecat review of cmd/root.go@@ -125,6 +125,9 @@ func init() {
stringFlag(flags, "identifier", "Identifier for the kubechecks instance. Used to differentiate between multiple kubechecks instances.",
newStringOpts().
withDefault(""))
+ stringFlag(flags, "generated-store", "URL for the kubepug generated store.",
+ newStringOpts().
+ withDefault("https://kubepug.xyz/data/data.json"))
panicIfError(viper.BindPFlags(flags))
setupLogOutput() Feedback & Suggestions:
😼 Mergecat review of docs/usage.md@@ -51,6 +51,7 @@ The full list of supported environment variables is described below:
|`KUBECHECKS_ENABLE_PREUPGRADE`|Enable preupgrade checks.|`true`|
|`KUBECHECKS_ENSURE_WEBHOOKS`|Ensure that webhooks are created in repositories referenced by argo.|`false`|
|`KUBECHECKS_FALLBACK_K8S_VERSION`|Fallback target Kubernetes version for schema / upgrade checks.|`1.23.0`|
+|`KUBECHECKS_GENERATED_STORE`|URL for the kubepug generated store.|`https://kubepug.xyz/data/data.json`|
|`KUBECHECKS_GITHUB_APP_ID`|Github App ID.|`0`|
|`KUBECHECKS_GITHUB_INSTALLATION_ID`|Github Installation ID.|`0`|
|`KUBECHECKS_GITHUB_PRIVATE_KEY`|Github App Private Key.|| Feedback & Suggestions:
😼 Mergecat review of pkg/checks/preupgrade/check.go@@ -8,5 +8,5 @@ import (
)
func Check(ctx context.Context, request checks.Request) (msg.Result, error) {
- return checkApp(ctx, request.AppName, request.KubernetesVersion, request.YamlManifests)
+ return checkApp(ctx, request.Container, request.AppName, request.KubernetesVersion, request.YamlManifests)
} Feedback & Suggestions:
😼 Mergecat review of pkg/checks/preupgrade/kubepug.go@@ -7,22 +7,23 @@ import (
"os"
"strings"
+ "github.com/kubepug/kubepug/lib"
+ "github.com/kubepug/kubepug/pkg/results"
"github.com/masterminds/semver"
"github.com/olekukonko/tablewriter"
- "github.com/rikatz/kubepug/lib"
- "github.com/rikatz/kubepug/pkg/results"
"github.com/rs/zerolog/log"
"go.opentelemetry.io/otel"
"github.com/zapier/kubechecks/pkg"
+ "github.com/zapier/kubechecks/pkg/container"
"github.com/zapier/kubechecks/pkg/msg"
)
const docLinkFmt = "[%s Deprecation Notes](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#%s-v%d%d)"
var tracer = otel.Tracer("pkg/checks/preupgrade")
-func checkApp(ctx context.Context, appName, targetKubernetesVersion string, manifests []string) (msg.Result, error) {
+func checkApp(ctx context.Context, ctr container.Container, appName, targetKubernetesVersion string, manifests []string) (msg.Result, error) {
_, span := tracer.Start(ctx, "KubePug")
defer span.End()
@@ -56,14 +57,17 @@ func checkApp(ctx context.Context, appName, targetKubernetesVersion string, mani
if err != nil {
return msg.Result{}, err
}
+
config := lib.Config{
- K8sVersion: fmt.Sprintf("v%s", nextVersion.String()),
- ForceDownload: false,
- APIWalk: true,
- ShowDescription: true,
- Input: tempDir,
+ K8sVersion: fmt.Sprintf("v%s", nextVersion.String()),
+ Input: tempDir,
+ GeneratedStore: ctr.Config.GeneratedStore,
+ }
+
+ kubepug, err := lib.NewKubepug(&config)
+ if err != nil {
+ return msg.Result{}, err
}
- kubepug := lib.NewKubepug(config)
result, err := kubepug.GetDeprecated()
if err != nil { Feedback & Suggestions:
😼 Mergecat review of go.mod@@ -24,6 +24,7 @@ require (
github.com/heptiolabs/healthcheck v0.0.0-20211123025425-613501dd5deb
github.com/imdario/mergo v0.3.16
github.com/jeremywohl/flatten v1.0.1
+ github.com/kubepug/kubepug v1.7.1
github.com/labstack/echo-contrib v0.17.1
github.com/labstack/echo/v4 v4.13.3
github.com/masterminds/semver v1.5.0
@@ -33,7 +34,6 @@ require (
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
github.com/prometheus/client_golang v1.20.3
- github.com/rikatz/kubepug v1.4.0
github.com/rs/zerolog v1.33.0
github.com/sashabaranov/go-openai v1.36.0
github.com/shurcooL/githubv4 v0.0.0-20231126234147-1cffa1f02456
@@ -63,6 +63,8 @@ require (
k8s.io/apimachinery v0.31.3
k8s.io/client-go v0.31.3
sigs.k8s.io/controller-runtime v0.19.3
+ sigs.k8s.io/kustomize/api v0.17.2
+ sigs.k8s.io/kustomize/kyaml v0.17.1
sigs.k8s.io/yaml v1.4.0
)
@@ -145,6 +147,7 @@ require (
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-redis/cache/v9 v9.0.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
+ github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
@@ -272,11 +275,13 @@ require (
go.uber.org/automaxprocs v1.5.3 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
+ golang.org/x/mod v0.18.0 // indirect
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.8.0 // indirect
+ golang.org/x/tools v0.22.0 // indirect
google.golang.org/api v0.171.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
@@ -294,6 +299,7 @@ require (
k8s.io/cli-runtime v0.31.3 // indirect
k8s.io/component-base v0.31.3 // indirect
k8s.io/component-helpers v0.31.3 // indirect
+ k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-aggregator v0.31.2 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
@@ -305,8 +311,6 @@ require (
olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 // indirect
oras.land/oras-go/v2 v2.5.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
- sigs.k8s.io/kustomize/api v0.17.2 // indirect
- sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.3 // indirect
)
Feedback & Suggestions:
Dependency ReviewClick to read mergecats review!No suggestions found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Added generated-store flag to configure kubepug store URL and upgraded kubepug to v1.7.1.
Changes
generated-store
flag to allow configuring kubepug store URLHow to Test
KUBECHECKS_GENERATED_STORE
environment variable or use--generated-store
flagAdditional Notes
Default store URL remains
https://kubepug.xyz/data/data.json
if not configured