network

package
v0.0.0-...-46fbbb1 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2022 VMware, Inc. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const EnforcerName = "quarantine_vulnerable_workload"

EnforcerName is the name of network policy enforcer.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientMock

type ClientMock struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

	// DeleteFunc mocks the Delete method.
	DeleteFunc func(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

	// DeleteAllOfFunc mocks the DeleteAllOf method.
	DeleteAllOfFunc func(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

	// GetFunc mocks the Get method.
	GetFunc func(ctx context.Context, key types.NamespacedName, obj client.Object) error

	// ListFunc mocks the List method.
	ListFunc func(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

	// PatchFunc mocks the Patch method.
	PatchFunc func(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

	// RESTMapperFunc mocks the RESTMapper method.
	RESTMapperFunc func() meta.RESTMapper

	// SchemeFunc mocks the Scheme method.
	SchemeFunc func() *runtime.Scheme

	// StatusFunc mocks the Status method.
	StatusFunc func() client.StatusWriter

	// UpdateFunc mocks the Update method.
	UpdateFunc func(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error
	// contains filtered or unexported fields
}

func (*ClientMock) Create

func (mock *ClientMock) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

Create calls CreateFunc.

func (*ClientMock) CreateCalls

func (mock *ClientMock) CreateCalls() []struct {
	Ctx  context.Context
	Obj  client.Object
	Opts []client.CreateOption
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedClient.CreateCalls())

func (*ClientMock) Delete

func (mock *ClientMock) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

Delete calls DeleteFunc.

func (*ClientMock) DeleteAllOf

func (mock *ClientMock) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

DeleteAllOf calls DeleteAllOfFunc.

func (*ClientMock) DeleteAllOfCalls

func (mock *ClientMock) DeleteAllOfCalls() []struct {
	Ctx  context.Context
	Obj  client.Object
	Opts []client.DeleteAllOfOption
}

DeleteAllOfCalls gets all the calls that were made to DeleteAllOf. Check the length with:

len(mockedClient.DeleteAllOfCalls())

func (*ClientMock) DeleteCalls

func (mock *ClientMock) DeleteCalls() []struct {
	Ctx  context.Context
	Obj  client.Object
	Opts []client.DeleteOption
}

DeleteCalls gets all the calls that were made to Delete. Check the length with:

len(mockedClient.DeleteCalls())

func (*ClientMock) Get

func (mock *ClientMock) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error

func (*ClientMock) GetCalls

func (mock *ClientMock) GetCalls() []struct {
	Ctx context.Context
	Key types.NamespacedName
	Obj client.Object
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedClient.GetCalls())

func (*ClientMock) List

func (mock *ClientMock) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

List calls ListFunc.

func (*ClientMock) ListCalls

func (mock *ClientMock) ListCalls() []struct {
	Ctx  context.Context
	List client.ObjectList
	Opts []client.ListOption
}

ListCalls gets all the calls that were made to List. Check the length with:

len(mockedClient.ListCalls())

func (*ClientMock) Patch

func (mock *ClientMock) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

Patch calls PatchFunc.

func (*ClientMock) PatchCalls

func (mock *ClientMock) PatchCalls() []struct {
	Ctx   context.Context
	Obj   client.Object
	Patch client.Patch
	Opts  []client.PatchOption
}

PatchCalls gets all the calls that were made to Patch. Check the length with:

len(mockedClient.PatchCalls())

func (*ClientMock) RESTMapper

func (mock *ClientMock) RESTMapper() meta.RESTMapper

RESTMapper calls RESTMapperFunc.

func (*ClientMock) RESTMapperCalls

func (mock *ClientMock) RESTMapperCalls() []struct {
}

RESTMapperCalls gets all the calls that were made to RESTMapper. Check the length with:

len(mockedClient.RESTMapperCalls())

func (*ClientMock) Scheme

func (mock *ClientMock) Scheme() *runtime.Scheme

Scheme calls SchemeFunc.

func (*ClientMock) SchemeCalls

func (mock *ClientMock) SchemeCalls() []struct {
}

SchemeCalls gets all the calls that were made to Scheme. Check the length with:

len(mockedClient.SchemeCalls())

func (*ClientMock) Status

func (mock *ClientMock) Status() client.StatusWriter

Status calls StatusFunc.

func (*ClientMock) StatusCalls

func (mock *ClientMock) StatusCalls() []struct {
}

StatusCalls gets all the calls that were made to Status. Check the length with:

len(mockedClient.StatusCalls())

func (*ClientMock) SubResource

func (mock *ClientMock) SubResource(subResource string) client.SubResourceClient

func (*ClientMock) Update

func (mock *ClientMock) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

Update calls UpdateFunc.

func (*ClientMock) UpdateCalls

func (mock *ClientMock) UpdateCalls() []struct {
	Ctx  context.Context
	Obj  client.Object
	Opts []client.UpdateOption
}

UpdateCalls gets all the calls that were made to Update. Check the length with:

len(mockedClient.UpdateCalls())

type Enforcer

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

Enforcer enforces network policy. Check reference https://kubernetes.io/docs/concepts/services-networking/network-policies/.

func New

func New() *Enforcer

New Enforcer.

func (*Enforcer) Enforce

func (e *Enforcer) Enforce(ctx context.Context, workload *rcworkload.Workload, option ...enforcement.Option) error

Enforce implements policy.Enforcer.

func (*Enforcer) HasBeenEnforced

func (e *Enforcer) HasBeenEnforced(ctx context.Context, workload *rcworkload.Workload) (bool, error)

HasBeenEnforced implements policy.Enforcer.

func (*Enforcer) Revoke

func (e *Enforcer) Revoke(ctx context.Context, workload *rcworkload.Workload) error

Revoke implements policy.Enforcer.

func (*Enforcer) UseClient

func (e *Enforcer) UseClient(cli client.Client) *Enforcer

UseClient uses k8s client.

func (*Enforcer) WithScheme

func (e *Enforcer) WithScheme(scheme *runtime.Scheme) *Enforcer

WithScheme with scheme.

Jump to

Keyboard shortcuts

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