parser

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Networkpolicy         string = "NetworkPolicy"
	Namespace             string = "Namespace"
	Pod                   string = "Pod"
	ReplicaSet            string = "ReplicaSet"
	ReplicationController string = "ReplicationController"
	Deployment            string = "Deployment"
	Statefulset           string = "StatefulSet"
	Daemonset             string = "DaemonSet"
	Job                   string = "Job"
	CronJob               string = "CronJob"
	List                  string = "List"
	NamespaceList         string = "NamespaceList"
	NetworkpolicyList     string = "NetworkPolicyList"
	PodList               string = "PodList"
	Service               string = "Service"
	Route                 string = "Route"
	Ingress               string = "Ingress"
)

relevant K8s resource kinds as string values

View Source
const IPv4LoopbackAddr = "127.0.0.1"

IPv4LoopbackAddr is used as fake IP in the absence of Pod.Status.HostIP or Pod.Status.PodIPs

Variables

This section is empty.

Functions

func ResourceInfoListToK8sObjectsList

func ResourceInfoListToK8sObjectsList(infosList []*resource.Info, l logger.Logger, muteErrsAndWarns bool) (
	[]K8sObject, []FileProcessingError)

ResourceInfoListToK8sObjectsList returns a list of K8sObject and list of FileProcessingError objects from analyzing an input list of resource.Info objects. Irrelevant resources are skipped. Possible errs/warnings as FileProcessingError: malformedYamlDoc , noK8sWorkloadResourcesFound, noK8sNetworkPolicyResourcesFound

Types

type FailedReadingFileError

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

func (*FailedReadingFileError) Error

func (err *FailedReadingFileError) Error() string

func (*FailedReadingFileError) Unwrap

func (err *FailedReadingFileError) Unwrap() error

type FileProcessingError

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

FileProcessingError holds all information about a single error/warning that occurred during the discovery and processing of the connectivity of a given K8s-app.

func FailedReadingFile

func FailedReadingFile(filePath string, err error) *FileProcessingError

func (*FileProcessingError) DocumentID

func (e *FileProcessingError) DocumentID() (int, error)

DocumentID returns the file's YAML document ID (0-based) in which the error occurred (or an error if not applicable)

func (*FileProcessingError) Error

func (e *FileProcessingError) Error() error

Error returns the actual error

func (*FileProcessingError) File

func (e *FileProcessingError) File() string

File returns the file in which the error occurred (or an empty string if no file context is available)

func (*FileProcessingError) IsFatal

func (e *FileProcessingError) IsFatal() bool

IsFatal returns whether the error is considered fatal (no further processing is possible)

func (*FileProcessingError) IsSevere

func (e *FileProcessingError) IsSevere() bool

IsSevere returns whether the error is considered severe (further processing is possible, but results may not be useable)

func (*FileProcessingError) LineNo

func (e *FileProcessingError) LineNo() int

LineNo returns the file's line-number in which the error occurred (or 0 if not applicable)

func (*FileProcessingError) Location

func (e *FileProcessingError) Location() string

Location returns file location (filename, line-number, document ID) of an error (or an empty string if not applicable)

type K8sObject

type K8sObject struct {
	Kind string
	// namespace object
	Namespace *v1.Namespace

	// netpol object
	Networkpolicy *netv1.NetworkPolicy

	// pod object
	Pod *v1.Pod

	// service object
	Service *v1.Service

	// Ingress objects
	Route   *ocroutev1.Route
	Ingress *netv1.Ingress

	// workload object
	Replicaset            *appsv1.ReplicaSet
	Deployment            *appsv1.Deployment
	Statefulset           *appsv1.StatefulSet
	ReplicationController *v1.ReplicationController
	Job                   *batchv1.Job
	CronJob               *batchv1.CronJob
	Daemonset             *appsv1.DaemonSet
}

K8sObject holds a an object kind and a pointer of the relevant object

func FilterObjectsList

func FilterObjectsList(allObjects []K8sObject, podNames []types.NamespacedName) []K8sObject

type MalformedYamlDocError

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

func (*MalformedYamlDocError) Error

func (err *MalformedYamlDocError) Error() string

func (*MalformedYamlDocError) Unwrap

func (err *MalformedYamlDocError) Unwrap() error

type NoK8sNetworkPolicyResourcesFoundError

type NoK8sNetworkPolicyResourcesFoundError struct {
}

func (*NoK8sNetworkPolicyResourcesFoundError) Error

type NoK8sWorkloadResourcesFoundError

type NoK8sWorkloadResourcesFoundError struct {
}

func (*NoK8sWorkloadResourcesFoundError) Error

Jump to

Keyboard shortcuts

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