Compare commits

...
6 Commits
Author SHA1 Message Date
Diamon WigginsandEvans Mungai 08c3fcf3df Gracefully handle unreachable URIs in loadSupportBundleSpecsFromURIs (#1383)
* gracefully handle unreachable URIs in loadSupportBundleSpecsFromURIs

* let caller decide how to handle the error

* fix klog import

* Add a test to ensure failing to load uri does not error

---------

Co-authored-by: Evans Mungai <evans@replicated.com>
2023-10-27 14:48:09 +01:00
dependabot[bot]andlnx01 1d2c1191e2 chore(deps): bump google.golang.org/grpc from 1.58.2 to 1.58.3 (#1380)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.58.2 to 1.58.3.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.58.2...v1.58.3)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-27 11:06:39 +01:00
dependabot[bot]andlnx01 66e070a07d chore(deps): bump go.opentelemetry.io/otel/sdk from 1.18.0 to 1.19.0 (#1378)
Bumps [go.opentelemetry.io/otel/sdk](https://github.com/open-telemetry/opentelemetry-go) from 1.18.0 to 1.19.0.
- [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.18.0...v1.19.0)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/otel/sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 10:03:45 +10:00
dependabot[bot]andlnx01 7528c57e83 chore(deps): bump golang.org/x/sync from 0.3.0 to 0.4.0 (#1373)
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.3.0 to 0.4.0.
- [Commits](https://github.com/golang/sync/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-19 16:14:39 +01:00
Evans Mungai 42fc4f06de fix: Correct how configmap and secrets paths are parsed in the CLI (#1375)
* fix: Correct how configmap and secrets paths are parsed in the CLI

* Add some garbage data to secrets and configmaps
2023-10-18 10:48:53 +01:00
Evans Mungai 312e467160 fix: embed troubleshoot version string from module dependency (#1371)
If troubleshoot is used as a dependency in go.mod, the version
information of the release would be missing at runtime. This is
because the version string is injected to binaries at build time
using linker flags (LD) passed to the compiler (check Makefile)
2023-10-16 13:51:55 +01:00
16 changed files with 204 additions and 48 deletions
+2 -1
View File
@@ -18,7 +18,7 @@ func runAnalyzers(v *viper.Viper, bundlePath string) error {
specContent := ""
var err error
if _, err = os.Stat(specPath); err == nil {
b, err := ioutil.ReadFile(specPath)
b, err := os.ReadFile(specPath)
if err != nil {
return err
}
@@ -26,6 +26,7 @@ func runAnalyzers(v *viper.Viper, bundlePath string) error {
specContent = string(b)
} else {
if !util.IsURL(specPath) {
// TODO: Better error message when we do not have a file/url etc
return fmt.Errorf("%s is not a URL and was not found (err %s)", specPath, err)
}
+12 -3
View File
@@ -232,6 +232,7 @@ the %s Admin Console to begin analysis.`
return nil
}
// loadSupportBundleSpecsFromURIs loads support bundle specs from URIs
func loadSupportBundleSpecsFromURIs(ctx context.Context, kinds *loader.TroubleshootKinds) (*loader.TroubleshootKinds, error) {
remoteRawSpecs := []string{}
for _, s := range kinds.SupportBundlesV1Beta2 {
@@ -239,14 +240,21 @@ func loadSupportBundleSpecsFromURIs(ctx context.Context, kinds *loader.Troublesh
// We are using LoadSupportBundleSpec function here since it handles prompting
// users to accept insecure connections
// There is an opportunity to refactor this code in favour of the Loader APIs
// TODO: Pass ctx to LoadSupportBundleSpec
rawSpec, err := supportbundle.LoadSupportBundleSpec(s.Spec.Uri)
if err != nil {
return nil, errors.Wrapf(err, "failed to load support bundle from URI %q", s.Spec.Uri)
// In the event a spec can't be loaded, we'll just skip it and print a warning
klog.Warningf("unable to load support bundle from URI: %q: %v", s.Spec.Uri, err)
continue
}
remoteRawSpecs = append(remoteRawSpecs, string(rawSpec))
}
}
if len(remoteRawSpecs) == 0 {
return kinds, nil
}
return loader.LoadSpecs(ctx, loader.LoadOptions{
RawSpecs: remoteRawSpecs,
})
@@ -264,9 +272,10 @@ func loadSpecs(ctx context.Context, args []string, client kubernetes.Interface)
if !viper.GetBool("no-uri") {
moreKinds, err := loadSupportBundleSpecsFromURIs(ctx, kinds)
if err != nil {
return nil, nil, err
klog.Warningf("unable to load support bundles from URIs: %v", err)
} else {
kinds.Add(moreKinds)
}
kinds.Add(moreKinds)
}
// Check if we have any collectors to run in the troubleshoot specs
+44 -12
View File
@@ -4,13 +4,29 @@ import (
"context"
"net/http"
"net/http/httptest"
"strings"
"testing"
"time"
"github.com/replicatedhq/troubleshoot/pkg/httputil"
"github.com/replicatedhq/troubleshoot/pkg/loader"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
var orig = `
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: sb-1
spec:
uri: $MY_URI
collectors:
- configMap:
name: kube-root-ca.crt
namespace: default
`
func Test_loadSupportBundleSpecsFromURIs(t *testing.T) {
// Run a webserver to serve the spec
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -25,18 +41,7 @@ spec:
}))
defer srv.Close()
orig := `
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: sb-1
spec:
uri: ` + srv.URL + `
collectors:
- configMap:
name: kube-root-ca.crt
namespace: default
`
orig := strings.ReplaceAll(orig, "$MY_URI", srv.URL)
ctx := context.Background()
kinds, err := loader.LoadSpecs(ctx, loader.LoadOptions{RawSpec: orig})
@@ -49,3 +54,30 @@ spec:
require.Len(t, moreKinds.SupportBundlesV1Beta2, 1)
assert.NotNil(t, moreKinds.SupportBundlesV1Beta2[0].Spec.Collectors[0].ClusterInfo)
}
func Test_loadSupportBundleSpecsFromURIs_TimeoutError(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
time.Sleep(2 * time.Second) // this will cause a timeout
}))
defer srv.Close()
ctx := context.Background()
kinds, err := loader.LoadSpecs(ctx, loader.LoadOptions{
RawSpec: strings.ReplaceAll(orig, "$MY_URI", srv.URL),
})
require.NoError(t, err)
// Set the timeout on the http client to 10ms
// supportbundle.LoadSupportBundleSpec does not yet use the context
before := httputil.GetHttpClient().Timeout
httputil.GetHttpClient().Timeout = 10 * time.Millisecond
defer func() {
// Reinstate the original timeout. Its a global var so we need to reset it
httputil.GetHttpClient().Timeout = before
}()
kindsAfter, err := loadSupportBundleSpecsFromURIs(ctx, kinds)
require.NoError(t, err)
assert.Equal(t, kinds, kindsAfter)
}
+6 -6
View File
@@ -35,10 +35,10 @@ require (
github.com/spf13/viper v1.17.0
github.com/stretchr/testify v1.8.4
github.com/tj/go-spin v1.1.0
go.opentelemetry.io/otel v1.18.0
go.opentelemetry.io/otel/sdk v1.18.0
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/sdk v1.19.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/sync v0.3.0
golang.org/x/sync v0.4.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.28.2
k8s.io/apiextensions-apiserver v0.28.1
@@ -102,8 +102,8 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.opentelemetry.io/otel/metric v1.18.0 // indirect
go.opentelemetry.io/otel/trace v1.18.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/tools v0.13.0 // indirect
@@ -235,7 +235,7 @@ require (
google.golang.org/api v0.143.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/grpc v1.58.2 // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
+12 -12
View File
@@ -1040,14 +1040,14 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.opentelemetry.io/otel v1.18.0 h1:TgVozPGZ01nHyDZxK5WGPFB9QexeTMXEH7+tIClWfzs=
go.opentelemetry.io/otel v1.18.0/go.mod h1:9lWqYO0Db579XzVuCKFNPDl4s73Voa+zEck3wHaAYQI=
go.opentelemetry.io/otel/metric v1.18.0 h1:JwVzw94UYmbx3ej++CwLUQZxEODDj/pOuTCvzhtRrSQ=
go.opentelemetry.io/otel/metric v1.18.0/go.mod h1:nNSpsVDjWGfb7chbRLUNW+PBNdcSTHD4Uu5pfFMOI0k=
go.opentelemetry.io/otel/sdk v1.18.0 h1:e3bAB0wB3MljH38sHzpV/qWrOTCFrdZF2ct9F8rBkcY=
go.opentelemetry.io/otel/sdk v1.18.0/go.mod h1:1RCygWV7plY2KmdskZEDDBs4tJeHG92MdHZIluiYs/M=
go.opentelemetry.io/otel/trace v1.18.0 h1:NY+czwbHbmndxojTEKiSMHkG2ClNH2PwmcHrdo0JY10=
go.opentelemetry.io/otel/trace v1.18.0/go.mod h1:T2+SGJGuYZY3bjj5rgh/hN7KIrlpWC5nS8Mjvzckz+0=
go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs=
go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY=
go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE=
go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8=
go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o=
go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A=
go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg=
go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY=
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds=
@@ -1224,8 +1224,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -1634,8 +1634,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I=
google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ=
google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+35 -13
View File
@@ -82,10 +82,13 @@ func LoadFromCLIArgs(ctx context.Context, client kubernetes.Interface, args []st
for _, v := range args {
if strings.HasPrefix(v, "secret/") {
// format secret/namespace-name/secret-name
// format secret/namespace-name/secret-name[/data-key]
pathParts := strings.Split(v, "/")
if len(pathParts) != 3 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("secret path %q must have 3 components", v))
if len(pathParts) > 4 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("secret path %s must have at most 4 components", v))
}
if len(pathParts) < 3 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("secret path %s must have at least 3 components", v))
}
data, err := LoadFromSecret(ctx, client, pathParts[1], pathParts[2])
@@ -93,25 +96,44 @@ func LoadFromCLIArgs(ctx context.Context, client kubernetes.Interface, args []st
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Wrap(err, "failed to get spec from secret"))
}
// Append all data in the secret. Some may not be specs, but that's ok. They will be ignored.
for _, spec := range data {
rawSpecs = append(rawSpecs, string(spec))
// If we have a key defined, then load specs from that key only.
if len(pathParts) == 4 {
spec, ok := data[pathParts[3]]
if ok {
rawSpecs = append(rawSpecs, string(spec))
}
} else {
// Append all data in the secret. Some may not be specs, but that's ok. They will be ignored.
for _, spec := range data {
rawSpecs = append(rawSpecs, string(spec))
}
}
} else if strings.HasPrefix(v, "configmap/") {
// format configmap/namespace-name/configmap-name
// format configmap/namespace-name/configmap-name[/data-key]
pathParts := strings.Split(v, "/")
if len(pathParts) != 3 {
return nil, errors.Errorf("configmap path %q must have 3 components", v)
if len(pathParts) > 4 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("configmap path %s must have at most 4 components", v))
}
if len(pathParts) < 3 {
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Errorf("configmap path %s must have at least 3 components", v))
}
data, err := LoadFromConfigMap(ctx, client, pathParts[1], pathParts[2])
if err != nil {
return nil, errors.Wrap(err, "failed to get spec from configmap")
return nil, types.NewExitCodeError(constants.EXIT_CODE_SPEC_ISSUES, errors.Wrap(err, "failed to get spec from configmap"))
}
// Append all data in the configmap. Some may not be specs, but that's ok. They will be ignored.
for _, spec := range data {
rawSpecs = append(rawSpecs, spec)
// If we have a key defined, then load specs from that key only.
if len(pathParts) == 4 {
spec, ok := data[pathParts[3]]
if ok {
rawSpecs = append(rawSpecs, spec)
}
} else {
// Append all data in the configmap. Some may not be specs, but that's ok. They will be ignored.
for _, spec := range data {
rawSpecs = append(rawSpecs, spec)
}
}
} else if _, err := os.Stat(v); err == nil {
b, err := os.ReadFile(v)
+22 -1
View File
@@ -3,6 +3,7 @@ package version
import (
"fmt"
"runtime"
"runtime/debug"
"time"
)
@@ -27,12 +28,32 @@ type GoInfo struct {
Arch string `json:"arch,omitempty"`
}
// initBuild sets up the version info from build args
// initBuild sets up the version info from build args or imported modules in go.mod
func initBuild() {
// TODO: Can we get the module name at runtime somehow?
tsModuleName := "github.com/replicatedhq/troubleshoot"
if version == "" {
// Lets attempt to get the version from runtime build info
// We will go through all the dependencies to find the
// troubleshoot module version. Its OK if we cannot read
// the buildinfo, we just won't have a version set
bi, ok := debug.ReadBuildInfo()
if ok {
for _, dep := range bi.Deps {
if dep.Path == tsModuleName {
version = dep.Version
break
}
}
}
}
build.Version = version
if len(gitSHA) >= 7 {
build.GitSHA = gitSHA[:7]
}
var err error
build.BuildTime, err = time.Parse(time.RFC3339, buildTime)
if err != nil {
+42
View File
@@ -111,3 +111,45 @@ if ! grep "labelled-support-bundle-4 \*\*\*HIDDEN\*\*\*" "$tmpdir/$bundle_direct
echo "Hidden content not found in redacted echo-hi-4 file"
exit 1
fi
echo "======= Generating support bundle from k8s secret/<namespace-name>/<secret-name>/<data-key> ======"
recreate_tmpdir
kubectl apply -f "$PRJ_ROOT/testdata/supportbundle/labelled-specs"
./bin/support-bundle -v1 --interactive=false secret/default/labelled-support-bundle-1/custom-spec-key \
--redactors configmap/default/labelled-redactor-spec-1/customer-redactor-spec \
--output=$tmpdir/$bundle_archive_name
if [ $? -ne 0 ]; then
echo "support-bundle command failed"
exit $?
fi
if ! tar -xvzf $tmpdir/$bundle_archive_name --directory $tmpdir; then
echo "A valid support bundle archive was not generated"
exit 1
fi
if ! grep "custom-spec-key \*\*\*HIDDEN\*\*\*" "$tmpdir/$bundle_directory_name/echo-hi-3"; then
echo "$(cat $tmpdir/$bundle_directory_name/echo-hi-3)"
echo "Hidden content not found in redacted echo-hi-3 file"
exit 1
fi
echo "======= Generating support bundle from k8s configmap/<namespace-name>/<configmap-name> ======"
recreate_tmpdir
kubectl apply -f "$PRJ_ROOT/testdata/supportbundle/labelled-specs"
./bin/support-bundle -v1 --interactive=false configmap/labelled-specs/labelled-support-bundle-2 --output=$tmpdir/$bundle_archive_name
if [ $? -ne 0 ]; then
echo "support-bundle command failed"
exit $?
fi
if ! tar -xvzf $tmpdir/$bundle_archive_name --directory $tmpdir; then
echo "A valid support bundle archive was not generated"
exit 1
fi
if ! grep "labelled-support-bundle-2 REDACT" "$tmpdir/$bundle_directory_name/echo-hi-2"; then
echo "$(cat $tmpdir/$bundle_directory_name/echo-hi-2)"
echo "Hidden content not found in redacted echo-hi-2 file"
exit 1
fi
@@ -16,3 +16,15 @@ data:
removals:
values:
- REDACT FIRST TEXT PLEASE
customer-redactor-spec: |
apiVersion: troubleshoot.sh/v1beta2
kind: Redactor
metadata:
name: labelled-redactor-spec-1
spec:
redactors:
- name: redact-text-1
removals:
values:
- REDACT FIRST TEXT PLEASE
garbagge: MWdRRTlBRi9YNzB3eUE2VEgvWjdhRFVUR1UvRmU3TXdUR3Q4cnE4Nkti
@@ -17,3 +17,4 @@ stringData:
removals:
values:
- REDACT SECOND TEXT PLEASE
garbagge: MWdRRTlBRi9YNzB3eUE2VEgvWjdhRFVUR1UvRmU3TXdUR3Q4cnE4Nkti
@@ -16,3 +16,4 @@ data:
removals:
values:
- REDACT FIRST TEXT PLEASE
garbagge: MWdRRTlBRi9YNzB3eUE2VEgvWjdhRFVUR1UvRmU3TXdUR3Q4cnE4Nkti
@@ -17,3 +17,4 @@ stringData:
removals:
values:
- REDACT SECOND TEXT PLEASE
garbagge: MWdRRTlBRi9YNzB3eUE2VEgvWjdhRFVUR1UvRmU3TXdUR3Q4cnE4Nkti
+11
View File
@@ -15,3 +15,14 @@ stringData:
- data:
name: echo-hi-1
data: "I am labelled-support-bundle-1 REDACT FIRST TEXT PLEASE"
custom-spec-key: |
apiVersion: troubleshoot.sh/v1beta2
kind: SupportBundle
metadata:
name: custom-spec-key
spec:
collectors:
- data:
name: echo-hi-3
data: "I am custom-spec-key REDACT FIRST TEXT PLEASE"
garbagge: MWdRRTlBRi9YNzB3eUE2VEgvWjdhRFVUR1UvRmU3TXdUR3Q4cnE4Nkti
+1
View File
@@ -16,3 +16,4 @@ data:
- data:
name: echo-hi-2
data: "I am labelled-support-bundle-2 REDACT SECOND TEXT PLEASE"
garbagge: MWdRRTlBRi9YNzB3eUE2VEgvWjdhRFVUR1UvRmU3TXdUR3Q4cnE4Nkti
+1
View File
@@ -15,3 +15,4 @@ stringData:
- data:
name: echo-hi-3
data: "I am labelled-support-bundle-3 REDACT FIRST TEXT PLEASE"
garbagge: MWdRRTlBRi9YNzB3eUE2VEgvWjdhRFVUR1UvRmU3TXdUR3Q4cnE4Nkti
+1
View File
@@ -16,3 +16,4 @@ data:
- data:
name: echo-hi-4
data: "I am labelled-support-bundle-4 REDACT SECOND TEXT PLEASE"
garbagge: MWdRRTlBRi9YNzB3eUE2VEgvWjdhRFVUR1UvRmU3TXdUR3Q4cnE4Nkti