virtualgarden

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 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 WithGardenConfig

func WithGardenConfig(config *rest.Config) CreateOption

WithGardenConfig sets the SeedConfig of a Provider.

func WithID

func WithID(id string) CreateOption

WithID sets the id of a Provider.

func WithLogger

func WithLogger(logger *slog.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.

func WithRuntimeConfig

func WithRuntimeConfig(config *rest.Config) CreateOption

WithRuntimeConfig sets the ShootConfig of a Provider.

type Provider

type Provider struct {
	RuntimeConfig, GardenConfig *rest.Config
	// contains filtered or unexported fields
}

Provider is a Garden Cluster Provider that can be used to implement rules against a virtual garden cluster and its controlplane (residing in a runtime 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() *slog.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

Jump to

Keyboard shortcuts

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