policies

package
v1.8.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

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

Fetcher fetches Kubewarden policies from the Kubernetes cluster, and filters policies that are auditable.

func NewFetcher

func NewFetcher(kubewardenNamespace string, skippedNs []string) (*Fetcher, error)

NewFetcher returns a Fetcher. It will try to use in-cluster config, which will work just if audit-scanner is deployed inside a Pod. If in-cluster fails, it will try to fetch the kube config from the home dir. It will return an error if both attempts fail.

func (*Fetcher) GetAuditedNamespaces

func (f *Fetcher) GetAuditedNamespaces() (*v1.NamespaceList, error)

GetAuditedNamespaces gets all namespaces besides the ones in fetcher.skippedNs This function cannot be tested with fake.client, as fake.client doesn't support fields.OneTermNotEqualSelector()

func (*Fetcher) GetClusterAdmissionPolicies

func (f *Fetcher) GetClusterAdmissionPolicies() ([]policiesv1.Policy, int, error)

GetClusterAdmissionPolicies gets all auditable ClusterAdmissionPolicy policies, and the number of skipped policies

func (*Fetcher) GetNamespace

func (f *Fetcher) GetNamespace(nsName string) (*v1.Namespace, error)

func (*Fetcher) GetPoliciesForANamespace

func (f *Fetcher) GetPoliciesForANamespace(namespace string) ([]policiesv1.Policy, int, error)

GetPoliciesForANamespace gets all auditable policies for a given namespace, and the number of skipped policies

Jump to

Keyboard shortcuts

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