Skip to content

Commit a6ab5c9

Browse files
committed
feat: add generated-store flag and upgrade kubepug to v1.7.1
Signed-off-by: Ken Ng <ken.ng@zapier.com>
1 parent 61456e6 commit a6ab5c9

File tree

6 files changed

+38
-11
lines changed

6 files changed

+38
-11
lines changed

cmd/root.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ func init() {
125125
stringFlag(flags, "identifier", "Identifier for the kubechecks instance. Used to differentiate between multiple kubechecks instances.",
126126
newStringOpts().
127127
withDefault(""))
128+
stringFlag(flags, "generated-store", "URL for the kubepug generated store.",
129+
newStringOpts().
130+
withDefault("https://kubepug.xyz/data/data.json"))
128131

129132
panicIfError(viper.BindPFlags(flags))
130133
setupLogOutput()

go.mod

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ require (
3333
github.com/pkg/errors v0.9.1
3434
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
3535
github.com/prometheus/client_golang v1.20.3
36-
github.com/rikatz/kubepug v1.4.0
3736
github.com/rs/zerolog v1.33.0
3837
github.com/sashabaranov/go-openai v1.36.0
3938
github.com/shurcooL/githubv4 v0.0.0-20231126234147-1cffa1f02456
@@ -111,6 +110,7 @@ require (
111110
github.com/chai2010/gettext-go v1.0.2 // indirect
112111
github.com/cloudflare/circl v1.3.7 // indirect
113112
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
113+
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be // indirect
114114
github.com/containerd/typeurl/v2 v2.1.1 // indirect
115115
github.com/coreos/go-oidc/v3 v3.11.0 // indirect
116116
github.com/cpuguy83/dockercfg v0.3.1 // indirect
@@ -128,6 +128,7 @@ require (
128128
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
129129
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
130130
github.com/fatih/camelcase v1.0.0 // indirect
131+
github.com/fatih/color v1.16.0 // indirect
131132
github.com/felixge/httpsnoop v1.0.4 // indirect
132133
github.com/fsnotify/fsnotify v1.7.0 // indirect
133134
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
@@ -145,6 +146,7 @@ require (
145146
github.com/go-openapi/swag v0.23.0 // indirect
146147
github.com/go-redis/cache/v9 v9.0.0 // indirect
147148
github.com/gobwas/glob v0.2.3 // indirect
149+
github.com/goccy/go-json v0.10.2 // indirect
148150
github.com/gogo/protobuf v1.3.2 // indirect
149151
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
150152
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
@@ -189,6 +191,7 @@ require (
189191
github.com/klauspost/compress v1.17.9 // indirect
190192
github.com/kr/pretty v0.3.1 // indirect
191193
github.com/kr/text v0.2.0 // indirect
194+
github.com/kubepug/kubepug v1.7.1 // indirect
192195
github.com/labstack/gommon v0.4.2 // indirect
193196
github.com/leodido/go-urn v1.1.0 // indirect
194197
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
@@ -272,11 +275,13 @@ require (
272275
go.uber.org/automaxprocs v1.5.3 // indirect
273276
go.uber.org/multierr v1.11.0 // indirect
274277
golang.org/x/crypto v0.31.0 // indirect
278+
golang.org/x/mod v0.18.0 // indirect
275279
golang.org/x/sync v0.10.0 // indirect
276280
golang.org/x/sys v0.28.0 // indirect
277281
golang.org/x/term v0.27.0 // indirect
278282
golang.org/x/text v0.21.0 // indirect
279283
golang.org/x/time v0.8.0 // indirect
284+
golang.org/x/tools v0.22.0 // indirect
280285
google.golang.org/api v0.171.0 // indirect
281286
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
282287
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
@@ -294,6 +299,7 @@ require (
294299
k8s.io/cli-runtime v0.31.3 // indirect
295300
k8s.io/component-base v0.31.3 // indirect
296301
k8s.io/component-helpers v0.31.3 // indirect
302+
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c // indirect
297303
k8s.io/klog/v2 v2.130.1 // indirect
298304
k8s.io/kube-aggregator v0.31.2 // indirect
299305
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
@@ -307,6 +313,7 @@ require (
307313
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
308314
sigs.k8s.io/kustomize/api v0.17.2 // indirect
309315
sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect
316+
sigs.k8s.io/release-utils v0.7.5 // indirect
310317
sigs.k8s.io/structured-merge-diff/v4 v4.4.3 // indirect
311318
)
312319

go.sum

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH
349349
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
350350
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
351351
github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
352+
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be h1:J5BL2kskAlV9ckgEsNQXscjIaLiOYiZ75d4e94E6dcQ=
353+
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be/go.mod h1:mk5IQ+Y0ZeO87b858TlA645sVcEcbiX6YqP98kt+7+w=
352354
github.com/containerd/typeurl/v2 v2.1.1 h1:3Q4Pt7i8nYwy2KmQWIw2+1hTvwTE/6w9FqcttATPO/4=
353355
github.com/containerd/typeurl/v2 v2.1.1/go.mod h1:IDp2JFvbwZ31H8dQbEIY7sDl2L3o3HZj1hsSQlywkQ0=
354356
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -512,6 +514,8 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA
512514
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
513515
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
514516
github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY=
517+
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
518+
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
515519
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
516520
github.com/godoctor/godoctor v0.0.0-20181123222458-69df17f3a6f6/go.mod h1:+tyhT8jBF8E0XvdlSXOSL7Iko7DlNiongHq3q+wcsPs=
517521
github.com/gogits/go-gogs-client v0.0.0-20200905025246-8bb8a50cb355 h1:HTVNOdTWO/gHYeFnr/HwpYwY6tgMcYd+Rgf1XrHnORY=
@@ -742,6 +746,7 @@ github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8t
742746
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
743747
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
744748
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
749+
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
745750
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
746751
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
747752
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -750,6 +755,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
750755
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
751756
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
752757
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
758+
github.com/kubepug/kubepug v1.7.1 h1:LKhfSxS8Y5mXs50v+3Lpyec+cogErDLcV7CMUuiaisw=
759+
github.com/kubepug/kubepug v1.7.1/go.mod h1:lv+HxD0oTFL7ZWjj0u6HKhMbbTIId3eG7aWIW0gyF8g=
753760
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
754761
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
755762
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
@@ -1530,6 +1537,7 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs
15301537
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
15311538
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
15321539
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
1540+
golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
15331541
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
15341542
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
15351543
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@@ -1860,6 +1868,8 @@ k8s.io/component-base v0.31.3 h1:DMCXXVx546Rfvhj+3cOm2EUxhS+EyztH423j+8sOwhQ=
18601868
k8s.io/component-base v0.31.3/go.mod h1:xME6BHfUOafRgT0rGVBGl7TuSg8Z9/deT7qq6w7qjIU=
18611869
k8s.io/component-helpers v0.31.3 h1:0zGPD2PrekhFWgmz85XxlMEl7dfhlKC1tERZDe3onQc=
18621870
k8s.io/component-helpers v0.31.3/go.mod h1:HZ1HZx2TKXM7xSUV2cR9L5yDoyZPhhHQNaE3BPBLPUQ=
1871+
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c h1:GohjlNKauSai7gN4wsJkeZ3WAJx4Sh+oT/b5IYn5suA=
1872+
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
18631873
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70/go.mod h1:VH3AT8AaQOqiGjMF9p0/IM1Dj+82ZwjfxUP1IxaHE+8=
18641874
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
18651875
k8s.io/klog/v2 v2.5.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
@@ -1897,6 +1907,8 @@ sigs.k8s.io/kustomize/api v0.17.2 h1:E7/Fjk7V5fboiuijoZHgs4aHuexi5Y2loXlVOAVAG5g
18971907
sigs.k8s.io/kustomize/api v0.17.2/go.mod h1:UWTz9Ct+MvoeQsHcJ5e+vziRRkwimm3HytpZgIYqye0=
18981908
sigs.k8s.io/kustomize/kyaml v0.17.1 h1:TnxYQxFXzbmNG6gOINgGWQt09GghzgTP6mIurOgrLCQ=
18991909
sigs.k8s.io/kustomize/kyaml v0.17.1/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U=
1910+
sigs.k8s.io/release-utils v0.7.5 h1:0DYUWILqT0rirJ+8Vrp+Fr8jG8Q32ejFnulkahOvEao=
1911+
sigs.k8s.io/release-utils v0.7.5/go.mod h1:GZGWmbINwsLGKsoZKTeWUGp4F+Rbwhq4XDtJ45N+dLw=
19001912
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
19011913
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
19021914
sigs.k8s.io/structured-merge-diff/v4 v4.4.3 h1:sCP7Vv3xx/CWIuTPVN38lUPx0uw0lcLfzaiDa8Ja01A=

pkg/checks/preupgrade/check.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ import (
88
)
99

1010
func Check(ctx context.Context, request checks.Request) (msg.Result, error) {
11-
return checkApp(ctx, request.AppName, request.KubernetesVersion, request.YamlManifests)
11+
return checkApp(ctx, request.Container, request.AppName, request.KubernetesVersion, request.YamlManifests)
1212
}

pkg/checks/preupgrade/kubepug.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,23 @@ import (
77
"os"
88
"strings"
99

10+
"github.com/kubepug/kubepug/lib"
11+
"github.com/kubepug/kubepug/pkg/results"
1012
"github.com/masterminds/semver"
1113
"github.com/olekukonko/tablewriter"
12-
"github.com/rikatz/kubepug/lib"
13-
"github.com/rikatz/kubepug/pkg/results"
1414
"github.com/rs/zerolog/log"
1515
"go.opentelemetry.io/otel"
1616

1717
"github.com/zapier/kubechecks/pkg"
18+
"github.com/zapier/kubechecks/pkg/container"
1819
"github.com/zapier/kubechecks/pkg/msg"
1920
)
2021

2122
const docLinkFmt = "[%s Deprecation Notes](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#%s-v%d%d)"
2223

2324
var tracer = otel.Tracer("pkg/checks/preupgrade")
2425

25-
func checkApp(ctx context.Context, appName, targetKubernetesVersion string, manifests []string) (msg.Result, error) {
26+
func checkApp(ctx context.Context, ctr container.Container, appName, targetKubernetesVersion string, manifests []string) (msg.Result, error) {
2627
_, span := tracer.Start(ctx, "KubePug")
2728
defer span.End()
2829

@@ -56,14 +57,17 @@ func checkApp(ctx context.Context, appName, targetKubernetesVersion string, mani
5657
if err != nil {
5758
return msg.Result{}, err
5859
}
60+
5961
config := lib.Config{
60-
K8sVersion: fmt.Sprintf("v%s", nextVersion.String()),
61-
ForceDownload: false,
62-
APIWalk: true,
63-
ShowDescription: true,
64-
Input: tempDir,
62+
K8sVersion: fmt.Sprintf("v%s", nextVersion.String()),
63+
Input: tempDir,
64+
GeneratedStore: ctr.Config.GeneratedStore,
65+
}
66+
67+
kubepug, err := lib.NewKubepug(&config)
68+
if err != nil {
69+
return msg.Result{}, err
6570
}
66-
kubepug := lib.NewKubepug(config)
6771

6872
result, err := kubepug.GetDeprecated()
6973
if err != nil {

pkg/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ type ServerConfig struct {
7070
// -- preupgrade
7171
EnablePreupgrade bool `mapstructure:"enable-preupgrade"`
7272
WorstPreupgradeState pkg.CommitState `mapstructure:"worst-preupgrade-state"`
73+
GeneratedStore string `mapstructure:"generated-store"`
7374

7475
// misc
7576
AdditionalAppsNamespaces []string `mapstructure:"additional-apps-namespaces"`

0 commit comments

Comments
 (0)