checks

package
v0.0.0-...-29c0a4e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	APIVersion2                  = "v2"
	ReadmeExist                  = "Chart has a README"
	ReadmeDoesNotExist           = "Chart does not have a README"
	NotHelm3Reason               = "API version is not V2, used in Helm 3"
	Helm3Reason                  = "API version is V2, used in Helm 3"
	TestTemplatePrefix           = "templates/tests/"
	ChartTestFilesExist          = "Chart test files exist"
	ChartTestFilesDoesNotExist   = "Chart test files do not exist"
	KuberVersionSpecified        = "Kubernetes version specified"
	KuberVersionNotSpecified     = "Kubernetes version is not specified"
	KuberVersionProcessingError  = "Error converting kubeVersion to an OCP range"
	ValuesSchemaFileExist        = "Values schema file exist"
	ValuesSchemaFileDoesNotExist = "Values schema file does not exist"
	ValuesFileExist              = "Values file exist"
	ValuesFileDoesNotExist       = "Values file does not exist"
	ChartContainCRDs             = "Chart contains CRDs"
	ChartDoesNotContainCRDs      = "Chart does not contain CRDs"
	HelmLintSuccessful           = "Helm lint successful"
	HelmLintHasFailedPrefix      = "Helm lint has failed: "
	CSIObjectsExist              = "CSI objects exist"
	CSIObjectsDoesNotExist       = "CSI objects do not exist"
	NoImagesToCertify            = "No images to certify"
	ImageCertifyFailed           = "Failed to certify images"
	ImageCertified               = "Image is Red Hat certified"
	ImageNotCertified            = "Image is not Red Hat certified"
	ChartTestingSuccess          = "Chart tests have passed"
	MetadataFailure              = "Empty metadata in chart"
	RequiredAnnotationsSuccess   = "All required annotations present"
	RequiredAnnotationsFailure   = "Missing required annotations"
	ChartSigned                  = "Chart is signed"
	ChartNotSigned               = "Chart is not signed"
	SignatureIsNotPresentSuccess = "Signature verification not required"
	SignatureIsValidSuccess      = "Signature verification passed"
	SignatureFailure             = "Signature verification failed"
	SignatureNoKey               = "Signature verification skipped, a public key was not specified"
	ImageCertifySkipped          = "Image certification skipped"
	RedHatRegistry               = "registry.redhat.io/"
)
View Source
const (
	ReleaseConfigString string = "release"
)

Variables

This section is empty.

Functions

func IsChartNotFound

func IsChartNotFound(err error) bool

func LoadChartFromURI

func LoadChartFromURI(opts *CheckOptions) (*chart.Chart, string, error)

LoadChartFromURI attempts to retrieve a chart from the given uri string. It accepts "http", "https", "file" schemes, and defaults to "file" if there isn't one.

Types

type AnnotationHolder

type AnnotationHolder interface {
	SetCertifiedOpenShiftVersion(version string)
	GetCertifiedOpenShiftVersionFlag() string
	SetSupportedOpenShiftVersions(versions string)
}

type ChartCache

type ChartCache interface {
	MakeKey(uri string) string
	Add(uri string, chrt *chart.Chart) (ChartCacheItem, error)
	Get(uri string) (ChartCacheItem, bool, error)
}

type ChartCacheItem

type ChartCacheItem struct {
	Chart *chart.Chart
	Path  string
}

type ChartNotFoundErr

type ChartNotFoundErr string

func (ChartNotFoundErr) Error

func (c ChartNotFoundErr) Error() string

type Check

type Check struct {
	CheckID CheckID
	Type    apiChecks.CheckType
	Func    CheckFunc
}

type CheckFunc

type CheckFunc func(options *CheckOptions) (Result, error)

type CheckID

type CheckID struct {
	Name    apiChecks.CheckName
	Version string
}

type CheckOptions

type CheckOptions struct {
	// URI is the location of the chart to be checked.
	URI string
	// ViperConfig is the configuration collected by Viper.
	ViperConfig *viper.Viper
	// Values contains the values informed by the user through command line options.
	Values map[string]interface{}
	// HelmEnvSettings contains the Helm related environment settings.
	HelmEnvSettings *helmcli.EnvSettings
	// AnnotationHolder provides and API to set the OpenShift Version
	AnnotationHolder AnnotationHolder
	// client timeout
	Timeout time.Duration
	// keyring - public gpg for signed chart
	PublicKeys []string
	// helm install timeout
	HelmInstallTimeout time.Duration
	// skip helm cleanup
	SkipCleanup bool
}

