resource

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: UPL-1.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupResources added in v1.7.0

func CleanupResources(ctx spi.ComponentContext, objects []client.Object) error

CleanupResources deletes and removes finalizers from resources

func CreateOrUpdateResourceFromBytes added in v1.5.0

func CreateOrUpdateResourceFromBytes(data []byte, log *zap.SugaredLogger) error

CreateOrUpdateResourceFromBytes creates or updates a Kubernetes resources from a YAML data byte array. The cluster used is the one set by default in the environment

func CreateOrUpdateResourceFromBytesUsingConfig added in v1.5.0

func CreateOrUpdateResourceFromBytesUsingConfig(data []byte, config *rest.Config) error

CreateOrUpdateResourceFromBytesUsingConfig creates or updates a Kubernetes resource from bytes. This is intended to be equivalent to `kubectl apply`

func CreateOrUpdateResourceFromFile added in v1.5.0

func CreateOrUpdateResourceFromFile(file string, log *zap.SugaredLogger) error

CreateOrUpdateResourceFromFile creates or updates a Kubernetes resources from a YAML file. This is intended to be equivalent to `kubectl apply` The cluster used is the one set by default in the environment

func CreateOrUpdateResourceFromFileInCluster added in v1.5.0

func CreateOrUpdateResourceFromFileInCluster(file string, kubeconfigPath string) error

CreateOrUpdateResourceFromFileInCluster is identical to CreateOrUpdateResourceFromFile, except that it uses the cluster specified by the kubeconfigPath argument instead of the default cluster in the environment

func CreateOrUpdateResourceFromFileInClusterInGeneratedNamespace added in v1.5.0

func CreateOrUpdateResourceFromFileInClusterInGeneratedNamespace(file string, kubeconfigPath string, namespace string) error

CreateOrUpdateResourceFromFileInClusterInGeneratedNamespace is identical to CreateOrUpdateResourceFromFileInGeneratedNamespace, except that it uses the cluster specified by the kubeconfigPath argument instead of the default cluster in the environment

func CreateOrUpdateResourceFromFileInGeneratedNamespace added in v1.5.0

func CreateOrUpdateResourceFromFileInGeneratedNamespace(file string, namespace string) error

CreateOrUpdateResourceFromFileInGeneratedNamespace creates or updates a Kubernetes resources from a YAML file. Namespaces are not in the resource yaml files. They are generated and passed in Resources will be created in the namespace that is passed in This is intended to be equivalent to `kubectl apply` The cluster used is the one set by default in the environment

func DeleteResourceFromFile added in v1.5.0

func DeleteResourceFromFile(file string, log *zap.SugaredLogger) error

DeleteResourceFromFile deletes Kubernetes resources using names found in a YAML file. This is intended to be equivalent to `kubectl delete`

func DeleteResourceFromFileInCluster added in v1.5.0

func DeleteResourceFromFileInCluster(file string, kubeconfigPath string) error

DeleteResourceFromFileInCluster is identical to DeleteResourceFromFile, except that // it uses the cluster specified by the kubeconfigPath argument instead of the default cluster in the environment

func DeleteResourceFromFileInClusterInGeneratedNamespace added in v1.5.0

func DeleteResourceFromFileInClusterInGeneratedNamespace(file string, kubeconfigPath string, namespace string) error

DeleteResourceFromFileInClusterInGeneratedNamespace is identical to DeleteResourceFromFileInGeneratedNamespace, except that it uses the cluster specified by the kubeconfigPath argument instead of the default cluster in the environment

func DeleteResourceFromFileInGeneratedNamespace added in v1.5.0

func DeleteResourceFromFileInGeneratedNamespace(file string, namespace string) error

DeleteResourceFromFileInGeneratedNamespace deletes Kubernetes resources using names found in a YAML file. The namespace is generated and passed in

func PatchResourceFromBytes added in v1.5.0

func PatchResourceFromBytes(gvr schema.GroupVersionResource, patchType types.PatchType, namespace string, name string, patchDataJSON []byte, config *rest.Config) error

PatchResourceFromBytes patches a Kubernetes resource from bytes. The contents of the byte slice must be in JSON format. This is intended to be equivalent to `kubectl patch`.

func PatchResourceFromFileInCluster added in v1.5.0

func PatchResourceFromFileInCluster(gvr schema.GroupVersionResource, namespace string, name string, patchFile string, kubeconfigPath string) error

PatchResourceFromFileInCluster patches a Kubernetes resource from a given patch file in the specified cluster If the given patch file has a ".yaml" extension, the contents will be converted to JSON This is intended to be equivalent to `kubectl patch`

func VerifyResourcesDeleted added in v1.7.0

func VerifyResourcesDeleted(ctx spi.ComponentContext, objects []client.Object) error

VerifyResourcesDeleted verifies resources have been fully cleaned up

Types

type Resource

type Resource struct {
	Namespace string
	Name      string
	Client    client.Client
	Object    client.Object
	Log       vzlog.VerrazzanoLogger
}

func (Resource) Delete

func (r Resource) Delete() error

Delete deletes a resource if it exists, not found error is ignored

func (Resource) Exists added in v1.6.0

func (r Resource) Exists() (bool, error)

Exists returns true if the Resource exists

func (Resource) RemoveFinalizers

func (r Resource) RemoveFinalizers() error

RemoveFinalizers removes all finalizers from a resource

func (Resource) RemoveFinalizersAndDelete

func (r Resource) RemoveFinalizersAndDelete() error

RemoveFinializersAndDelete removes all finalizers from a resource and deletes the resource

Jump to

Keyboard shortcuts

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