recommend

package
v0.13.15 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Package recommend package

Index

Constants

This section is empty.

Variables

View Source
var CurrentVersion string

CurrentVersion stores the current version of policy-template

View Source
var DefaultPoliciesToBeRecommended = []string{KubeArmorPolicy}

DefaultPoliciesToBeRecommended are the default policies to be recommended

View Source
var Handler interface{}

Handler interface

View Source
var KubeArmorPolicy = "KubeArmorPolicy"

KubeArmorPolicy is alias for kubearmor policy

View Source
var KyvernoPolicy = "KyvernoPolicy"

KyvernoPolicy is alias for kyverno policy. The actual kind of Kyverno policy is 'Policy' but we use 'KyvernoPolicy' to explicitly differentiate it from other policy types.

View Source
var LatestVersion string

LatestVersion stores the latest version of policy-template

Functions

func CurrentRelease added in v0.9.7

func CurrentRelease() string

CurrentRelease gets the current release of policy-templates

func DownloadAndUnzipRelease added in v0.9.7

func DownloadAndUnzipRelease() (string, error)

DownloadAndUnzipRelease downloads the latest version of policy-templates

func Recommend

func Recommend(c *k8s.Client, o Options) error

Recommend handler for karmor cli tool

func ReportAdmissionControllerRecord added in v0.13.1

func ReportAdmissionControllerRecord(policyFilePath, action string, annotations map[string]string) error

ReportAdmissionControllerRecord called once per admission controller policy

func ReportInit

func ReportInit(fname string)

ReportInit called once per execution

func ReportRecord

func ReportRecord(ms MatchSpec, policyName string) error

ReportRecord called once per policy

func ReportRender

func ReportRender(out string) error

ReportRender called finaly to render the report

func ReportSectEnd

func ReportSectEnd() error

ReportSectEnd called once per container image at the end

func ReportStart

func ReportStart(img *ImageInfo) error

ReportStart called once per container image at the start

func ReportStartGenericAdmissionControllerPolicies added in v0.13.3

func ReportStartGenericAdmissionControllerPolicies() error

ReportStartGenericAdmissionControllerPolicies called once per generic admission controller policy at the start

func UserHome added in v0.10.2

func UserHome() string

UserHome function returns users home directory

Types

type AuthConfigurations added in v0.10.2

type AuthConfigurations struct {
	Configs map[string]types.AuthConfig `json:"configs"`
}

AuthConfigurations contains the configuration information's

type Col

type Col struct {
	Name string
}

Col column of the table

type Deployment added in v0.9.5

type Deployment struct {
	Name      string
	Namespace string
	Labels    LabelMap
	Images    []string
}

Deployment contains brief information about a k8s deployment

type Description

type Description struct {
	Refs     []Ref  `json:"refs" yaml:"refs"`
	Tldr     string `json:"tldr" yaml:"tldr"`
	Detailed string `json:"detailed" yaml:"detailed"`
}

Description detailed description for the policy rule

type HTMLReport

type HTMLReport struct {
	RecordCnt *int
	// contains filtered or unexported fields
}

HTMLReport Report in HTML format

func NewHTMLReport

func NewHTMLReport() HTMLReport

NewHTMLReport instantiation on new html report

func (HTMLReport) Record

func (r HTMLReport) Record(ms MatchSpec, policyName string) error

Record addition of new HTML table row

func (HTMLReport) RecordAdmissionController added in v0.13.1

func (r HTMLReport) RecordAdmissionController(policyFilePath, action string, annotations map[string]string) error

RecordAdmissionController addition of new HTML table row for admission controller policies

func (HTMLReport) Render

func (r HTMLReport) Render(out string) error

Render output the table

func (HTMLReport) SectionEnd

func (r HTMLReport) SectionEnd() error

SectionEnd end of section of the HTML table

func (HTMLReport) Start

func (r HTMLReport) Start(img *ImageInfo) error

Start of HTML report section

func (HTMLReport) StartGenericAdmissionControllerPolicies added in v0.13.3

func (r HTMLReport) StartGenericAdmissionControllerPolicies() error

type HeaderInfo

type HeaderInfo struct {
	ReportTitle string
	DateTime    string
}

HeaderInfo HTML Header Info

type ImageInfo

type ImageInfo struct {
	Name       string
	RepoTags   []string
	Arch       string
	Distro     string
	OS         string
	FileList   []string
	DirList    []string
	Namespace  string
	Deployment string
	Labels     LabelMap
}

ImageInfo contains image information

type Info

type Info struct {
	Key string
	Val string
}

Info key val pair of the image info

type LabelMap added in v0.9.5

type LabelMap = map[string]string

LabelMap is an alias for map[string]string

type MatchSpec

type MatchSpec struct {
	Name              string                  `json:"name" yaml:"name"`
	Precondition      []string                `json:"precondition" yaml:"precondition"`
	Description       Description             `json:"description" yaml:"description"`
	Yaml              string                  `json:"yaml" yaml:"yaml"`
	Spec              pol.KubeArmorPolicySpec `json:"spec,omitempty" yaml:"spec,omitempty"`
	KyvernoPolicySpec *kyvernov1.Spec         `json:"kyvernoPolicySpec,omitempty" yaml:"kyvernoPolicySpec,omitempty"`
	KyvernoPolicyTags []string                `json:"kyvernoPolicyTags,omitempty" yaml:"kyvernoPolicyTags,omitempty"`
}

MatchSpec spec to match for defining policy

type Options

type Options struct {
	Images     []string
	Labels     []string
	Tags       []string
	Policy     []string
	Namespace  string
	OutDir     string
	ReportFile string
	Config     string
}

Options for karmor recommend

type RecordInfo

type RecordInfo struct {
	RowID       string
	Rec         []Col
	Policy      string
	Description string
	PolicyType  string
	Refs        []Ref
}

RecordInfo new row information in table

type Ref

type Ref struct {
	Name string   `json:"name" yaml:"name"`
	URL  []string `json:"url" yaml:"url"`
}

Ref for the policy rules

type SectionInfo

type SectionInfo struct {
	HdrCols                          []Col
	ImgInfo                          []Info
	GenericAdmissionControllerPolicy bool
}

SectionInfo Section information

type TextReport

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

TextReport Report in Text format

func NewTextReport

func NewTextReport() TextReport

NewTextReport instantiation of new TextReport

func (TextReport) Record

func (r TextReport) Record(ms MatchSpec, policyName string) error

Record addition of new text table row

func (TextReport) RecordAdmissionController added in v0.13.1

func (r TextReport) RecordAdmissionController(policyFilePath, action string, annotations map[string]string) error

RecordAdmissionController adds new row to table for admission controller policies

func (TextReport) Render

func (r TextReport) Render(out string) error

Render output the table

func (TextReport) SectionEnd

func (r TextReport) SectionEnd() error

SectionEnd end of section of the text table

func (TextReport) Start

func (r TextReport) Start(img *ImageInfo) error

Start Start of the section of the text report

func (TextReport) StartGenericAdmissionControllerPolicies added in v0.13.3

func (r TextReport) StartGenericAdmissionControllerPolicies() error

Jump to

Keyboard shortcuts

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