managedk8s

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOption

type CreateOption func(*Provider)

CreateOption is a function that acts on a Provider and is used to construct such objects.

func WithAdditionalOpsPodLabels added in v0.8.0

func WithAdditionalOpsPodLabels(labels map[string]string) CreateOption

WithAdditionalOpsPodLabels sets the AdditionalOpsPodLabels of a Provider.

func WithConfig

func WithConfig(config *rest.Config) CreateOption

WithConfig sets the Config of a Provider.

func WithID

func WithID(id string) CreateOption

WithID sets the id of a Provider.

func WithLogger

func WithLogger(logger provider.Logger) CreateOption

WithLogger sets the logger of a Provider.

func WithMetadata

func WithMetadata(metadata map[string]string) CreateOption

WithMetadata sets the metadata of a Provider.

func WithName

func WithName(name string) CreateOption

WithName sets the name of a Provider.

type Provider

type Provider struct {
	AdditionalOpsPodLabels map[string]string
	Config                 *rest.Config
	// contains filtered or unexported fields
}

Provider is a Managed Kubernetes Cluster Provider that can be used to implement rules against a kubernetes cluster.

func FromGenericConfig

func FromGenericConfig(providerConf config.ProviderConfig) (*Provider, error)

FromGenericConfig creates a Provider from ProviderConfig.

func New

func New(options ...CreateOption) (*Provider, error)

New creates a new Provider.

func (*Provider) AddRulesets

func (p *Provider) AddRulesets(rulesets ...ruleset.Ruleset) error

AddRulesets adds Rulesets to Provider.

func (*Provider) ID

func (p *Provider) ID() string

ID returns the id of the Provider.

func (*Provider) Logger

func (p *Provider) Logger() sharedprovider.Logger

Logger returns the Provider's logger. If not set it set it to slog.Default().With("provider", p.ID()) then return it.

func (*Provider) Metadata

func (p *Provider) Metadata() map[string]string

Metadata returns the metadata of the Provider.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the name of the Provider.

func (*Provider) RunAll

RunAll executes all Rulesets registered with the Provider.

func (*Provider) RunRule

func (p *Provider) RunRule(ctx context.Context, rulesetID, rulesetVersion, ruleID string) (rule.RuleResult, error)

RunRule executes specific Rule of a known Ruleset.

func (*Provider) RunRuleset

func (p *Provider) RunRuleset(ctx context.Context, rulesetID, rulesetVersion string) (ruleset.RulesetResult, error)

RunRuleset executes all Rules of a known Ruleset.

Directories

Path Synopsis
ruleset
disak8sstig/rules
Package rules implements rules that correspond to the latest supported ruleset version.
Package rules implements rules that correspond to the latest supported ruleset version.

Jump to

Keyboard shortcuts

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