Documentation ¶
Index ¶
- Constants
- func ResourceInfoListToK8sObjectsList(infosList []*resource.Info, l logger.Logger, muteErrsAndWarns bool) ([]K8sObject, []FileProcessingError)
- type FailedReadingFileError
- type FileProcessingError
- func (e *FileProcessingError) DocumentID() (int, error)
- func (e *FileProcessingError) Error() error
- func (e *FileProcessingError) File() string
- func (e *FileProcessingError) IsFatal() bool
- func (e *FileProcessingError) IsSevere() bool
- func (e *FileProcessingError) LineNo() int
- func (e *FileProcessingError) Location() string
- type K8sObject
- type MalformedYamlDocError
- type NoK8sNetworkPolicyResourcesFoundError
- type NoK8sWorkloadResourcesFoundError
Constants ¶
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
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 ¶
func (err *NoK8sNetworkPolicyResourcesFoundError) Error() string
type NoK8sWorkloadResourcesFoundError ¶
type NoK8sWorkloadResourcesFoundError struct { }
func (*NoK8sWorkloadResourcesFoundError) Error ¶
func (err *NoK8sWorkloadResourcesFoundError) Error() string