diff --git a/NOTICE.txt b/NOTICE.txt index 25f4a63..5b2f4b3 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -70,11 +70,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- Module : github.com/spf13/cobra -Version : v1.4.0 -Time : 2022-03-10T15:19:35Z +Version : v1.5.0 +Time : 2022-06-21T02:06:17Z Licence : Apache-2.0 -Contents of probable licence file $GOMODCACHE/github.com/spf13/cobra@v1.4.0/LICENSE.txt: +Contents of probable licence file $GOMODCACHE/github.com/spf13/cobra@v1.5.0/LICENSE.txt: Apache License Version 2.0, January 2004 @@ -252,13 +252,50 @@ Contents of probable licence file $GOMODCACHE/github.com/spf13/cobra@v1.4.0/LICE of your accepting any such warranty or additional liability. +-------------------------------------------------------------------------------- +Module : golang.org/x/text +Version : v0.3.7 +Time : 2021-08-10T18:28:16Z +Licence : BSD-3-Clause + +Contents of probable licence file $GOMODCACHE/golang.org/x/text@v0.3.7/LICENSE: + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + -------------------------------------------------------------------------------- Module : k8s.io/api -Version : v0.24.0 -Time : 2022-05-03T22:34:50Z +Version : v0.24.2 +Time : 2022-06-17T03:56:39Z Licence : Apache-2.0 -Contents of probable licence file $GOMODCACHE/k8s.io/api@v0.24.0/LICENSE: +Contents of probable licence file $GOMODCACHE/k8s.io/api@v0.24.2/LICENSE: Apache License @@ -466,11 +503,11 @@ Contents of probable licence file $GOMODCACHE/k8s.io/api@v0.24.0/LICENSE: -------------------------------------------------------------------------------- Module : k8s.io/apimachinery -Version : v0.24.0 +Version : v0.24.2 Time : 2022-03-31T22:54:01Z Licence : Apache-2.0 -Contents of probable licence file $GOMODCACHE/k8s.io/apimachinery@v0.24.0/LICENSE: +Contents of probable licence file $GOMODCACHE/k8s.io/apimachinery@v0.24.2/LICENSE: Apache License @@ -678,11 +715,11 @@ Contents of probable licence file $GOMODCACHE/k8s.io/apimachinery@v0.24.0/LICENS -------------------------------------------------------------------------------- Module : k8s.io/cli-runtime -Version : v0.24.0 -Time : 2022-05-03T23:10:24Z +Version : v0.24.2 +Time : 2022-06-17T04:39:50Z Licence : Apache-2.0 -Contents of probable licence file $GOMODCACHE/k8s.io/cli-runtime@v0.24.0/LICENSE: +Contents of probable licence file $GOMODCACHE/k8s.io/cli-runtime@v0.24.2/LICENSE: Apache License @@ -890,11 +927,11 @@ Contents of probable licence file $GOMODCACHE/k8s.io/cli-runtime@v0.24.0/LICENSE -------------------------------------------------------------------------------- Module : k8s.io/client-go -Version : v0.24.0 -Time : 2022-05-03T22:41:04Z +Version : v0.24.2 +Time : 2022-06-17T04:04:17Z Licence : Apache-2.0 -Contents of probable licence file $GOMODCACHE/k8s.io/client-go@v0.24.0/LICENSE: +Contents of probable licence file $GOMODCACHE/k8s.io/client-go@v0.24.2/LICENSE: Apache License @@ -1102,11 +1139,11 @@ Contents of probable licence file $GOMODCACHE/k8s.io/client-go@v0.24.0/LICENSE: -------------------------------------------------------------------------------- Module : k8s.io/kubectl -Version : v0.24.0 -Time : 2022-05-03T23:41:22Z +Version : v0.24.2 +Time : 2022-06-17T05:14:55Z Licence : Apache-2.0 -Contents of probable licence file $GOMODCACHE/k8s.io/kubectl@v0.24.0/LICENSE: +Contents of probable licence file $GOMODCACHE/k8s.io/kubectl@v0.24.2/LICENSE: Apache License Version 2.0, January 2004 @@ -1741,37 +1778,6 @@ Contents of probable licence file $GOMODCACHE/cloud.google.com/go@v0.99.0/LICENS limitations under the License. --------------------------------------------------------------------------------- -Module : github.com/Azure/go-ansiterm -Version : v0.0.0-20210617225240-d185dfc1b5a1 -Time : 2021-06-17T22:52:40Z -Licence : MIT - -Contents of probable licence file $GOMODCACHE/github.com/!azure/go-ansiterm@v0.0.0-20210617225240-d185dfc1b5a1/LICENSE: - -The MIT License (MIT) - -Copyright (c) 2015 Microsoft Corporation - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - -------------------------------------------------------------------------------- Module : github.com/Azure/go-autorest Version : v14.2.0+incompatible @@ -3269,36 +3275,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Module : github.com/armon/go-socks5 -Version : v0.0.0-20160902184237-e75332964ef5 -Time : 2016-09-02T18:42:37Z -Licence : MIT - -Contents of probable licence file $GOMODCACHE/github.com/armon/go-socks5@v0.0.0-20160902184237-e75332964ef5/LICENSE: - -The MIT License (MIT) - -Copyright (c) 2014 Armon Dadgar - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -------------------------------------------------------------------------------- Module : github.com/chai2010/gettext-go Version : v0.0.0-20160711120539-c6fed771bfd5 @@ -3336,39 +3312,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Module : github.com/creack/pty -Version : v1.1.11 -Time : 2020-05-19T16:21:43Z -Licence : MIT - -Contents of probable licence file $GOMODCACHE/github.com/creack/pty@v1.1.11/LICENSE: - -Copyright (c) 2011 Keith Rarick - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, -sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall -be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -------------------------------------------------------------------------------- Module : github.com/davecgh/go-spew Version : v1.1.1 @@ -3394,43 +3337,6 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------------------------------------------------- -Module : github.com/elazarl/goproxy -Version : v0.0.0-20180725130230-947c36da3153 -Time : 2018-07-25T13:02:30Z -Licence : BSD-3-Clause - -Contents of probable licence file $GOMODCACHE/github.com/elazarl/goproxy@v0.0.0-20180725130230-947c36da3153/LICENSE: - -Copyright (c) 2012 Elazar Leibovich. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Elazar Leibovich. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -------------------------------------------------------------------------------- Module : github.com/emicklei/go-restful Version : v2.9.5+incompatible @@ -5564,29 +5470,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Module : github.com/inconshreveable/mousetrap -Version : v1.0.0 -Time : 2014-10-17T20:07:13Z -Licence : Apache-2.0 - -Contents of probable licence file $GOMODCACHE/github.com/inconshreveable/mousetrap@v1.0.0/LICENSE: - -Copyright 2014 Alan Shreve - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -------------------------------------------------------------------------------- Module : github.com/josharian/intern Version : v1.0.0 @@ -6996,38 +6879,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Module : github.com/stretchr/objx -Version : v0.2.0 -Time : 2019-04-09T12:31:02Z -Licence : MIT - -Contents of probable licence file $GOMODCACHE/github.com/stretchr/objx@v0.2.0/LICENSE: - -The MIT License - -Copyright (c) 2014 Stretchr, Inc. -Copyright (c) 2017-2018 objx contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - -------------------------------------------------------------------------------- Module : github.com/stretchr/testify Version : v1.7.0 @@ -7313,43 +7164,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- -Module : golang.org/x/text -Version : v0.3.7 -Time : 2021-08-10T18:28:16Z -Licence : BSD-3-Clause - -Contents of probable licence file $GOMODCACHE/golang.org/x/text@v0.3.7/LICENSE: - -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -------------------------------------------------------------------------------- Module : golang.org/x/time Version : v0.0.0-20220210224613-90d013bbcef8 @@ -8056,36 +7870,13 @@ See the License for the specific language governing permissions and limitations under the License. --------------------------------------------------------------------------------- -Module : gotest.tools/v3 -Version : v3.0.3 -Time : 2020-09-27T20:53:12Z -Licence : Apache-2.0 - -Contents of probable licence file $GOMODCACHE/gotest.tools/v3@v3.0.3/LICENSE: - -Copyright 2018 gotest.tools authors - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -------------------------------------------------------------------------------- Module : k8s.io/component-base -Version : v0.24.0 -Time : 2022-05-03T22:43:43Z +Version : v0.24.2 +Time : 2022-06-17T04:07:19Z Licence : Apache-2.0 -Contents of probable licence file $GOMODCACHE/k8s.io/component-base@v0.24.0/LICENSE: +Contents of probable licence file $GOMODCACHE/k8s.io/component-base@v0.24.2/LICENSE: Apache License diff --git a/cmd/main.go b/cmd/main.go index ae2fde2..8a4e1c5 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -7,6 +7,7 @@ package main import ( "log" "os" + "time" "github.com/elastic/eck-diagnostics/internal" "github.com/spf13/cobra" @@ -34,6 +35,7 @@ func main() { cmd.Flags().StringVar(&diagParams.OutputDir, "output-directory", "", "Path where to output diagnostic results") cmd.Flags().StringVar(&diagParams.Kubeconfig, "kubeconfig", "", "optional path to kube config, defaults to $HOME/.kube/config") cmd.Flags().BoolVar(&diagParams.Verbose, "verbose", false, "Verbose mode") + cmd.Flags().DurationVar(&diagParams.StackDiagnosticsTimeout, "stack-diagnostics-timeout", 5*time.Minute, "Maximum time to wait for Elaticsearch and Kibana diagnostics to complete") if err := cmd.MarkFlagRequired("resources-namespaces"); err != nil { exitWithError(err) diff --git a/internal/diag.go b/internal/diag.go index dae3ad5..7b86e7e 100644 --- a/internal/diag.go +++ b/internal/diag.go @@ -28,15 +28,16 @@ var logger = log.Logger // Params is a collection of parameters controlling the extraction of diagnostic data. // See the main command for explanation of individual parameters. type Params struct { - DiagnosticImage string - ECKVersion string - Kubeconfig string - OperatorNamespaces []string - ResourcesNamespaces []string - OutputDir string - RunStackDiagnostics bool - RunAgentDiagnostics bool - Verbose bool + DiagnosticImage string + ECKVersion string + Kubeconfig string + OperatorNamespaces []string + ResourcesNamespaces []string + OutputDir string + RunStackDiagnostics bool + RunAgentDiagnostics bool + Verbose bool + StackDiagnosticsTimeout time.Duration } // AllNamespaces returns a slice containing all namespaces from which we want to extract diagnostic data. @@ -198,7 +199,7 @@ LOOP: ) if params.RunStackDiagnostics { - runStackDiagnostics(kubectl, ns, zipFile, params.Verbose, params.DiagnosticImage, stopCh) + runStackDiagnostics(kubectl, ns, zipFile, params.Verbose, params.DiagnosticImage, params.StackDiagnosticsTimeout, stopCh) } if params.RunAgentDiagnostics { diff --git a/internal/stackdiag.go b/internal/stackdiag.go index d712f1e..4c685dc 100644 --- a/internal/stackdiag.go +++ b/internal/stackdiag.go @@ -48,8 +48,6 @@ const ( var ( //go:embed job.tpl.yml jobTemplate string - // jobTimeout governs how long at most diagnostic data extraction may take. - jobTimeout = 5 * time.Minute // jobPollingInterval is used to configure the informer used to be notified of Pod status changes. jobPollingInterval = 10 * time.Second ) @@ -98,10 +96,11 @@ type diagJobState struct { cancelFunc context.CancelFunc verbose bool diagnosticImage string + jobTimeout time.Duration } // newDiagJobState creates a new state struct to run diagnostic Pods. -func newDiagJobState(k *Kubectl, ns string, verbose bool, image string, stopCh chan struct{}) *diagJobState { +func newDiagJobState(k *Kubectl, ns string, verbose bool, image string, jobTimeout time.Duration, stopCh chan struct{}) *diagJobState { ctx, cancelFunc := context.WithCancel(context.Background()) factory := informers.NewSharedInformerFactoryWithOptions( k, @@ -119,6 +118,7 @@ func newDiagJobState(k *Kubectl, ns string, verbose bool, image string, stopCh c context: ctx, verbose: verbose, diagnosticImage: image, + jobTimeout: jobTimeout, } go func() { <-stopCh @@ -181,7 +181,7 @@ func (ds *diagJobState) scheduleJob(typ, esName, resourceName string, tls bool) } // start a dedicated timer for each job and terminate the job when the timer expires. go func(j *diagJob) { - timerChan := j.StartTimer(jobTimeout) + timerChan := j.StartTimer(ds.jobTimeout) select { case <-timerChan: logger.Printf("Diagnostic job for %s %s/%s timed out, terminating", j.Typ, j.Namespace, j.ResourceName) @@ -351,8 +351,8 @@ func (ds *diagJobState) detectImageErrors(pod *corev1.Pod) error { // runStackDiagnostics extracts diagnostic data from all clusters in the given namespace ns using the official // Elasticsearch support diagnostics. -func runStackDiagnostics(k *Kubectl, ns string, zipFile *archive.ZipFile, verbose bool, image string, stopCh chan struct{}) { - state := newDiagJobState(k, ns, verbose, image, stopCh) +func runStackDiagnostics(k *Kubectl, ns string, zipFile *archive.ZipFile, verbose bool, image string, jobTimeout time.Duration, stopCh chan struct{}) { + state := newDiagJobState(k, ns, verbose, image, jobTimeout, stopCh) if err := scheduleJobs(k, ns, zipFile.AddError, state, elasticsearchJob); err != nil { zipFile.AddError(err)