marketplace

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntegreatlyChannel = "rhmi"
	CatalogSourceName  = "rhmi-registry-cs"
	OperatorGroupName  = "rhmi-registry-og"
	Publisher          = "RHMI"
)

Variables

This section is empty.

Functions

func GenerateRegistryConfigMapFromManifest

func GenerateRegistryConfigMapFromManifest(manifestPackageName string) (map[string]string, error)

Generates ConfigMap equivalent from a manifest package

func GetCurrentCSVFromManifest

func GetCurrentCSVFromManifest(packageYaml string) (string, error)

Gets the version number from the package yaml string

func GetFilesFromManifestAsStringList

func GetFilesFromManifestAsStringList(dir string, regex string, packageYaml string) (string, error)

Get manifest files from a directory recursively matching a regex and return as a yaml string list

func GetManifestDirEnvVar

func GetManifestDirEnvVar() string

Get the manifest directory for when running locally vs when in container image

func ProcessYamlFile

func ProcessYamlFile(path string, stringList *strings.Builder) error

func ReadAndFormatManifestYamlFile

func ReadAndFormatManifestYamlFile(path string) (string, error)

Process each line of files from manifest for correct yaml format to use in config map

Types

type Manager

type Manager struct{}

func NewManager

func NewManager() *Manager

func (*Manager) GetSubscriptionInstallPlans

func (m *Manager) GetSubscriptionInstallPlans(ctx context.Context, serverClient k8sclient.Client, subName, ns string) (*coreosv1alpha1.InstallPlanList, *coreosv1alpha1.Subscription, error)

func (*Manager) InstallOperator

func (m *Manager) InstallOperator(ctx context.Context, serverClient k8sclient.Client, owner ownerutil.Owner, t Target, operatorGroupNamespaces []string, approvalStrategy coreosv1alpha1.Approval) error

type MarketplaceInterface

type MarketplaceInterface interface {
	InstallOperator(ctx context.Context, serverClient k8sclient.Client, owner ownerutil.Owner, t Target, operatorGroupNamespaces []string, approvalStrategy coreosv1alpha1.Approval) error
	GetSubscriptionInstallPlans(ctx context.Context, serverClient k8sclient.Client, subName, ns string) (*coreosv1alpha1.InstallPlanList, *coreosv1alpha1.Subscription, error)
}

type MarketplaceInterfaceMock

type MarketplaceInterfaceMock struct {
	// GetSubscriptionInstallPlansFunc mocks the GetSubscriptionInstallPlans method.
	GetSubscriptionInstallPlansFunc func(ctx context.Context, serverClient client.Client, subName string, ns string) (*v1alpha1.InstallPlanList, *v1alpha1.Subscription, error)

	// InstallOperatorFunc mocks the InstallOperator method.
	InstallOperatorFunc func(ctx context.Context, serverClient client.Client, owner ownerutil.Owner, t Target, operatorGroupNamespaces []string, approvalStrategy v1alpha1.Approval) error
	// contains filtered or unexported fields
}

MarketplaceInterfaceMock is a mock implementation of MarketplaceInterface.

    func TestSomethingThatUsesMarketplaceInterface(t *testing.T) {

        // make and configure a mocked MarketplaceInterface
        mockedMarketplaceInterface := &MarketplaceInterfaceMock{
            GetSubscriptionInstallPlansFunc: func(ctx context.Context, serverClient client.Client, subName string, ns string) (*v1alpha1.InstallPlanList, *v1alpha1.Subscription, error) {
	               panic("mock out the GetSubscriptionInstallPlans method")
            },
            InstallOperatorFunc: func(ctx context.Context, serverClient client.Client, owner ownerutil.Owner, t Target, operatorGroupNamespaces []string, approvalStrategy v1alpha1.Approval) error {
	               panic("mock out the InstallOperator method")
            },
        }

        // use mockedMarketplaceInterface in code that requires MarketplaceInterface
        // and then make assertions.

    }

func (*MarketplaceInterfaceMock) GetSubscriptionInstallPlans

func (mock *MarketplaceInterfaceMock) GetSubscriptionInstallPlans(ctx context.Context, serverClient client.Client, subName string, ns string) (*v1alpha1.InstallPlanList, *v1alpha1.Subscription, error)

GetSubscriptionInstallPlans calls GetSubscriptionInstallPlansFunc.

func (*MarketplaceInterfaceMock) GetSubscriptionInstallPlansCalls

func (mock *MarketplaceInterfaceMock) GetSubscriptionInstallPlansCalls() []struct {
	Ctx          context.Context
	ServerClient client.Client
	SubName      string
	Ns           string
}

GetSubscriptionInstallPlansCalls gets all the calls that were made to GetSubscriptionInstallPlans. Check the length with:

len(mockedMarketplaceInterface.GetSubscriptionInstallPlansCalls())

func (*MarketplaceInterfaceMock) InstallOperator

func (mock *MarketplaceInterfaceMock) InstallOperator(ctx context.Context, serverClient client.Client, owner ownerutil.Owner, t Target, operatorGroupNamespaces []string, approvalStrategy v1alpha1.Approval) error

InstallOperator calls InstallOperatorFunc.

func (*MarketplaceInterfaceMock) InstallOperatorCalls

func (mock *MarketplaceInterfaceMock) InstallOperatorCalls() []struct {
	Ctx                     context.Context
	ServerClient            client.Client
	Owner                   ownerutil.Owner
	T                       Target
	OperatorGroupNamespaces []string
	ApprovalStrategy        v1alpha1.Approval
}

InstallOperatorCalls gets all the calls that were made to InstallOperator. Check the length with:

len(mockedMarketplaceInterface.InstallOperatorCalls())

type Target

type Target struct {
	Namespace,
	Pkg,
	Channel string
	ManifestPackage string
}

Jump to

Keyboard shortcuts

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