apihelpers

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CRDHasFinalizer

func CRDHasFinalizer(crd *apiextensionsv1.CustomResourceDefinition, needle string) bool

CRDHasFinalizer returns true if the finalizer is in the list.

func CRDRemoveFinalizer

func CRDRemoveFinalizer(crd *apiextensionsv1.CustomResourceDefinition, needle string)

CRDRemoveFinalizer removes the finalizer if present.

func FindCRDCondition

FindCRDCondition returns the condition you're looking for or nil.

func GetCRDStorageVersion

func GetCRDStorageVersion(crd *apiextensionsv1.CustomResourceDefinition) (string, error)

GetCRDStorageVersion returns the storage version for given CRD.

func GetSchemaForVersion

GetSchemaForVersion returns the validation schema for the given version or nil.

func GetSubresourcesForVersion

GetSubresourcesForVersion returns the subresources for given version or nil.

func HasPerVersionColumns

func HasPerVersionColumns(versions []apiextensionsv1.CustomResourceDefinitionVersion) bool

HasPerVersionColumns returns true if a CRD uses per-version columns.

func HasPerVersionSchema

func HasPerVersionSchema(versions []apiextensionsv1.CustomResourceDefinitionVersion) bool

HasPerVersionSchema returns true if a CRD uses per-version schema.

func HasPerVersionSubresources

func HasPerVersionSubresources(versions []apiextensionsv1.CustomResourceDefinitionVersion) bool

HasPerVersionSubresources returns true if a CRD uses per-version subresources.

func HasServedCRDVersion

func HasServedCRDVersion(crd *apiextensionsv1.CustomResourceDefinition, version string) bool

HasServedCRDVersion returns true if the given version is in the list of CRD's versions and the Served flag is set.

func HasVersionServed

func HasVersionServed(crd *apiextensionsv1.CustomResourceDefinition, version string) bool

HasVersionServed returns true if given CRD has given version served.

func IsCRDConditionEquivalent

func IsCRDConditionEquivalent(lhs, rhs *apiextensionsv1.CustomResourceDefinitionCondition) bool

IsCRDConditionEquivalent returns true if the lhs and rhs are equivalent except for times.

func IsCRDConditionFalse

IsCRDConditionFalse indicates if the condition is present and false.

func IsCRDConditionPresentAndEqual

IsCRDConditionPresentAndEqual indicates if the condition is present and equal to the given status.

func IsCRDConditionTrue

IsCRDConditionTrue indicates if the condition is present and strictly true.

func IsProtectedCommunityGroup

func IsProtectedCommunityGroup(group string) bool

IsProtectedCommunityGroup returns whether or not a group specified for a CRD is protected for the community and needs to have the v1beta1.KubeAPIApprovalAnnotation set.

func IsStoredVersion

func IsStoredVersion(crd *apiextensionsv1.CustomResourceDefinition, version string) bool

IsStoredVersion returns whether the given version is the storage version of the CRD.

func RemoveCRDCondition

RemoveCRDCondition removes the status condition.

func SetCRDCondition

SetCRDCondition sets the status condition. It either overwrites the existing one or creates a new one.

Types

type APIApprovalState

type APIApprovalState int

APIApprovalState covers the various options for API approval annotation states

const (
	// APIApprovalInvalid means the annotation doesn't have an expected value
	APIApprovalInvalid APIApprovalState = iota
	// APIApproved if the annotation has a URL (this means the API is approved)
	APIApproved
	// APIApprovalBypassed if the annotation starts with "unapproved" indicating that for whatever reason the API isn't approved, but we should allow its creation
	APIApprovalBypassed
	// APIApprovalMissing means the annotation is empty
	APIApprovalMissing
)

func GetAPIApprovalState

func GetAPIApprovalState(annotations map[string]string) (state APIApprovalState, reason string)

GetAPIApprovalState returns the state of the API approval and reason for that state

Jump to

Keyboard shortcuts

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