bootstrap

package
v0.0.0-...-639c86f Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OdlmNamespacedSubResource = "odlmNamespacedSubscription"
	OdlmClusterSubResource    = "odlmClusterSubscription"
	RegistryCrResources       = "csV3OperandRegistry"
	RegistrySaasCrResources   = "csV3SaasOperandRegistry"
	ConfigCrResources         = "csV3OperandConfig"
	ConfigSaasCrResources     = "csV3SaasOperandConfig"
	CSOperatorVersions        = map[string]string{
		"operand-deployment-lifecycle-manager-app": "1.5.0",
		"ibm-cert-manager-operator":                "3.9.0",
	}
)

Functions

func IdentifyCPFSNs

func IdentifyCPFSNs(r client.Reader, operatorNs string) (string, error)

Types

type Bootstrap

type Bootstrap struct {
	client.Client
	client.Reader
	Config *rest.Config
	record.EventRecorder
	*deploy.Manager
	SaasEnable           bool
	MultiInstancesEnable bool
	CSOperators          []CSOperator
	CSData               apiv3.CSData
}

func NewBootstrap

func NewBootstrap(mgr manager.Manager) (bs *Bootstrap, err error)

NewBootstrap is the way to create a NewBootstrap struct

func (*Bootstrap) CheckClusterType

func (b *Bootstrap) CheckClusterType(ns string) (bool, error)

func (*Bootstrap) CheckCsSubscription

func (b *Bootstrap) CheckCsSubscription() error

func (*Bootstrap) CheckDeployStatus

func (b *Bootstrap) CheckDeployStatus(ctx context.Context) (operatorDeployed bool, servicesDeployed bool)

func (*Bootstrap) CheckOperatorCatalog

func (b *Bootstrap) CheckOperatorCatalog(ns string) error

func (*Bootstrap) Cleanup

func (b *Bootstrap) Cleanup(operatorNs string, resource *Resource) error

func (*Bootstrap) CleanupWebhookResources

func (b *Bootstrap) CleanupWebhookResources() error

func (*Bootstrap) ConfigCertManagerOperandManagedByOperator

func (b *Bootstrap) ConfigCertManagerOperandManagedByOperator(ctx context.Context) error

func (*Bootstrap) ConfigODLMOperandManagedByOperator

func (b *Bootstrap) ConfigODLMOperandManagedByOperator(ctx context.Context) error

ConfigODLMOperandManagedByOperator gets all OperandRegistry and OperandConfig which are managed by CS operator To confirm that the deployment of CRs are in the correct ServicesNamespace

func (*Bootstrap) CreateCsCR

func (b *Bootstrap) CreateCsCR() error

func (*Bootstrap) CreateCsMaps

func (b *Bootstrap) CreateCsMaps() error

CreateCsMaps will create a new common-service-maps configmap if not exists

func (*Bootstrap) CreateNamespace

func (b *Bootstrap) CreateNamespace(name string) error

func (*Bootstrap) CreateNsScopeConfigmap

func (b *Bootstrap) CreateNsScopeConfigmap() error

CreateNsScopeConfigmap creates nss configmap for operators

func (*Bootstrap) CreateOrUpdateFromYaml

func (b *Bootstrap) CreateOrUpdateFromYaml(yamlContent []byte, alwaysUpdate ...bool) error

func (*Bootstrap) DeleteFromYaml

func (b *Bootstrap) DeleteFromYaml(objectTemplate string, data interface{}) error

DeleteFromYaml takes [objectTemplate, b.CSData] and delete the object according to the objectTemplate

func (*Bootstrap) DeployCertManagerCR

func (b *Bootstrap) DeployCertManagerCR() error

func (*Bootstrap) DeployResource

func (b *Bootstrap) DeployResource(cr, placeholder string) bool

deployResource deploys the given resource CR

func (*Bootstrap) GetObjs

func (b *Bootstrap) GetObjs(objectTemplate string, data interface{}, alwaysUpdate ...bool) ([]*unstructured.Unstructured, error)

func (*Bootstrap) GetOperandConfig

