support

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

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

View Source
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 NewWriter

func NewWriter() *Writer

NewWriter returns an instantiated Writer.

func (*Writer) Close

func (w *Writer) Close(file *os.File) error

Close wraps os.File.Close.

func (*Writer) Mkdir

func (w *Writer) Mkdir(name string) error

Mkdir wraps os.Mkdir.

func (*Writer) MkdirAll

func (w *Writer) MkdirAll(name string) error

MkdirAll wraps os.MkdirAll.

func (*Writer) OpenFile

func (w *Writer) OpenFile(name string) (*os.File, error)

OpenFile wraps os.OpenFile.

func (*Writer) RemoveAll

func (w *Writer) RemoveAll(name string) error

RemoveAll wraps os.RemoveAll.

func (*Writer) TempDir

func (w *Writer) TempDir(name string) (string, error)

TempDir wraps ioutil.TempDir.

func (*Writer) Write

func (w *Writer) Write(filename, contents string) error

Write writes a file with a name and contents.

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

func (w *Writer) WriteTarFile(directory, filename string) error

WriteTarFile tars a directory and gives it a name.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL