linter

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NetpolKey added in v0.5.1

func NetpolKey(netpol *networkingv1.NetworkPolicy) string

func WarningsTable

func WarningsTable(warnings []Warning) string

Types

type Check

type Check string
const (
	// CheckSourceMissingNamespace omitting the namespace will create the policy in the default namespace
	CheckSourceMissingNamespace Check = "CheckSourceMissingNamespace"
	// CheckSourcePortMissingProtocol omitting the protocol from a NetworkPolicyPort will default to TCP
	CheckSourcePortMissingProtocol Check = "CheckSourcePortMissingProtocol"
	// CheckSourceMissingPolicyTypes omitting the types can sometimes be automatically handled; but it's better to explicitly list them
	CheckSourceMissingPolicyTypes Check = "CheckSourceMissingPolicyTypes"
	// CheckSourceMissingPolicyTypeIngress if the policy has ingress rules, then that type should be present
	CheckSourceMissingPolicyTypeIngress Check = "CheckSourceMissingPolicyTypeIngress"
	// CheckSourceMissingPolicyTypeEgress if the policy has egress rules, then that type should be present
	CheckSourceMissingPolicyTypeEgress Check = "CheckSourceMissingPolicyTypeEgress"
	// CheckSourceDuplicatePolicyName duplicate names of source network policies
	CheckSourceDuplicatePolicyName Check = "CheckSourceDuplicatePolicyName"

	CheckDNSBlockedOnTCP         Check = "CheckDNSBlockedOnTCP"
	CheckDNSBlockedOnUDP         Check = "CheckDNSBlockedOnUDP"
	CheckTargetAllIngressBlocked Check = "CheckTargetAllIngressBlocked"
	CheckTargetAllEgressBlocked  Check = "CheckTargetAllEgressBlocked"
	CheckTargetAllIngressAllowed Check = "CheckTargetAllIngressAllowed"
	CheckTargetAllEgressAllowed  Check = "CheckTargetAllEgressAllowed"
)

type Warning

type Warning interface {
	OriginIsSource() bool
	GetCheck() Check
	GetTarget() string
	GetSourcePolicies() string
}

func Lint

func Lint(kubePolicies []*networkingv1.NetworkPolicy, skip *set.Set[Check]) []Warning

func LintNetworkPolicyPorts

func LintNetworkPolicyPorts(policy *networkingv1.NetworkPolicy, ports []networkingv1.NetworkPolicyPort) []Warning

func LintResolvedPolicies

func LintResolvedPolicies(policies *matcher.Policy) []Warning

func LintSourcePolicies

func LintSourcePolicies(kubePolicies []*networkingv1.NetworkPolicy) []Warning

Jump to

Keyboard shortcuts

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