func (b *Bootstrap) GetOperandConfig(ctx context.Context, name, namespace string) (*odlm.OperandConfig, error)

GetOperandConfig returns the OperandConfig instance of "name" from "namespace" namespace

func (*Bootstrap) GetOperandRegistry

func (b *Bootstrap) GetOperandRegistry(ctx context.Context, name, namespace string) (*odlm.OperandRegistry, error)

GetOperandRegistry returns the OperandRegistry instance of "name" from "namespace" namespace

func (*Bootstrap) GetSubscription

func (b *Bootstrap) GetSubscription(ctx context.Context, name, namespace string) (*unstructured.Unstructured, error)

GetSubscription returns the subscription instance of "name" from "namespace" namespace

func (*Bootstrap) InitResources

func (b *Bootstrap) InitResources(instance *apiv3.CommonService, forceUpdateODLMCRs bool) error

InitResources initialize resources at the bootstrap of operator

func (*Bootstrap) InstallOrUpdateOpcon

func (b *Bootstrap) InstallOrUpdateOpcon(forceUpdateODLMCRs bool) error

InstallOrUpdateOpcon will install or update OperandConfig when Opcon CRD is existent

func (*Bootstrap) InstallOrUpdateOpreg

func (b *Bootstrap) InstallOrUpdateOpreg(forceUpdateODLMCRs bool, installPlanApproval olmv1alpha1.Approval) error

InstallOrUpdateOpreg will install or update OperandRegistry when Opreg CRD is existent

func (*Bootstrap) IsBYOCert

func (b *Bootstrap) IsBYOCert() (bool, error)

1. try to get cs-ca-certificate-secret 2. try to get cs-ca-certificate if we get secret but not get the cert, it is BYOC

func (*Bootstrap) ListCerts

ListCerts returns the Certificate instance list with "options"

func (*Bootstrap) ListIssuer

func (b *Bootstrap) ListIssuer(ctx context.Context, opts ...client.ListOption) *certmanagerv1.IssuerList

ListIssuer returns the Iusser instance list with "options"

func (*Bootstrap) ListOperandConfig

func (b *Bootstrap) ListOperandConfig(ctx context.Context, opts ...client.ListOption) *odlm.OperandConfigList

ListOperandConfig returns the OperandConfig instance with "options"

func (*Bootstrap) ListOperandRegistry

func (b *Bootstrap) ListOperandRegistry(ctx context.Context, opts ...client.ListOption) *odlm.OperandRegistryList

ListOperandRegistry returns the OperandRegistry instance with "options"

func (*Bootstrap) ListSubscriptions

func (b *Bootstrap) ListSubscriptions(ctx context.Context, namespace string, listOptions client.ListOptions) (*unstructured.UnstructuredList, error)

GetSubscription returns the subscription instances from a namespace

func (*Bootstrap) PropagateCPPConfig

func (b *Bootstrap) PropagateCPPConfig(instance *corev1.ConfigMap) error

func (*Bootstrap) PropagateDefaultCR

func (b *Bootstrap) PropagateDefaultCR(instance *apiv3.CommonService) error

func (*Bootstrap) ResourceExists

func (b *Bootstrap) ResourceExists(dc discovery.DiscoveryInterface, apiGroupVersion, kind string) (bool, error)

ResourceExists returns true if the given resource kind exists in the given api groupversion

func (*Bootstrap) UpdateCsOpApproval

func (b *Bootstrap) UpdateCsOpApproval() error

update approval mode for the common service operator use label to find the subscription need this function because common service operator is not in operandRegistry

func (*Bootstrap) WaitResourceReady

func (b *Bootstrap) WaitResourceReady(apiGroupVersion string, kind string) error

WaitResourceReady returns true only when the specific resource CRD is created and wait for infinite time

type CSOperator

type CSOperator struct {
	Name       string
	CRD        string
	RBAC       string
	CR         string
	Deployment string
	Kind       string
	APIVersion string
}

type Resource

type Resource struct {
	Name    string
	Version string
	Group   string
	Kind    string
	Scope   string
}

Jump to

Keyboard shortcuts

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