Documentation ¶
Overview ¶
Package support contains the methods for building a support package.
Mostly copied from https://github.com/kubernetes/kubernetes/blob/33aba7ee025dfddcc140d20e9ca353ffd425f1ae/pkg/printers/internalversion/printers.go Don't edit directly, it's structured to match the original as closely as possible.
Copyright 2017 The Kubernetes 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.
Copyright (c) 2016-2021, F5 Networks, Inc.
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.
Index ¶
- Constants
- type DataFetcher
- type FileWriter
- type Writer
- func (w *Writer) Close(file *os.File) error
- func (w *Writer) Mkdir(name string) error
- func (w *Writer) MkdirAll(name string) error
- func (w *Writer) OpenFile(name string) (*os.File, error)
- func (w *Writer) RemoveAll(name string) error
- func (w *Writer) TempDir(name string) (string, error)
- func (w *Writer) Write(filename, contents string) error
- func (w *Writer) WriteFromReader(filename string, contents io.ReadCloser) error
- func (w *Writer) WriteTarFile(directory, filename string) error
Constants ¶
const ( // NodeUnreachablePodReason is the reason on a pod when its state cannot be confirmed as kubelet is unresponsive // on the node it is (was) running. NodeUnreachablePodReason = "NodeLost" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataFetcher ¶
type DataFetcher struct {
// contains filtered or unexported fields
}
DataFetcher gets all data for the support package and writes it to corresponding files.
func NewDataFetcher ¶
func NewDataFetcher( k8sClient k8s.Client, writer FileWriter, kubeconfig, directory string, collectSidecarLogs bool, ) *DataFetcher
NewDataFetcher returns a new DataFetcher.
func (*DataFetcher) GatherAndWriteData ¶
func (df *DataFetcher) GatherAndWriteData()
GatherAndWriteData pulls together all support package data and writes it to corresponding files.
type FileWriter ¶
type FileWriter interface { // Write writes a file with a name and contents. Write(filename, contents string) error // WriteFromReader writes a file with a name and contents from a ReadCloser. WriteFromReader(filename string, contents io.ReadCloser) error // WriteTarFile tars a directory and gives it a name. WriteTarFile(directory, filename string) error // Mkdir wraps os.Mkdir. Mkdir(name string) error // MkdirAll wraps os.MkdirAll. MkdirAll(name string) error // TempDir wraps ioutil.TempDir. TempDir(name string) (string, error) // OpenFile wraps os.OpenFile OpenFile(name string) (*os.File, error) // Close wraps os.File.Close. Close(file *os.File) error // RemoveAll wraps os.RemoveAll. RemoveAll(name string) error }
FileWriter is an interface for writing regular files and tar files. It also wraps many os functions to provide easy mocking for unit tests.
type Writer ¶
type Writer struct{}
Writer is the base implementation of a FileWriter.
func (*Writer) WriteFromReader ¶
func (w *Writer) WriteFromReader(filename string, contents io.ReadCloser) error
WriteFromReader writes a file with a name and contents from a ReadCloser.
func (*Writer) WriteTarFile ¶
WriteTarFile tars a directory and gives it a name.