diff --git a/pkg/kubernetes/client/client.go b/pkg/kubernetes/client/client.go index 7c8cb96d..457739d1 100644 --- a/pkg/kubernetes/client/client.go +++ b/pkg/kubernetes/client/client.go @@ -1279,9 +1279,9 @@ func (c *Client) GetInstallPlan(ctx context.Context, namespace string, name stri } // DoPackageWait for the package to be available in OLM. -func (c *Client) DoPackageWait(ctx context.Context, name string) error { +func (c *Client) DoPackageWait(ctx context.Context, namespace, name string) error { packageInstalled := func(ctx context.Context) (bool, error) { - _, err := c.GetPackageManifest(ctx, name) + _, err := c.GetPackageManifest(ctx, namespace, name) if err != nil { if apierrors.ReasonForError(err) == metav1.StatusReasonUnknown { return false, err @@ -1294,8 +1294,7 @@ func (c *Client) DoPackageWait(ctx context.Context, name string) error { } // GetPackageManifest returns a package manifest by given name. -func (c *Client) GetPackageManifest(ctx context.Context, name string) (*packagev1.PackageManifest, error) { - namespace := "olm" +func (c *Client) GetPackageManifest(ctx context.Context, namespace, name string) (*packagev1.PackageManifest, error) { operatorClient, err := packageServerClient.NewForConfig(c.restConfig) if err != nil { return nil, errors.Join(err, errors.New("cannot create an operator client instance")) diff --git a/pkg/kubernetes/client/kubeclient_interface.go b/pkg/kubernetes/client/kubeclient_interface.go index 8201a93a..8e8bf2d9 100644 --- a/pkg/kubernetes/client/kubeclient_interface.go +++ b/pkg/kubernetes/client/kubeclient_interface.go @@ -108,9 +108,9 @@ type KubeClientConnector interface { // GetInstallPlan retrieves an OLM install plan by namespace and name. GetInstallPlan(ctx context.Context, namespace string, name string) (*v1alpha1.InstallPlan, error) // DoPackageWait for the package to be available in OLM. - DoPackageWait(ctx context.Context, name string) error + DoPackageWait(ctx context.Context, namespace, name string) error // GetPackageManifest returns a package manifest by given name. - GetPackageManifest(ctx context.Context, name string) (*packagev1.PackageManifest, error) + GetPackageManifest(ctx context.Context, namespace, name string) (*packagev1.PackageManifest, error) // UpdateInstallPlan updates the existing install plan in the specified namespace. UpdateInstallPlan(ctx context.Context, namespace string, installPlan *v1alpha1.InstallPlan) (*v1alpha1.InstallPlan, error) // ListCRDs returns a list of CRDs. diff --git a/pkg/kubernetes/client/mock_kube_client_connector.go b/pkg/kubernetes/client/mock_kube_client_connector.go index 0d6bff9e..470619da 100644 --- a/pkg/kubernetes/client/mock_kube_client_connector.go +++ b/pkg/kubernetes/client/mock_kube_client_connector.go @@ -445,17 +445,17 @@ func (_m *MockKubeClientConnector) DoCSVWait(ctx context.Context, key types.Name return r0 } -// DoPackageWait provides a mock function with given fields: ctx, name -func (_m *MockKubeClientConnector) DoPackageWait(ctx context.Context, name string) error { - ret := _m.Called(ctx, name) +// DoPackageWait provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubeClientConnector) DoPackageWait(ctx context.Context, namespace string, name string) error { + ret := _m.Called(ctx, namespace, name) if len(ret) == 0 { panic("no return value specified for DoPackageWait") } var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { - r0 = rf(ctx, name) + if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { + r0 = rf(ctx, namespace, name) } else { r0 = ret.Error(0) } @@ -957,9 +957,9 @@ func (_m *MockKubeClientConnector) GetOperatorGroup(ctx context.Context, namespa return r0, r1 } -// GetPackageManifest provides a mock function with given fields: ctx, name -func (_m *MockKubeClientConnector) GetPackageManifest(ctx context.Context, name string) (*operatorsv1.PackageManifest, error) { - ret := _m.Called(ctx, name) +// GetPackageManifest provides a mock function with given fields: ctx, namespace, name +func (_m *MockKubeClientConnector) GetPackageManifest(ctx context.Context, namespace string, name string) (*operatorsv1.PackageManifest, error) { + ret := _m.Called(ctx, namespace, name) if len(ret) == 0 { panic("no return value specified for GetPackageManifest") @@ -967,19 +967,19 @@ func (_m *MockKubeClientConnector) GetPackageManifest(ctx context.Context, name var r0 *operatorsv1.PackageManifest var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*operatorsv1.PackageManifest, error)); ok { - return rf(ctx, name) + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*operatorsv1.PackageManifest, error)); ok { + return rf(ctx, namespace, name) } - if rf, ok := ret.Get(0).(func(context.Context, string) *operatorsv1.PackageManifest); ok { - r0 = rf(ctx, name) + if rf, ok := ret.Get(0).(func(context.Context, string, string) *operatorsv1.PackageManifest); ok { + r0 = rf(ctx, namespace, name) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*operatorsv1.PackageManifest) } } - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, name) + if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { + r1 = rf(ctx, namespace, name) } else { r1 = ret.Error(1) } diff --git a/pkg/kubernetes/kubernetes.go b/pkg/kubernetes/kubernetes.go index 6e6725f8..553ec250 100644 --- a/pkg/kubernetes/kubernetes.go +++ b/pkg/kubernetes/kubernetes.go @@ -470,7 +470,7 @@ func (k *Kubernetes) InstallPerconaCatalog(ctx context.Context) error { if err := k.client.ApplyFile(data); err != nil { return errors.Join(err, errors.New("cannot apply percona catalog file")) } - if err := k.client.DoPackageWait(ctx, "everest-operator"); err != nil { + if err := k.client.DoPackageWait(ctx, OLMNamespace, "everest-operator"); err != nil { return errors.Join(err, errors.New("timeout waiting for package")) } return nil