{"modulePath":"github.com/operator-framework/api","version":"v0.47.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package internal\n\n## Constants\n\n```go\nconst (\n\tPodDisruptionBudgetKind     = \"PodDisruptionBudget\"\n\tPriorityClassKind           = \"PriorityClass\"\n\tRoleKind                    = \"Role\"\n\tClusterRoleKind             = \"ClusterRole\"\n\tPodDisruptionBudgetAPIGroup = \"policy\"\n\tSCCAPIGroup                 = \"security.openshift.io\"\n)\n```\n\n```go\nconst ContainerToolsKey = \"container-tools\"\n```\nContainerToolsKey defines the key which can be used by its consumers to inform where to find the container tool that should be used to inspect the image\n\n```go\nconst DeprecateMessage = \"this bundle is using APIs which were deprecated and removed in v%v.%v. \" +\n\t\"More info: https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v%v-%v. \" +\n\t\"Migrate the API(s) for %s\"\n```\nDeprecateMessage defines the content of the message that will be raised as an error or warning when the removed apis are found\n\n```go\nconst IndexImagePathKey = \"index-path\"\n```\nIndexImagePathKey defines the key which can be used by its consumers to inform where their index image path is to be checked\n\n## Variables\n\n```go\nvar AlphaDeprecatedAPIsValidator interfaces.Validator = interfaces.ValidatorFunc(validateDeprecatedAPIsValidator)\n```\nAlphaDeprecatedAPIsValidator implements Validator to validate bundle objects for API deprecation requirements.\n\nNote that this validator looks at the manifests. If any removed APIs for the mapped k8s versions are found, it raises a warning.\n\nThis validator only raises an error when the deprecated API found is removed in the specified k8s version informed via the optional key \\`k8s-version\\`.\n\nThe K8s versions supported and checks are:\n\n\\- 1.22 : [https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22)\n\n\\- 1.25 : [https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-25)\n\n\\- 1.26 : [https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-26](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-26)\n\nIMPORTANT: 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](https://github.com/operator-framework/operator-registry/blob/v1.19.5/pkg/lib/bundle/supported_resources.go#L3-L23)\n\n```go\nvar BundleValidator interfaces.Validator = interfaces.ValidatorFunc(validateBundles)\n```\n\n```go\nvar CRDValidator interfaces.Validator = interfaces.ValidatorFunc(validateCRDs)\n```\n\n```go\nvar CSVValidator interfaces.Validator = interfaces.ValidatorFunc(validateCSVs)\n```\n\n```go\nvar CaseSensitiveAnnotationKeySet = map[string]string{\n\n\tstrings.ToLower(v1.OperatorGroupAnnotationKey):             v1.OperatorGroupAnnotationKey,\n\tstrings.ToLower(v1.OperatorGroupNamespaceAnnotationKey):    v1.OperatorGroupNamespaceAnnotationKey,\n\tstrings.ToLower(v1.OperatorGroupTargetsAnnotationKey):      v1.OperatorGroupTargetsAnnotationKey,\n\tstrings.ToLower(v1.OperatorGroupProvidedAPIsAnnotationKey): v1.OperatorGroupProvidedAPIsAnnotationKey,\n\tstrings.ToLower(v1alpha1.SkipRangeAnnotationKey):           v1alpha1.SkipRangeAnnotationKey,\n}\n```\nCaseSensitiveAnnotationKeySet 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.\n\n```go\nvar CommunityOperatorValidator interfaces.Validator = interfaces.ValidatorFunc(communityValidator)\n```\nCommunityOperatorValidator validates the bundle manifests against the required criteria to publish the projects on the community operators\n\nNote 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.\n\nDeprecated - The checks made for this validator were moved to the external one: [https://github.com/redhat-openshift-ecosystem/ocp-olm-catalog-validator](https://github.com/redhat-openshift-ecosystem/ocp-olm-catalog-validator)\n\nPlease no longer use this check it will be removed in the next releases.\n\n```go\nvar GoodPracticesValidator interfaces.Validator = interfaces.ValidatorFunc(goodPracticesValidator)\n```\nGoodPracticesValidator 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/](https://sdk.operatorframework.io/docs/best-practices/))\n\nThis validator will raise an WARNING when:\n\n\\- The resources request for CPU and/or Memory are not defined for any of the containers found in the CSV\n\n\\- The channel names seems are not following the convention [https://olm.operatorframework.io/docs/best-practices/channel-naming/](https://olm.operatorframework.io/docs/best-practices/channel-naming/)\n\n\\- CRDs defined in the bundle have empty descriptions\n\n\\- Check if the CSV has permissions to create CRDs. Note that: a) \"Operators should own a CRD and only one Operator should control a CRD on a cluster. Two Operators managing the same CRD is not a recommended best practice. In the case where an API exists but with multiple implementations, this is typically an example of a no-op Operator because it doesn't have any deployment or reconciliation loop to define the shared API and other Operators depend on this Operator to provide one implementation of the API, e.g. similar to PVCs or Ingress.\"\n\nb) \"An Operator shouldn't deploy or manage other operators (such patterns are known as meta or super operators or include CRDs in its Operands). It's the Operator Lifecycle Manager's job to manage the deployment and lifecycle of operators. For further information check Dependency Resolution: [https://olm.operatorframework.io/docs/concepts/olm-architecture/dependency-resolution/](https://olm.operatorframework.io/docs/concepts/olm-architecture/dependency-resolution/)\"\n\nWARNING: if you create CRD's via the reconciliations or via the Operands then, OLM cannot handle CRDs migration and update, validation. - The bundle name (CSV.metadata.name) does not follow the naming convention: \\\u003coperator-name\u003e.v\\\u003csemver\u003e e.g. memcached-operator.v0.0.1\n\nNOTE: 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.\n\n```go\nvar K8sVersionsSupportedByValidator = []string{\"1.22.0\", \"1.25.0\", \"1.26.0\"}\n```\nK8sVersionsSupportedByValidator defines the k8s versions which this validator is implemented to perform the checks\n\n```go\nvar MultipleArchitecturesValidator interfaces.Validator = interfaces.ValidatorFunc(multipleArchitecturesValidate)\n```\nMultipleArchitecturesValidator validates the bundle against criteria to support Multiple Architectures. For further information check: [https://olm.operatorframework.io/docs/advanced-tasks/ship-operator-supporting-multiarch/](https://olm.operatorframework.io/docs/advanced-tasks/ship-operator-supporting-multiarch/)\n\nThis validator will inspect the images with the chosen container-tool. One of: \\[docker, podman, none] (By default docker) and then: (It is only used to $container-tool manifest inspect)\n\n\\- raise a error(s) when is possible to confirm that images do not provide the support defined via to the labels in the CSV\n\n\\- raise a warning when it is possible to check that the Operator manager image(s) supports architecture(s) not defined via labels. Therefore, it shows like the labels are missing.\n\n\\- raise warnings when it is possible to verify that the images defined in the CSV do not provide the same architecture(s) supported by the Operator manager image(s) or defined via the labels\n\n\\### What is checked?\n\nOn this check, we aggregate the platform architecture(s) and OS(s) provided via the labels and those which are found by checking the images so that, we can check:\n\n\\- If your CSV is missing labels\n\n\\- If your Operator bundle specifies images which do not support all architectures found for your Operator image(s) (probably supported by your project)\n\n\\- If your deployment spec follows the best practice of setting nodeAffinity to ensure image(s) are only scheduled on compatible platform nodes.\n\nNote: To better guess the case scenarios where authors might have missed the labels, the following check will verify all architectures supported by the Operator image(s). However, by looking at the CSV we are not able to ensure what is the Operator image because this info is not provided. Therefore, we know by SDK the Operator image container will be called manager.\n\n\\### How the Operator image(s) are identified?\n\nThe container named as manager under the CSV Deployment InstallStrategy (\\`Spec.InstallStrategy.StrategySpec.DeploymentSpecs\\`) And if the above not found, all images under the InstallStrategy excluding the container named as \\`kube-rbac-proxy\\` since it is also scaffolded by default via SDK\n\n```go\nvar ObjectValidator interfaces.Validator = interfaces.ValidatorFunc(validateObjects)\n```\n\n```go\nvar OperatorGroupValidator interfaces.Validator = interfaces.ValidatorFunc(validateOperatorGroups)\n```\nOperatorGroupValidator is a validator for OperatorGroup\n\n```go\nvar OperatorHubV2Validator interfaces.Validator = interfaces.ValidatorFunc(validateOperatorHubV2)\n```\n\n```go\nvar OperatorHubValidator interfaces.Validator = interfaces.ValidatorFunc(validateOperatorHubDeprecated)\n```\nOperatorHubValidator validates the bundle manifests against the required criteria to publish the projects on OperatorHub.io.\n\nThis validator will ensure that:\n\n\\- The annotations capabilities into the CSV has a valid option, which are:\n\n\\* Basic Install\n\n\\* Seamless Upgrades\n\n\\* Full Lifecycle\n\n\\* Deep Insights\n\n\\* Auto Pilot\n\n\\- The annotations categories into the CSV has a valid option, which are:\n\n\\* AI/Machine Learning\n\n\\* Application Runtime\n\n\\* Big Data\n\n\\* Cloud Provider\n\n\\* Developer Tools\n\n\\* Database\n\n\\* Integration \u0026 Delivery\n\n\\* Logging \u0026 Tracing\n\n\\* Modernization \u0026 Migration\n\n\\* Monitoring\n\n\\* Networking\n\n\\* OpenShift Optional\n\n\\* Security\n\n\\* Storage\n\n\\* Streaming \u0026 Messaging\n\nNOTE: 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:\n\n\t\t```json\n\t\t{\n\t\t\t\"categories\":[\n\t     \"Cloud Pak\",\n\t     \"Registry\",\n\t     \"MyCoolThing\",\n\t \t ]\n\t\t}\n\t\t```\n\n\\- The \\`csv.Spec.Provider.Name\\` was provided\n\n\\- The \\`csv.Spec.Maintainers\\` elements contains both name and email\n\n\\- The \\`csv.Spec.Links\\` elements contains both name and url\n\n\\- The \\`csv.Spec.Links.Url\\` is a valid value\n\n\\- The \\`csv.Spec.Version\\` is provided\n\n\\- The \\`csv.Spec.Icon\\` was provided and has not more than one element\n\n\\- The \\`csv.Spec.Icon\\` elements should contain both data and \\`mediatype\\`\n\n\\- The \\`csv.Spec.Icon\\` elements should contain both data and \\`mediatype\\`\n\n\\- The \\`csv.Spec.Icon\\` has a valid \\`mediatype\\`, which are\n\n\\* image/gif\n\n\\* image/jpeg\n\n\\* image/png\n\n\\* image/svg+xml\n\n\\- If informed ONLY, check if the value csv.Spec.MinKubeVersion is parsable according to semver ([https://semver.org/](https://semver.org/)) Also, this validator will raise warnings when:\n\n\\- The channel names seems are not following the convention [https://olm.operatorframework.io/docs/best-practices/channel-naming/](https://olm.operatorframework.io/docs/best-practices/channel-naming/)\n\n\\- 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](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22)\n\nNote 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.\n\nDeprecated: Use OperatorHubV2Validator, StandardCapabilitiesValidator and StandardCategoriesValidator for equivalent validation.\n\n```go\nvar PackageManifestValidator interfaces.Validator = interfaces.ValidatorFunc(validatePackageManifests)\n```\n\n```go\nvar StandardCapabilitiesValidator interfaces.Validator = interfaces.ValidatorFunc(validateCapabilities)\n```\n\n```go\nvar StandardCategoriesValidator interfaces.Validator = interfaces.ValidatorFunc(validateCategories)\n```\n\n## Functions\n\n```go\nfunc ValidateAnnotationNames(annotations map[string]string, value interface{}) (errs []errors.Error)\n```\nValidateAnnotationNames 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.\n\n### Arguments {#hdr-Arguments}\n\n• annotations: annotations map usually obtained from ObjectMeta.GetAnnotations()\n\n• value: is the field or file that caused an error or warning\n\n### Returns {#hdr-Returns}\n\n• errs: Any errors that may have been detected with the annotation keys provided\n\n## Types\n\n```go\ntype CSVChecks struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\ntype CommunityOperatorChecks struct {\n\t// contains filtered or unexported fields\n}\n```\n\n","path":"github.com/operator-framework/api/pkg/validation/internal","name":"internal","synopsis":"","isRedistributable":true}