CheckOptions contains options collected from the environment a check can consult to modify its behavior.

type DefaultRegistry

type DefaultRegistry map[CheckID]Check

func (*DefaultRegistry) Add

func (r *DefaultRegistry) Add(name apiChecks.CheckName, version string, checkFunc CheckFunc) Registry

func (*DefaultRegistry) AllChecks

func (r *DefaultRegistry) AllChecks() DefaultRegistry

func (*DefaultRegistry) Get

func (r *DefaultRegistry) Get(id CheckID) (Check, bool)

type OpenShiftSemVerErr

type OpenShiftSemVerErr string

func (OpenShiftSemVerErr) Error

func (e OpenShiftSemVerErr) Error() string

type OpenShiftVersionErr

type OpenShiftVersionErr string

func (OpenShiftVersionErr) Error

func (e OpenShiftVersionErr) Error() string

type Registry

type Registry interface {
	Get(id CheckID) (Check, bool)
	Add(name apiChecks.CheckName, version string, checkFunc CheckFunc) Registry
	AllChecks() DefaultRegistry
}

func NewRegistry

func NewRegistry() Registry

type Result

type Result struct {
	// Ok indicates whether the result was successful or not.
	Ok bool
	// Skipped indicates is test was skipped
	Skipped bool
	// Reason for the result value.  This is a message indicating
	// the reason for the value of Ok became true or false.
	Reason string
}

func CanBeInstalledWithoutClusterAdminPrivileges

func CanBeInstalledWithoutClusterAdminPrivileges(opts *CheckOptions) (Result, error)

func CanBeInstalledWithoutManualPreRequisites

func CanBeInstalledWithoutManualPreRequisites(opts *CheckOptions) (Result, error)

func ChartTesting

func ChartTesting(opts *CheckOptions) (Result, error)

ChartTesting partially integrates the chart-testing project in my-chart-verifier.

Unfortunately it wasn't easy as initially expect to integrate chart-testing as a lib in the project, including the main orchestration logic. The ChartTesting function is the interpretation the main logic chart-testing carries, and other functions used in this context were also ported from my-chart-verifier.

func ContainsTest

func ContainsTest(opts *CheckOptions) (Result, error)

func ContainsValues

func ContainsValues(opts *CheckOptions) (Result, error)

func ContainsValuesSchema

func ContainsValuesSchema(opts *CheckOptions) (Result, error)

func HasKubeVersion

func HasKubeVersion(opts *CheckOptions) (Result, error)

func HasKubeVersion_V1_1

func HasKubeVersion_V1_1(opts *CheckOptions) (Result, error)

func HasReadme

func HasReadme(opts *CheckOptions) (Result, error)

func HelmLint

func HelmLint(opts *CheckOptions) (Result, error)

func ImagesAreCertified

func ImagesAreCertified(opts *CheckOptions) (Result, error)

func ImagesAreCertified_V1_1

func ImagesAreCertified_V1_1(opts *CheckOptions) (Result, error)

func IsCommercialChart

func IsCommercialChart(opts *CheckOptions) (Result, error)

func IsCommunityChart

func IsCommunityChart(opts *CheckOptions) (Result, error)

func IsHelmV3

func IsHelmV3(opts *CheckOptions) (Result, error)

func KeywordsAreOpenshiftCategories

func KeywordsAreOpenshiftCategories(opts *CheckOptions) (Result, error)

func NewResult

func NewResult(outcome bool, reason string) Result

func NewSkippedResult

func NewSkippedResult(reason string) Result

func NotContainCRDs

func NotContainCRDs(opts *CheckOptions) (Result, error)

func NotContainCSIObjects

func NotContainCSIObjects(opts *CheckOptions) (Result, error)

func NotContainsInfraPluginsAndDrivers

func NotContainsInfraPluginsAndDrivers(opts *CheckOptions) (Result, error)

func RequiredAnnotationsPresent

func RequiredAnnotationsPresent(opts *CheckOptions) (Result, error)

func SignatureIsValid

func SignatureIsValid(opts *CheckOptions) (Result, error)

func (*Result) AddResult

func (r *Result) AddResult(outcome bool, reason string) Result

func (*Result) SetResult

func (r *Result) SetResult(outcome bool, reason string) Result

func (*Result) SetSkipped

func (r *Result) SetSkipped(reason string) Result

type Versioner

type Versioner func(envSettings *cli.EnvSettings) (string, error)

Versioner provides OpenShift version

Jump to

Keyboard shortcuts

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