Documentation ¶
Index ¶
- Constants
- func AddServiceAccountAuth(ctx context.Context, kubeClient client.Client, sa *corev1.ServiceAccount, ...) error
- func AddServiceAccountToken(ctx context.Context, kubeClient client.Client, sa *corev1.ServiceAccount, ...) error
- func ConvertToRawExtension(from runtime.Object, scheme *runtime.Scheme) (*runtime.RawExtension, error)
- func CoreObjectReferenceFromUnstructuredObject(obj *unstructured.Unstructured) *corev1.ObjectReference
- func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object, ...) (controllerutil.OperationResult, error)
- func CreateSecretForServiceAccount(ctx context.Context, kubeClient client.Client, ...) (*corev1.Secret, error)
- func DecodeObjects(log logging.Logger, name string, data []byte) ([]*unstructured.Unstructured, error)
- func DecodeObjectsToRawExtension(log logging.Logger, name string, data []byte) ([]*runtime.RawExtension, error)
- func DeleteAndWaitForObjectDeleted(ctx context.Context, kubeClient client.Client, timeout time.Duration, ...) error
- func GenerateDeleteObjectConditionFunc(ctx context.Context, kubeClient client.Client, obj client.Object) wait.ConditionWithContextFunc
- func GenerateKubeconfig(restConfig *rest.Config) (clientcmdapi.Config, error)
- func GenerateKubeconfigBytes(restConfig *rest.Config) ([]byte, error)
- func GenerateKubeconfigJSONBytes(restConfig *rest.Config) ([]byte, error)
- func GetMainOwnerFromOwnerReferences(owners []metav1.OwnerReference) *metav1.OwnerReference
- func GetOwner(objMeta metav1.ObjectMeta) *metav1.OwnerReference
- func GetSecretsForServiceAccount(ctx context.Context, kubeClient client.Client, ...) ([]*corev1.Secret, error)
- func GetStatusForContainer(containerStatus []corev1.ContainerStatus, name string) (corev1.ContainerStatus, error)
- func HasAnnotation(obj metav1.Object, ann string) bool
- func HasAnnotationWithValue(obj metav1.Object, ann string, value string) bool
- func HasFinalizer(obj metav1.Object, finalizer string) bool
- func HasLabel(obj metav1.Object, lab string) bool
- func HasLabelWithValue(obj metav1.Object, lab string, value string) bool
- func HasOwnerReference(owned, owner client.Object, scheme *runtime.Scheme) (int, error)
- func InjectTypeInformation(obj runtime.Object, scheme *runtime.Scheme) error
- func Mutate(f controllerutil.MutateFn, key client.ObjectKey, obj client.Object) error
- func ObjectFromCoreObjectReference(ref *corev1.ObjectReference) *unstructured.Unstructured
- func ObjectFromTypedObjectReference(ref *v1alpha1.TypedObjectReference) *unstructured.Unstructured
- func ObjectKey(name, namespace string) types.NamespacedName
- func ObjectKeyFromObject(obj metav1.Object) types.NamespacedName
- func OwnerOfGVK(ownerRefs []metav1.OwnerReference, gvk schema.GroupVersionKind) (string, bool)
- func ParseFiles(log logging.Logger, files map[string]string) ([]*unstructured.Unstructured, error)
- func ParseFilesToRawExtension(log logging.Logger, files map[string]string) ([]*runtime.RawExtension, error)
- func ReconcileRequestFromObject(obj client.Object) reconcile.Request
- func ResolveSecrets(ctx context.Context, client client.Client, ...) ([]corev1.Secret, error)
- func SetMetaDataLabel(obj metav1.Object, lab string, value string)
- func SetRequiredNestedFieldsFromObj(currObj, obj *unstructured.Unstructured) error
- func TypedObjectReferenceFromObject(obj runtime.Object, scheme *runtime.Scheme) (*v1alpha1.TypedObjectReference, error)
- func TypedObjectReferenceFromUnstructuredObject(obj *unstructured.Unstructured) *v1alpha1.TypedObjectReference
- func WaitForServiceAccountToken(ctx context.Context, kubeClient client.Client, secretKey client.ObjectKey) error
Constants ¶
const ErrImageNeverPull = "ErrImageNeverPull"
ErrImageNeverPull - Required Image is absent on host and PullPolicy is NeverPullImage
const ErrImagePull = "ErrImagePull"
ErrImagePull - General image pull error
const ErrImagePullBackOff = "ImagePullBackOff"
ErrImagePullBackOff - Container image pull failed, kubelet is backing off image pull
const ErrInvalidImageName = "ErrInvalidImageName"
ErrInvalidImageName - Unable to parse the image name.
ErrRegistryUnavailable - Get http error when pulling image from registry
Variables ¶
This section is empty.
Functions ¶
func AddServiceAccountAuth ¶
func AddServiceAccountAuth(ctx context.Context, kubeClient client.Client, sa *corev1.ServiceAccount, config *rest.Config) error
AddServiceAccountAuth adds the authentication information of a service account to a rest config. It also waits for the secret with the token to be created.
func AddServiceAccountToken ¶
func AddServiceAccountToken(ctx context.Context, kubeClient client.Client, sa *corev1.ServiceAccount, config *rest.Config) error
AddServiceAccountToken adds the authentication information of a service account to a rest config. It also waits until the token has been created.
func ConvertToRawExtension ¶
func ConvertToRawExtension(from runtime.Object, scheme *runtime.Scheme) (*runtime.RawExtension, error)
ConvertToRawExtension converts a object to a raw extension. The type of the object is automatically set given the scheme.
func CoreObjectReferenceFromUnstructuredObject ¶
func CoreObjectReferenceFromUnstructuredObject(obj *unstructured.Unstructured) *corev1.ObjectReference
CoreObjectReferenceFromUnstructuredObject creates a core object reference from an unstructured object.
func CreateOrUpdate ¶
func CreateOrUpdate(ctx context.Context, c client.Client, obj client.Object, f controllerutil.MutateFn) (controllerutil.OperationResult, error)
CreateOrUpdate creates or updates the given object in the Kubernetes cluster. The object's desired state must be reconciled with the existing state inside the passed in callback MutateFn. It also correctly handles objects that have the generateName attribute set.
The MutateFn is called regardless of creating or updating an object.
It returns the executed operation and an error.
func DecodeObjects ¶
func DecodeObjects(log logging.Logger, name string, data []byte) ([]*unstructured.Unstructured, error)
DecodeObjects decodes raw data that can be a multiyaml file into unstructured kubernetes objects.
func DecodeObjectsToRawExtension ¶
func DecodeObjectsToRawExtension(log logging.Logger, name string, data []byte) ([]*runtime.RawExtension, error)
DecodeObjectsToRawExtension decodes raw data that can be a multiyaml file into unstructured kubernetes objects.
func DeleteAndWaitForObjectDeleted ¶
func DeleteAndWaitForObjectDeleted(ctx context.Context, kubeClient client.Client, timeout time.Duration, obj client.Object) error
DeleteAndWaitForObjectDeleted deletes an object and waits for the object to be deleted.
func GenerateDeleteObjectConditionFunc ¶
func GenerateDeleteObjectConditionFunc(ctx context.Context, kubeClient client.Client, obj client.Object) wait.ConditionWithContextFunc
GenerateDeleteObjectConditionFunc creates a condition function to validate the deletion of objects.
func GenerateKubeconfig ¶
func GenerateKubeconfig(restConfig *rest.Config) (clientcmdapi.Config, error)
GenerateKubeconfig generates a kubernetes kubeconfig config object from a rest config
func GenerateKubeconfigBytes ¶
GenerateKubeconfigBytes generates a kubernetes kubeconfig config object from a rest config and encodes it as yaml.
func GenerateKubeconfigJSONBytes ¶
GenerateKubeconfigJSONBytes generates a kubernetes kubeconfig config object from a rest config and encodes it as json.
func GetMainOwnerFromOwnerReferences ¶
func GetMainOwnerFromOwnerReferences(owners []metav1.OwnerReference) *metav1.OwnerReference
GetMainOwnerFromOwnerReferences returns the main owner from a list of owner references. If the list contains only a single reference, that one is returned. If multiple owners are defined, the controlling owner is returned. If there are multiple references and no controlling one, nil is returned.
func GetOwner ¶
func GetOwner(objMeta metav1.ObjectMeta) *metav1.OwnerReference
GetOwner returns the owner reference of a object. If multiple owners are defined, the controlling owner is returned.
func GetSecretsForServiceAccount ¶
func GetSecretsForServiceAccount(ctx context.Context, kubeClient client.Client, serviceAccountKey client.ObjectKey) ([]*corev1.Secret, error)
GetSecretsForServiceAccount returns the list of secrets of type "kubernetes.io/service-account-token" which belong to the given service account. The result list is sorted decreasingly by creation timestamp, so that it starts with the newest secret.
func GetStatusForContainer ¶
func GetStatusForContainer(containerStatus []corev1.ContainerStatus, name string) (corev1.ContainerStatus, error)
GetStatusForContainer returns the container status for a specific container
func HasAnnotation ¶
HasAnnotation checks if the objects has a annotation
func HasAnnotationWithValue ¶
HasAnnotationWithValue checks if the objects has a annotation with a value
func HasFinalizer ¶
HasFinalizer checks if the object constains a finalizer with the given name.
func HasLabelWithValue ¶
HasLabelWithValue checks if the objects has a label with a value
func HasOwnerReference ¶
HasOwnerReference returns the index of the owner reference if the 'owned' object has a owner reference pointing to the 'owner' object. If not, -1 is returned. Note that name and uid are only compared if set in the owner object. This means that the function will return a positive index for an owner object with empty name and uid if the owned object contains a owner reference which fits just apiversion and kind. The scheme argument may be nil if the owners GVK is populated.
func InjectTypeInformation ¶
InjectTypeInformation injects the group version kind into a runtime object. This is needed as this information gets lost when a struct is decoded.
func ObjectFromCoreObjectReference ¶
func ObjectFromCoreObjectReference(ref *corev1.ObjectReference) *unstructured.Unstructured
ObjectFromCoreObjectReference creates an unstructured object from a core object reference.
func ObjectFromTypedObjectReference ¶
func ObjectFromTypedObjectReference(ref *v1alpha1.TypedObjectReference) *unstructured.Unstructured
ObjectFromTypedObjectReference creates an unstructured object from a typed object reference.
func ObjectKey ¶
func ObjectKey(name, namespace string) types.NamespacedName
ObjectKey creates a namespaced name (client.ObjectKey) for a given name and namespace.
func ObjectKeyFromObject ¶
func ObjectKeyFromObject(obj metav1.Object) types.NamespacedName
ObjectKeyFromObject creates a namespaced name for a given object.
func OwnerOfGVK ¶
func OwnerOfGVK(ownerRefs []metav1.OwnerReference, gvk schema.GroupVersionKind) (string, bool)
OwnerOfGVK validates whether a instance of the given gvk is referenced
func ParseFiles ¶
func ParseFiles(log logging.Logger, files map[string]string) ([]*unstructured.Unstructured, error)
ParseFiles parses a map of filename->data into unstructured yaml objects.
func ParseFilesToRawExtension ¶
func ParseFilesToRawExtension(log logging.Logger, files map[string]string) ([]*runtime.RawExtension, error)
ParseFilesToRawExtension parseslogging.Loggerilename->data into unstructured yaml objects.
func ReconcileRequestFromObject ¶
ReconcileRequestFromObject creates a namespaced name for a given object.
func ResolveSecrets ¶
func ResolveSecrets(ctx context.Context, client client.Client, secretRefs []v1alpha1.ObjectReference) ([]corev1.Secret, error)
ResolveSecrets finds and returns the secrets referenced by secretRefs
func SetMetaDataLabel ¶
SetMetaDataLabel sets the label and value
func SetRequiredNestedFieldsFromObj ¶
func SetRequiredNestedFieldsFromObj(currObj, obj *unstructured.Unstructured) error
SetRequiredNestedFieldsFromObj sets the immutable or the fields that are required when updating un object. e.g: the ClusterIP of a service.
func TypedObjectReferenceFromObject ¶
func TypedObjectReferenceFromObject(obj runtime.Object, scheme *runtime.Scheme) (*v1alpha1.TypedObjectReference, error)
TypedObjectReferenceFromObject creates a typed object reference from a object.
func TypedObjectReferenceFromUnstructuredObject ¶
func TypedObjectReferenceFromUnstructuredObject(obj *unstructured.Unstructured) *v1alpha1.TypedObjectReference
TypedObjectReferenceFromUnstructuredObject creates a typed object reference from an unstructured object.
Types ¶
This section is empty.