Documentation ¶
Index ¶
- Constants
- func Convertv1beta1Tov1CustomResourceDefinition(in *apiextv1beta1.CustomResourceDefinition) (*apiextv1.CustomResourceDefinition, error)
- func DefinitionsForV1CustomResourceDefinitions(crds ...apiextv1.CustomResourceDefinition) (keys []registry.DefinitionKey)
- func DefinitionsForV1beta1CustomResourceDefinitions(crds ...apiextv1beta1.CustomResourceDefinition) (keys []registry.DefinitionKey)
- func FormatOperatorNameDNS1123(name string) string
- func GVKsForV1CustomResourceDefinitions(crds ...apiextv1.CustomResourceDefinition) (gvks []schema.GroupVersionKind)
- func GVKsForV1beta1CustomResourceDefinitions(crds ...apiextv1beta1.CustomResourceDefinition) (gvks []schema.GroupVersionKind)
- func GetCustomResourceDefinitions(crdsDir string) (v1crds []apiextv1.CustomResourceDefinition, ...)
- func GetDisplayName(name string) string
- func GetObjectBytes(obj interface{}, m MarshalFunc) ([]byte, error)
- func GetTypeMetaFromBytes(b []byte) (t metav1.TypeMeta, err error)
- func SupportsOwnerReference(restMapper meta.RESTMapper, owner, dependent runtime.Object, ...) (bool, error)
- func TrimDNS1123Label(label string) string
- type CRDVersions
- type MarshalFunc
- type Scanner
Constants ¶
const ( // KubeConfigEnvVar defines the env variable KUBECONFIG which // contains the kubeconfig file path. KubeConfigEnvVar = "KUBECONFIG" // WatchNamespaceEnvVar is the constant for env variable WATCH_NAMESPACE // which is the namespace where the watch activity happens. // this value is empty if the operator is running with clusterScope. WatchNamespaceEnvVar = "WATCH_NAMESPACE" )
Variables ¶
This section is empty.
Functions ¶
func Convertv1beta1Tov1CustomResourceDefinition ¶
func Convertv1beta1Tov1CustomResourceDefinition(in *apiextv1beta1.CustomResourceDefinition) (*apiextv1.CustomResourceDefinition, error)
func DefinitionsForV1CustomResourceDefinitions ¶
func DefinitionsForV1CustomResourceDefinitions(crds ...apiextv1.CustomResourceDefinition) (keys []registry.DefinitionKey)
DefinitionsForV1CustomResourceDefinitions returns definition keys for all custom resource versions in each crd in crds.
func DefinitionsForV1beta1CustomResourceDefinitions ¶
func DefinitionsForV1beta1CustomResourceDefinitions(crds ...apiextv1beta1.CustomResourceDefinition) (keys []registry.DefinitionKey)
DefinitionsForV1beta1CustomResourceDefinitions returns definition keys for all custom resource versions in each crd in crds.
func FormatOperatorNameDNS1123 ¶
FormatOperatorNameDNS1123 ensures name is DNS1123 label-compliant by replacing all non-compliant UTF-8 characters with "-".
func GVKsForV1CustomResourceDefinitions ¶
func GVKsForV1CustomResourceDefinitions(crds ...apiextv1.CustomResourceDefinition) (gvks []schema.GroupVersionKind)
GVKsForV1CustomResourceDefinitions returns GroupVersionKind's for all custom resource versions in each crd in crds.
func GVKsForV1beta1CustomResourceDefinitions ¶
func GVKsForV1beta1CustomResourceDefinitions(crds ...apiextv1beta1.CustomResourceDefinition) (gvks []schema.GroupVersionKind)
GVKsForV1beta1CustomResourceDefinitions returns GroupVersionKind's for all custom resource versions in each crd in crds.
func GetCustomResourceDefinitions ¶
func GetCustomResourceDefinitions(crdsDir string) ( v1crds []apiextv1.CustomResourceDefinition, v1beta1crds []apiextv1beta1.CustomResourceDefinition, err error)
GetCustomResourceDefinitions returns all CRD manifests of both v1 and v1beta1 versions in the directory crdsDir. If a duplicate object with different API versions is found, and error is returned.
func GetDisplayName ¶
GetDisplayName turns a project dir name in any of {snake, chain, camel} cases, hierarchical dot structure, or space-delimited into a space-delimited, title'd display name. Ex. "another-_AppOperator_againTwiceThrice More" -> "Another App Operator Again Twice Thrice More"
func GetObjectBytes ¶
func GetObjectBytes(obj interface{}, m MarshalFunc) ([]byte, error)
GetObjectBytes marshalls an object with m and removes runtime-managed fields: 'status', 'creationTimestamp'
func GetTypeMetaFromBytes ¶
GetTypeMetaFromBytes gets the type and object metadata from b. b is assumed to be a single Kubernetes resource manifest.
func SupportsOwnerReference ¶
func SupportsOwnerReference(restMapper meta.RESTMapper, owner, dependent runtime.Object, depNamespace string) (bool, error)
SupportsOwnerReference checks whether a given dependent supports owner references, based on the owner. This function performs following checks:
-- True: Owner is cluster-scoped. -- True: Both Owner and dependent are Namespaced with in same namespace. -- False: Owner is Namespaced and dependent is Cluster-scoped. -- False: Both Owner and dependent are Namespaced with different namespaces.
func TrimDNS1123Label ¶
TrimDNS1123Label trims a label to meet the DNS 1123 label length requirement by removing characters from the beginning of label such that len(label) <= 63.
Types ¶
type CRDVersions ¶
type CRDVersions []apiextv1beta1.CustomResourceDefinitionVersion
func (CRDVersions) Len ¶
func (vs CRDVersions) Len() int
func (CRDVersions) Less ¶
func (vs CRDVersions) Less(i, j int) bool
func (CRDVersions) Swap ¶
func (vs CRDVersions) Swap(i, j int)
type MarshalFunc ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner scans a yaml manifest file for manifest tokens delimited by "---". See bufio.Scanner for semantics.