Documentation ¶
Index ¶
- Constants
- type AuditData
- func (res AuditData) FilterResultsBySeverityLevel(severityLevel config.Severity) AuditData
- func (res AuditData) GetPrettyOutput(useColor bool) string
- func (a AuditData) GetResultsByNamespace() map[string][]*Result
- func (a AuditData) GetSummary() CountSummary
- func (a AuditData) GetSummaryByCategory() CountSummaryByCategory
- func (res AuditData) RemoveSuccessfulResults() AuditData
- type ClusterInfo
- type ContainerResult
- type CountSummary
- type CountSummaryByCategory
- type PodResult
- type Result
- func ApplyAllSchemaChecks(conf *config.Configuration, resourceProvider *kube.ResourceProvider, ...) (Result, error)
- func ApplyAllSchemaChecksToAllResources(conf *config.Configuration, resourceProvider *kube.ResourceProvider, ...) ([]Result, error)
- func ApplyAllSchemaChecksToResourceProvider(conf *config.Configuration, resourceProvider *kube.ResourceProvider) ([]Result, error)
- type ResultMessage
- type ResultSet
- func (rs ResultSet) GetDangers() []ResultMessage
- func (res ResultSet) GetPrettyOutput() string
- func (rs ResultSet) GetSortedResults() []ResultMessage
- func (rs ResultSet) GetSuccesses() []ResultMessage
- func (rs ResultSet) GetSummary() CountSummary
- func (rs ResultSet) GetSummaryByCategory() CountSummaryByCategory
- func (rs ResultSet) GetWarnings() []ResultMessage
Constants ¶
const (
// PolarisOutputVersion is the version of the current output structure
PolarisOutputVersion = "1.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditData ¶
type AuditData struct { PolarisOutputVersion string AuditTime string SourceType string SourceName string DisplayName string ClusterInfo ClusterInfo Results []Result Score uint }
AuditData contains all the data from a full Polaris audit
func ParseAudit ¶
ParseAudit decodes either a YAML or JSON file and returns AuditData.
func ReadAuditFromFile ¶
ReadAuditFromFile reads the data from a past audit stored in a JSON or YAML file.
func RunAudit ¶
func RunAudit(config conf.Configuration, kubeResources *kube.ResourceProvider) (AuditData, error)
RunAudit runs a full Polaris audit and returns an AuditData object
func (AuditData) FilterResultsBySeverityLevel ¶
FilterResultsBySeverityLevel includes results according to the provided severity level: 'danger' is the least verbose, 'warning' is medium verbosity, default behavior will include all results, which currently also includes 'ignore'
func (AuditData) GetPrettyOutput ¶
GetPrettyOutput returns a human-readable string
func (AuditData) GetResultsByNamespace ¶
GetResultsByNamespace organizes results by namespace
func (AuditData) GetSummary ¶
func (a AuditData) GetSummary() CountSummary
GetSummary summarizes AuditData
func (AuditData) GetSummaryByCategory ¶
func (a AuditData) GetSummaryByCategory() CountSummaryByCategory
GetSummaryByCategory summarizes AuditData
func (AuditData) RemoveSuccessfulResults ¶
RemoveSuccessfulResults removes all tests that have passed
type ClusterInfo ¶
ClusterInfo contains Polaris results as well as some high-level stats
type ContainerResult ¶
ContainerResult provides a list of validation messages for each container.
func (ContainerResult) GetPrettyOutput ¶
func (res ContainerResult) GetPrettyOutput() string
GetPrettyOutput returns a human-readable string
type CountSummary ¶
CountSummary provides a high level overview of success, warnings, and errors.
func (*CountSummary) AddResult ¶
func (cs *CountSummary) AddResult(result ResultMessage)
AddResult adds a single result to the summary
func (*CountSummary) AddSummary ¶
func (cs *CountSummary) AddSummary(other CountSummary)
AddSummary adds two CountSummaries together
func (CountSummary) GetScore ¶
func (cs CountSummary) GetScore() uint
GetScore returns an overall score in [0, 100] for the CountSummary
type CountSummaryByCategory ¶
type CountSummaryByCategory map[string]CountSummary
CountSummaryByCategory is a map from category to CountSummary
func (CountSummaryByCategory) AddSummary ¶
func (csc CountSummaryByCategory) AddSummary(other CountSummaryByCategory)
AddSummary adds two CountSummaryByCategories together
type PodResult ¶
type PodResult struct { Name string Results ResultSet ContainerResults []ContainerResult }
PodResult provides a list of validation messages for each pod.
func (PodResult) GetPrettyOutput ¶
GetPrettyOutput returns a human-readable string
func (PodResult) GetSummary ¶
func (p PodResult) GetSummary() CountSummary
GetSummary summarizes a PodResult
func (PodResult) GetSummaryByCategory ¶
func (p PodResult) GetSummaryByCategory() CountSummaryByCategory
GetSummaryByCategory summarizes a PodResult
type Result ¶
type Result struct { Name string Namespace string Kind string Results ResultSet PodResult *PodResult CreatedTime time.Time }
Result provides results for a Kubernetes object
func ApplyAllSchemaChecks ¶
func ApplyAllSchemaChecks(conf *config.Configuration, resourceProvider *kube.ResourceProvider, resource kube.GenericResource) (Result, error)
ApplyAllSchemaChecks applies available checks to a single resource
func ApplyAllSchemaChecksToAllResources ¶
func ApplyAllSchemaChecksToAllResources(conf *config.Configuration, resourceProvider *kube.ResourceProvider, resources []kube.GenericResource) ([]Result, error)
ApplyAllSchemaChecksToAllResources applies available checks to a list of resources
func ApplyAllSchemaChecksToResourceProvider ¶
func ApplyAllSchemaChecksToResourceProvider(conf *config.Configuration, resourceProvider *kube.ResourceProvider) ([]Result, error)
ApplyAllSchemaChecksToResourceProvider applies all available checks to a ResourceProvider
func (Result) GetPrettyOutput ¶
GetPrettyOutput returns a human-readable string
func (Result) GetSummaryByCategory ¶
func (c Result) GetSummaryByCategory() CountSummaryByCategory
GetSummaryByCategory summarizes a Result
type ResultMessage ¶
type ResultMessage struct { ID string Message string Details []string Success bool Severity config.Severity Category string Mutations []config.Mutation }
ResultMessage is the result of a given check
type ResultSet ¶
type ResultSet map[string]ResultMessage
ResultSet contiains the results for a set of checks
func (ResultSet) GetDangers ¶
func (rs ResultSet) GetDangers() []ResultMessage
GetDangers returns the error messages in a result set
func (ResultSet) GetPrettyOutput ¶
GetPrettyOutput returns a human-readable string
func (ResultSet) GetSortedResults ¶
func (rs ResultSet) GetSortedResults() []ResultMessage
GetSortedResults returns messages sorted as errors, then warnings, then successes
func (ResultSet) GetSuccesses ¶
func (rs ResultSet) GetSuccesses() []ResultMessage
GetSuccesses returns the success messages in a result set
func (ResultSet) GetSummary ¶
func (rs ResultSet) GetSummary() CountSummary
GetSummary summarizes a ResultSet
func (ResultSet) GetSummaryByCategory ¶
func (rs ResultSet) GetSummaryByCategory() CountSummaryByCategory
GetSummaryByCategory summarizes a ResultSet
func (ResultSet) GetWarnings ¶
func (rs ResultSet) GetWarnings() []ResultMessage
GetWarnings returns the warning messages in a result set