internal

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PodDisruptionBudgetKind     = "PodDisruptionBudget"
	PriorityClassKind           = "PriorityClass"
	RoleKind                    = "Role"
	ClusterRoleKind             = "ClusterRole"
	PodDisruptionBudgetAPIGroup = "policy"
	SCCAPIGroup                 = "security.openshift.io"
)
View Source
const DeprecateMessage = "this bundle is using APIs which were deprecated and removed in v%v.%v. " +
	"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v%v-%v. " +
	"Migrate the API(s) for %s"

DeprecateMessage defines the content of the message that will be raised as an error or warning when the removed apis are found

View Source
const IndexImagePathKey = "index-path"

IndexImagePathKey defines the key which can be used by its consumers to inform where their index image path is to be checked

Variables

View Source
var AlphaDeprecatedAPIsValidator interfaces.Validator = interfaces.ValidatorFunc(validateDeprecatedAPIsValidator)

AlphaDeprecatedAPIsValidator implements Validator to validate bundle objects for API deprecation requirements.

Note that this validator looks at the manifests. If any removed APIs for the mapped k8s versions are found, it raises a warning.

This validator only raises an error when the deprecated API found is removed in the specified k8s version informed via the optional key `k8s-version`.

The K8s versions supported and checks are:

- 1.22 : https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22

- 1.25 : https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25

- 1.26 : https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-26

IMPORTANT: Note that in the case scenarios of 1.25 and 1.26 it is very unlikely the OperatorAuthors add manifests on the bundle using these APIs. On top of that some Kinds such as the CronJob are not currently a valid/supported by OLM and never would to be added to bundle. See: https://github.com/operator-framework/operator-registry/blob/v1.19.5/pkg/lib/bundle/supported_resources.go#L3-L23

View Source
var BundleValidator interfaces.Validator = interfaces.ValidatorFunc(validateBundles)
View Source
var CRDValidator interfaces.Validator = interfaces.ValidatorFunc(validateCRDs)
View Source
var CSVValidator interfaces.Validator = interfaces.ValidatorFunc(validateCSVs)

CaseSensitiveAnnotationKeySet is a set of annotation keys that are case sensitive and can be used for validation purposes. The key is always lowercase and the value contains the expected case sensitive string. This may not be an exhaustive list.

View Source
var CommunityOperatorValidator interfaces.Validator = interfaces.ValidatorFunc(communityValidator)

CommunityOperatorValidator validates the bundle manifests against the required criteria to publish the projects on the community operators

Note that this validator allows to receive a List of optional values as key=values. Currently, only the `index-path` key is allowed. If informed, it will check the labels on the image index according to its criteria.

Deprecated - The checks made for this validator were moved to the external one: https://github.com/redhat-openshift-ecosystem/ocp-olm-catalog-validator

Please no longer use this check it will be removed in the next releases.

View Source
var GoodPracticesValidator interfaces.Validator = interfaces.ValidatorFunc(goodPracticesValidator)

GoodPracticesValidator validates the bundle against criteria and suggestions defined as good practices for bundles under the operator-framework solutions. (You might give a look at https://sdk.operatorframework.io/docs/best-practices/)

This validator will raise an WARNING when:

- The resources request for CPU and/or Memory are not defined for any of the containers found in the CSV

View Source
var K8sVersionsSupportedByValidator = []string{"1.22.0", "1.25.0", "1.26.0"}

K8sVersionsSupportedByValidator defines the k8s versions which this validator is implemented to perform the checks

View Source
var ObjectValidator interfaces.Validator = interfaces.ValidatorFunc(validateObjects)
View Source
var OperatorGroupValidator interfaces.Validator = interfaces.ValidatorFunc(validateOperatorGroups)

OperatorGroupValidator is a validator for OperatorGroup

View Source
var OperatorHubValidator interfaces.Validator = interfaces.ValidatorFunc(validateOperatorHub)

OperatorHubValidator validates the bundle manifests against the required criteria to publish the projects on OperatorHub.io.

This validator will ensure that:

- The annotations capabilities into the CSV has a valid option, which are:

* Basic Install

* Seamless Upgrades

* Full Lifecycle

* Deep Insights

* Auto Pilot

- The annotations categories into the CSV has a valid option, which are:

* AI/Machine Learning

* Application Runtime

* Big Data

* Cloud Provider

* Developer Tools

* Database

* Integration & Delivery

* Logging & Tracing

* Modernization & Migration

* Monitoring

* Networking

* OpenShift Optional

* Security

* Storage

* Streaming & Messaging

NOTE: The OperatorHub validator can verify against custom bundle categories by setting the OPERATOR_BUNDLE_CATEGORIES environment variable. Setting the OPERATOR_BUNDLE_CATEGORIES environment variable to the path to a json file containing a list of categories will enable those categories to be used when comparing CSV categories for OperatorHub validation. The json file should be in the following format:

	```json
	{
		"categories":[
     "Cloud Pak",
     "Registry",
     "MyCoolThing",
 	 ]
	}
	```

- The `csv.Spec.Provider.Name` was provided

- The `csv.Spec.Maintainers` elements contains both name and email

- The `csv.Spec.Links` elements contains both name and url

- The `csv.Spec.Links.Url` is a valid value

- The `csv.Spec.Version` is provided

- The `csv.Spec.Icon` was provided and has not more than one element

- The `csv.Spec.Icon` elements should contain both data and `mediatype`

- The `csv.Spec.Icon` elements should contain both data and `mediatype`

- The `csv.Spec.Icon` has a valid `mediatype`, which are

* image/gif

* image/jpeg

* image/png

* image/svg+xml

- If informed ONLY, check if the value csv.Spec.MinKubeVersion is parsable according to semver (https://semver.org/) Also, this validator will raise warnings when:

- The bundle name (CSV.metadata.name) does not follow the naming convention: <operator-name>.v<semver> e.g. memcached-operator.v0.0.1

NOTE: The bundle name must be 63 characters or less because it will be used as k8s ownerref label which only allows max of 63 characters.

- The channel names seems are not following the convention https://olm.operatorframework.io/docs/best-practices/channel-naming/

- The usage of the removed APIs on Kubernetes 1.22 is found. More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22

Note that this validator allows to receive a List of optional values as key=values. Currently, only the `k8s-version` key is allowed. If informed, it will perform the checks against this specific Kubernetes version where the operator bundle is intend to be used and will raise errors instead of warnings. Currently, this check is capable of verifying the removed APIs only for Kubernetes 1.22 version.

View Source
var PackageManifestValidator interfaces.Validator = interfaces.ValidatorFunc(validatePackageManifests)

Functions

func ValidateAnnotationNames added in v0.6.1

func ValidateAnnotationNames(annotations map[string]string, value interface{}) (errs []errors.Error)

ValidateAnnotationNames will check annotation keys to ensure they are using proper case. Uses CaseSensitiveAnnotationKeySet as a source for keys which are known to be case sensitive. It also checks to see if the olm.properties annotation is defined in order to add a warning if present. This function can be used anywhere annotations need to be checked for case sensitivity.

Arguments

• annotations: annotations map usually obtained from ObjectMeta.GetAnnotations()

• value: is the field or file that caused an error or warning

Returns

• errs: Any errors that may have been detected with the annotation keys provided

Types

type CSVChecks added in v0.8.0

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

type CommunityOperatorChecks added in v0.9.0

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

Jump to

Keyboard shortcuts

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