objects

package
v0.0.37 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNodeDir      = "nodes"
	DefaultPodNamespace = "support-bundle-node-info"
)

Variables

View Source
var NodeInfoNS = v1.Namespace{
	TypeMeta: metav1.TypeMeta{
		Kind:       "Namespace",
		APIVersion: "v1",
	},
	ObjectMeta: metav1.ObjectMeta{
		Name: DefaultPodNamespace,
	},
}
View Source
var NodeInfoSA = v1.ServiceAccount{
	TypeMeta: metav1.TypeMeta{
		Kind:       "ServiceAccount",
		APIVersion: "v1",
	},
	ObjectMeta: metav1.ObjectMeta{
		Name:      "default",
		Namespace: DefaultPodNamespace,
	},
	Secrets: []v1.ObjectReference{
		{
			Name:       "default",
			Kind:       "Secret",
			APIVersion: "v1",
			Namespace:  DefaultPodNamespace,
		},
	},
}
View Source
var NodeInfoSASecret = v1.Secret{
	TypeMeta: metav1.TypeMeta{
		Kind:       "Secret",
		APIVersion: "v1",
	},
	ObjectMeta: metav1.ObjectMeta{
		Name:      "default",
		Namespace: DefaultPodNamespace,
	},
	StringData: make(map[string]string),
}

Functions

func GenerateClusterScopedRuntimeObjects

func GenerateClusterScopedRuntimeObjects(path string) (crd []runtime.Object, clusterObjs []runtime.Object, err error)

GenerateClusterScopedRuntimeObjects will parse the yaml directory in the bundle directory and apply the cluster and namespaced objects

func GenerateNamespacedRuntimeObjects

func GenerateNamespacedRuntimeObjects(path string) (nonpods []runtime.Object, pods []runtime.Object, err error)

GenerateNamespacedRuntimeObjects will return a map[string][]runtime.Object. the map key is the namespace and the list of objects associated with this namespaced. Two maps to split workloads into pods and nonpod types as pods may have dependency on other objects like service accounts.

func GenerateObjects

func GenerateObjects(file string) (obj []runtime.Object, err error)

func GenerateUnstructuredObjects

func GenerateUnstructuredObjects(file string) (objs []*unstructured.Unstructured, err error)

func ReadContent

func ReadContent(f *zip.File) ([]byte, error)

Types

type ObjectManager

type ObjectManager struct {
	// contains filtered or unexported fields
}

func NewObjectManager

func NewObjectManager(ctx context.Context, config *rest.Config, path string) (*ObjectManager, error)

NewObjectManager is a wrapper around apply and support bundle path

func (*ObjectManager) ApplyObjects

func (o *ObjectManager) ApplyObjects(objs []runtime.Object, patchStatus bool, skipGVR *schema.GroupVersionResource, progressHandler ProgressHandler) error

ApplyObjects is a wrapper to convert runtime.Objects to unstructured.Unstructured, perform some housekeeping before submitting the same to apiserver

func (*ObjectManager) CreateNodeZipObjects

func (o *ObjectManager) CreateNodeZipObjects() error

CreateNodeZipObjects will create associated objects in the cluster

func (*ObjectManager) CreateUnstructuredClusterObjects

func (o *ObjectManager) CreateUnstructuredClusterObjects() error

CreateUnstructuredClusterObjects will use the dynamic client to create all cluster scoped objects from the support bundle

func (*ObjectManager) CreateUnstructuredObjects

func (o *ObjectManager) CreateUnstructuredObjects() error

CreateUnstructuredObjects will use the dynamic client to create all namespace scoped objects from the support bundle

func (*ObjectManager) CreatedFailedObjectsList

func (o *ObjectManager) CreatedFailedObjectsList() error

func (*ObjectManager) FetchObject

func (o *ObjectManager) FetchObject(obj runtime.Object) (*unstructured.Unstructured, error)

FetchObject will use the dynamic client to fetch runtime.Object from apiserver.

func (*ObjectManager) ProcessNodeZipObjects

func (o *ObjectManager) ProcessNodeZipObjects() (noStatusObjs []runtime.Object, withStatusObjs []runtime.Object, err error)

ProcessNodeZipObjects will read the contents of the zip file and generate associated runtime.Objects

func (*ObjectManager) WaitForNamespaces

func (o *ObjectManager) WaitForNamespaces(timeout time.Duration) error

WaitForNamespaces ensures apiserver is ready and namespaces can be listed before it times out

type ProgressHandler added in v0.0.37

type ProgressHandler func(int, int)

type ProgressManager added in v0.0.37

type ProgressManager struct {
	// contains filtered or unexported fields
}

func NewProgressManager added in v0.0.37

func NewProgressManager(name string) *ProgressManager

Jump to

Keyboard shortcuts

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