type Client interface { // ListClusterResourcesToDelete lists Kubernetes resources from cluster in namespace for a given odo component. // The mode indicates which component to list, either Dev, Deploy or Any (using constant labels.Component*Mode). ListClusterResourcesToDelete(ctx context.Context, componentName string, namespace string, mode string) ([]unstructured.Unstructured, error) // DeleteResources deletes the unstructured resources and return the resources that failed to be deleted // set wait to true to wait for all the dependencies to be deleted DeleteResources(resources []unstructured.Unstructured, wait bool) []unstructured.Unstructured // ExecutePreStopEvents executes preStop events if any, as a precondition to deleting a devfile component deployment ExecutePreStopEvents(ctx context.Context, devfileObj parser.DevfileObj, appName string, componentName string) error // ListClusterResourcesToDeleteFromDevfile parses all the devfile components and returns a list of resources that are present on the cluster that can be deleted, // and a bool that indicates if the devfile component has been pushed to the innerloop. // The mode indicates which component to list, either Dev, Deploy or Any (using constant labels.Component*Mode). ListClusterResourcesToDeleteFromDevfile(devfileObj parser.DevfileObj, appName string, componentName string, mode string) (bool, []unstructured.Unstructured, error) // ListPodmanResourcesToDelete returns a list of resources that are present on podman in Dev mode that can be deleted for the given component/app, // and a bool that indicates if the devfile component has been pushed to the innerloop. // The mode indicates which component to list, either Dev, Deploy or Any (using constant labels.Component*Mode). ListPodmanResourcesToDelete(appName string, componentName string, mode string) (isInnerLoopDeployed bool, pods []*corev1.Pod, err error) }
type DeleteComponentClient struct {
// contains filtered or unexported fields
}
func NewDeleteComponentClient( kubeClient kclient.ClientInterface, podmanClient podman.Client, execClient exec.Client, configAutomountClient configAutomount.Client, ) *DeleteComponentClient
func (do *DeleteComponentClient) DeleteResources(resources []unstructured.Unstructured, wait bool) []unstructured.Unstructured
func (do *DeleteComponentClient) ExecutePreStopEvents(ctx context.Context, devfileObj parser.DevfileObj, appName string, componentName string) error
ExecutePreStopEvents executes preStop events if any, as a precondition to deleting a devfile component deployment
func (do *DeleteComponentClient) ListClusterResourcesToDelete( ctx context.Context, componentName string, namespace string, mode string, ) ([]unstructured.Unstructured, error)
ListClusterResourcesToDelete lists Kubernetes resources from cluster in namespace for a given odo component It only returns resources not owned by another resource of the component, letting the garbage collector do its job
func (do DeleteComponentClient) ListClusterResourcesToDeleteFromDevfile(devfileObj parser.DevfileObj, appName string, componentName string, mode string) (isInnerLoopDeployed bool, resources []unstructured.Unstructured, err error)
ListResourcesToDeleteFromDevfile parses all the devfile components and returns a list of resources that are present on the cluster and can be deleted Returns a Warning if an error happens communicating with the cluster
func (do *DeleteComponentClient) ListPodmanResourcesToDelete(appName string, componentName string, mode string) (isInnerLoopDeployed bool, pods []*corev1.Pod, err error)
MockClient is a mock of Client interface.
type MockClient struct {
// contains filtered or unexported fields
}
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (m *MockClient) DeleteResources(resources []unstructured.Unstructured, wait bool) []unstructured.Unstructured
DeleteResources mocks base method.
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockClient) ExecutePreStopEvents(ctx context.Context, devfileObj parser.DevfileObj, appName, componentName string) error
ExecutePreStopEvents mocks base method.
func (m *MockClient) ListClusterResourcesToDelete(ctx context.Context, componentName, namespace, mode string) ([]unstructured.Unstructured, error)
ListClusterResourcesToDelete mocks base method.
func (m *MockClient) ListClusterResourcesToDeleteFromDevfile(devfileObj parser.DevfileObj, appName, componentName, mode string) (bool, []unstructured.Unstructured, error)
ListClusterResourcesToDeleteFromDevfile mocks base method.
func (m *MockClient) ListPodmanResourcesToDelete(appName, componentName, mode string) (bool, []*v1.Pod, error)
ListPodmanResourcesToDelete mocks base method.
MockClientMockRecorder is the mock recorder for MockClient.
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
func (mr *MockClientMockRecorder) DeleteResources(resources, wait interface{}) *gomock.Call
DeleteResources indicates an expected call of DeleteResources.
func (mr *MockClientMockRecorder) ExecutePreStopEvents(ctx, devfileObj, appName, componentName interface{}) *gomock.Call
ExecutePreStopEvents indicates an expected call of ExecutePreStopEvents.
func (mr *MockClientMockRecorder) ListClusterResourcesToDelete(ctx, componentName, namespace, mode interface{}) *gomock.Call
ListClusterResourcesToDelete indicates an expected call of ListClusterResourcesToDelete.
func (mr *MockClientMockRecorder) ListClusterResourcesToDeleteFromDevfile(devfileObj, appName, componentName, mode interface{}) *gomock.Call
ListClusterResourcesToDeleteFromDevfile indicates an expected call of ListClusterResourcesToDeleteFromDevfile.
func (mr *MockClientMockRecorder) ListPodmanResourcesToDelete(appName, componentName, mode interface{}) *gomock.Call
ListPodmanResourcesToDelete indicates an expected call of ListPodmanResourcesToDelete.