configauditreport

package
v0.0.0-...-7c36f52 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package configauditreport provides primitives for working with Kubernetes workload configuration checkers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadWriter

type ReadWriter interface {
	Writer
	Reader
}

func NewReadWriter

func NewReadWriter(client client.Client) ReadWriter

NewReadWriter constructs a new ReadWriter which is using the client package provided by the controller-runtime libraries for interacting with the Kubernetes API server.

type Reader

type Reader interface {

	// FindReportByOwner returns a v1alpha1.ConfigAuditReport owned by the given
	// kube.ObjectRef or nil if the report is not found.
	FindReportByOwner(ctx context.Context, owner kube.ObjectRef) (*v1alpha1.ConfigAuditReport, error)

	// FindReportByOwnerInHierarchy is similar to FindReportByOwner except that it tries to find
	// a v1alpha1.ConfigAuditReport object owned by related Kubernetes objects.
	// For example, if the given owner is a Deployment, but a report is owned by the
	// active ReplicaSet (current revision) this method will return the report.
	FindReportByOwnerInHierarchy(ctx context.Context, owner kube.ObjectRef) (*v1alpha1.ConfigAuditReport, error)

	// FindClusterReportByOwner returns a v1alpha1.ClusterConfigAuditReport owned by the given
	// kube.ObjectRef or nil if the report is not found.
	FindClusterReportByOwner(ctx context.Context, owner kube.ObjectRef) (*v1alpha1.ClusterConfigAuditReport, error)
}

Reader is the interface that wraps methods for finding v1alpha1.ConfigAuditReport and v1alpha1.ClusterConfigAuditReport objects. TODO(danielpacak): Consider returning starboard.ResourceNotFound error instead of returning nil.

type ReportBuilder

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

func NewReportBuilder

func NewReportBuilder(scheme *runtime.Scheme) *ReportBuilder

func (*ReportBuilder) Controller

func (b *ReportBuilder) Controller(controller client.Object) *ReportBuilder

func (*ReportBuilder) Data

func (*ReportBuilder) GetClusterReport

func (b *ReportBuilder) GetClusterReport() (v1alpha1.ClusterConfigAuditReport, error)

func (*ReportBuilder) GetReport

func (b *ReportBuilder) GetReport() (v1alpha1.ConfigAuditReport, error)

func (*ReportBuilder) PluginConfigHash

func (b *ReportBuilder) PluginConfigHash(hash string) *ReportBuilder

func (*ReportBuilder) ResourceSpecHash

func (b *ReportBuilder) ResourceSpecHash(hash string) *ReportBuilder

func (*ReportBuilder) Write

func (b *ReportBuilder) Write(ctx context.Context, writer Writer) error

type ResourceController

ResourceController watches all Kubernetes kinds and generates v1alpha1.ConfigAuditReport instances based on OPA Rego policies as fast as possible.

func (*ResourceController) SetupWithManager

func (r *ResourceController) SetupWithManager(mgr ctrl.Manager) error

type Writer

type Writer interface {

	// WriteReport creates or updates the given v1alpha1.ConfigAuditReport instance.
	WriteReport(ctx context.Context, report v1alpha1.ConfigAuditReport) error

	// WriteClusterReport creates or updates the given v1alpha1.ClusterConfigAuditReport instance.
	WriteClusterReport(ctx context.Context, report v1alpha1.ClusterConfigAuditReport) error
}

Writer is the interface for saving v1alpha1.ClusterConfigAuditReport and v1alpha1.ConfigAuditReport instances.

Jump to

Keyboard shortcuts

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