Skip to content

Commit 83e6cff

Browse files
bennyyang11NoaheCampbelldependabot[bot]
authored
Cron job clean (#1862)
* created roadmap and yaml claude agent * Update roadmap.md * chore(deps): bump sigstore/cosign-installer from 3.9.2 to 3.10.0 (#1857) Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 3.9.2 to 3.10.0. - [Release notes](https://github.com/sigstore/cosign-installer/releases) - [Commits](sigstore/cosign-installer@v3.9.2...v3.10.0) --- updated-dependencies: - dependency-name: sigstore/cosign-installer dependency-version: 3.10.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump the security group with 2 updates (#1858) Bumps the security group with 2 updates: [github.com/vmware-tanzu/velero](https://github.com/vmware-tanzu/velero) and [helm.sh/helm/v3](https://github.com/helm/helm). Updates `github.com/vmware-tanzu/velero` from 1.16.2 to 1.17.0 - [Release notes](https://github.com/vmware-tanzu/velero/releases) - [Changelog](https://github.com/vmware-tanzu/velero/blob/main/CHANGELOG.md) - [Commits](vmware-tanzu/velero@v1.16.2...v1.17.0) Updates `helm.sh/helm/v3` from 3.18.6 to 3.19.0 - [Release notes](https://github.com/helm/helm/releases) - [Commits](helm/helm@v3.18.6...v3.19.0) --- updated-dependencies: - dependency-name: github.com/vmware-tanzu/velero dependency-version: 1.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: security - dependency-name: helm.sh/helm/v3 dependency-version: 3.19.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: security ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump helm.sh/helm/v3 from 3.18.6 to 3.19.0 in /examples/sdk/helm-template in the security group (#1859) chore(deps): bump helm.sh/helm/v3 Bumps the security group in /examples/sdk/helm-template with 1 update: [helm.sh/helm/v3](https://github.com/helm/helm). Updates `helm.sh/helm/v3` from 3.18.6 to 3.19.0 - [Release notes](https://github.com/helm/helm/releases) - [Commits](helm/helm@v3.18.6...v3.19.0) --- updated-dependencies: - dependency-name: helm.sh/helm/v3 dependency-version: 3.19.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: security ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add cron job support bundle scheduler Complete implementation with K8s integration: - pkg/schedule/job.go: Job management and persistence - pkg/schedule/daemon.go: Real-time scheduler daemon - pkg/schedule/cli.go: CLI commands (create, list, delete, daemon) - pkg/schedule/schedule_test.go: Comprehensive unit tests - cmd/troubleshoot/cli/root.go: CLI integration * fixing bugbot * Fix all bugbot errors: auto-update stability, job cooldown timing, and daemon execution * Deleting Agent * removed unused flags * fixing auto-upload * fixing markdown files * namespace not required flag for auto collectors to work * loosened cron job validation * writes logs to logfile * fix: resolve autoFromEnv variable scoping issue for CI - Ensure autoFromEnv variable and its usage are in correct scope - Fix build errors: declared and not used / undefined variable - All functionality preserved and tested locally - Force add to override gitignore --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Noah Campbell <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 84dc815 commit 83e6cff

File tree

14 files changed

+3481
-188
lines changed

14 files changed

+3481
-188
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,10 @@ sbom/
4848
# Ignore generated support bundles
4949
*.tar.gz
5050
!testdata/supportbundle/*.tar.gz
51+
52+
# Ignore built binaries
53+
troubleshoot
54+
troubleshoot-test
55+
cmd/troubleshoot/troubleshoot
56+
cmd/*/troubleshoot
57+
support-bundle

Cron-Job-Support-Bundles-PRD.md

Lines changed: 1695 additions & 0 deletions
Large diffs are not rendered by default.

cmd/troubleshoot/cli/root.go

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,25 @@ If no arguments are provided, specs are automatically loaded from the cluster by
4343
}
4444

4545
// Auto-update support-bundle unless disabled by flag or env
46-
envAuto := os.Getenv("TROUBLESHOOT_AUTO_UPDATE")
47-
autoFromEnv := true
48-
if envAuto != "" {
49-
if strings.EqualFold(envAuto, "0") || strings.EqualFold(envAuto, "false") {
50-
autoFromEnv = false
46+
// Only run auto-update for the root support-bundle command, not subcommands
47+
if cmd.Name() == "support-bundle" && !cmd.HasParent() {
48+
envAuto := os.Getenv("TROUBLESHOOT_AUTO_UPDATE")
49+
autoFromEnv := true
50+
if envAuto != "" {
51+
if strings.EqualFold(envAuto, "0") || strings.EqualFold(envAuto, "false") {
52+
autoFromEnv = false
53+
}
5154
}
52-
}
53-
if v.GetBool("auto-update") && autoFromEnv {
54-
exe, err := os.Executable()
55-
if err == nil {
56-
_ = updater.CheckAndUpdate(cmd.Context(), updater.Options{
57-
BinaryName: "support-bundle",
58-
CurrentPath: exe,
59-
Printf: func(f string, a ...interface{}) { fmt.Fprintf(os.Stderr, f, a...) },
60-
})
55+
56+
if v.GetBool("auto-update") && autoFromEnv {
57+
exe, err := os.Executable()
58+
if err == nil {
59+
_ = updater.CheckAndUpdate(cmd.Context(), updater.Options{
60+
BinaryName: "support-bundle",
61+
CurrentPath: exe,
62+
Printf: func(f string, a ...interface{}) { fmt.Fprintf(os.Stderr, f, a...) },
63+
})
64+
}
6165
}
6266
}
6367
},
@@ -103,11 +107,13 @@ If no arguments are provided, specs are automatically loaded from the cluster by
103107
cmd.AddCommand(Analyze())
104108
cmd.AddCommand(Redact())
105109
cmd.AddCommand(Diff())
110+
cmd.AddCommand(Schedule())
106111
cmd.AddCommand(UploadCmd())
107112
cmd.AddCommand(util.VersionCmd())
108113

109114
cmd.Flags().StringSlice("redactors", []string{}, "names of the additional redactors to use")
110115
cmd.Flags().Bool("redact", true, "enable/disable default redactions")
116+
111117
cmd.Flags().Bool("interactive", true, "enable/disable interactive mode")
112118
cmd.Flags().Bool("collect-without-permissions", true, "always generate a support bundle, even if it some require additional permissions")
113119
cmd.Flags().StringSliceP("selector", "l", []string{"troubleshoot.sh/kind=support-bundle"}, "selector to filter on for loading additional support bundle specs found in secrets within the cluster")

cmd/troubleshoot/cli/schedule.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package cli
2+
3+
import (
4+
"github.com/replicatedhq/troubleshoot/pkg/schedule"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
// Schedule returns the schedule command for managing scheduled support bundle jobs
9+
func Schedule() *cobra.Command {
10+
return schedule.CLI()
11+
}

examples/sdk/helm-template/go.mod

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,27 @@ replace github.com/replicatedhq/troubleshoot v0.0.0 => ../../../
99

1010
require (
1111
github.com/replicatedhq/troubleshoot v0.0.0
12-
helm.sh/helm/v3 v3.18.6
12+
helm.sh/helm/v3 v3.19.0
1313
sigs.k8s.io/yaml v1.6.0
1414
)
1515

1616
require (
1717
dario.cat/mergo v1.0.2 // indirect
1818
github.com/BurntSushi/toml v1.5.0 // indirect
1919
github.com/Masterminds/goutils v1.1.1 // indirect
20-
github.com/Masterminds/semver/v3 v3.3.0 // indirect
20+
github.com/Masterminds/semver/v3 v3.4.0 // indirect
2121
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
2222
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
2323
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
24-
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
25-
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
24+
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
25+
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
2626
github.com/go-logr/logr v1.4.3 // indirect
2727
github.com/go-openapi/jsonpointer v0.21.0 // indirect
2828
github.com/go-openapi/jsonreference v0.21.0 // indirect
2929
github.com/go-openapi/swag v0.23.1 // indirect
3030
github.com/gobwas/glob v0.2.3 // indirect
3131
github.com/gogo/protobuf v1.3.2 // indirect
32-
github.com/google/gnostic-models v0.6.9 // indirect
33-
github.com/google/go-cmp v0.7.0 // indirect
32+
github.com/google/gnostic-models v0.7.0 // indirect
3433
github.com/google/gofuzz v1.2.0 // indirect
3534
github.com/google/uuid v1.6.0 // indirect
3635
github.com/huandu/xstrings v1.5.0 // indirect
@@ -40,35 +39,35 @@ require (
4039
github.com/mitchellh/copystructure v1.2.0 // indirect
4140
github.com/mitchellh/reflectwalk v1.0.2 // indirect
4241
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
43-
github.com/modern-go/reflect2 v1.0.2 // indirect
42+
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
4443
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
4544
github.com/pkg/errors v0.9.1 // indirect
4645
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect
4746
github.com/shopspring/decimal v1.4.0 // indirect
48-
github.com/spf13/cast v1.7.1 // indirect
47+
github.com/spf13/cast v1.10.0 // indirect
4948
github.com/x448/float16 v0.8.4 // indirect
5049
go.yaml.in/yaml/v2 v2.4.2 // indirect
51-
go.yaml.in/yaml/v3 v3.0.3 // indirect
52-
golang.org/x/crypto v0.41.0 // indirect
53-
golang.org/x/net v0.43.0 // indirect
50+
go.yaml.in/yaml/v3 v3.0.4 // indirect
51+
golang.org/x/crypto v0.42.0 // indirect
52+
golang.org/x/net v0.44.0 // indirect
5453
golang.org/x/oauth2 v0.30.0 // indirect
55-
golang.org/x/sys v0.35.0 // indirect
56-
golang.org/x/term v0.34.0 // indirect
57-
golang.org/x/text v0.28.0 // indirect
58-
golang.org/x/time v0.11.0 // indirect
54+
golang.org/x/sys v0.36.0 // indirect
55+
golang.org/x/term v0.35.0 // indirect
56+
golang.org/x/text v0.29.0 // indirect
57+
golang.org/x/time v0.12.0 // indirect
5958
google.golang.org/protobuf v1.36.6 // indirect
6059
gopkg.in/inf.v0 v0.9.1 // indirect
6160
gopkg.in/yaml.v2 v2.4.0 // indirect
6261
gopkg.in/yaml.v3 v3.0.1 // indirect
63-
k8s.io/api v0.33.4 // indirect
64-
k8s.io/apiextensions-apiserver v0.33.4 // indirect
65-
k8s.io/apimachinery v0.33.4 // indirect
66-
k8s.io/client-go v0.33.4 // indirect
62+
k8s.io/api v0.34.1 // indirect
63+
k8s.io/apiextensions-apiserver v0.34.1 // indirect
64+
k8s.io/apimachinery v0.34.1 // indirect
65+
k8s.io/client-go v0.34.1 // indirect
6766
k8s.io/klog/v2 v2.130.1 // indirect
68-
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
69-
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
70-
sigs.k8s.io/controller-runtime v0.21.0 // indirect
71-
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
67+
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
68+
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
69+
sigs.k8s.io/controller-runtime v0.22.1 // indirect
70+
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
7271
sigs.k8s.io/randfill v1.0.0 // indirect
73-
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
72+
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
7473
)

0 commit comments

Comments
 (0)