baseorderer

package
v1.0.7-1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NODE                    = "node"
	DaysToSecondsConversion = int64(24 * 60 * 60)
)

Variables

This section is empty.

Functions

func GetDomainPort

func GetDomainPort(address string) (string, string)

Types

type CertificateManager

type CertificateManager interface {
	CheckCertificatesForExpire(instance v1.Object, numSecondsBeforeExpire int64) (current.IBPCRStatusType, string, error)
	GetSignCert(string, string) ([]byte, error)
	GetDurationToNextRenewal(commoninit.SecretType, v1.Object, int64) (time.Duration, error)
	RenewCert(commoninit.SecretType, certificate.Instance, *current.EnrollmentSpec, *commonapi.BCCSP, string, bool, bool) error
}

type DeploymentManager

type DeploymentManager interface {
	resources.Manager
	CheckForSecretChange(v1.Object, string, func(string, *appsv1.Deployment) bool) error
}

type IBPOrderer

type IBPOrderer interface {
	Initialize(instance *current.IBPOrderer, update Update) error
	PreReconcileChecks(instance *current.IBPOrderer, update Update) (bool, error)
	ReconcileManagers(instance *current.IBPOrderer, update Update, genesisBlock []byte) error
	Reconcile(instance *current.IBPOrderer, update Update) (common.Result, error)
}

type InitializeIBPOrderer

type InitializeIBPOrderer interface {
	GenerateSecrets(commoninit.SecretType, *current.IBPOrderer, *commonconfig.Response) error
	Create(initializer.OrdererConfig, initializer.IBPOrderer, string) (*initializer.Response, error)
	Update(initializer.OrdererConfig, initializer.IBPOrderer) (*initializer.Response, error)
	CreateOrUpdateConfigMap(*current.IBPOrderer, initializer.OrdererConfig) error
	GetConfigFromConfigMap(instance *current.IBPOrderer) (*corev1.ConfigMap, error)
	MissingCrypto(*current.IBPOrderer) bool
	Delete(*current.IBPOrderer) error
	CheckIfAdminCertsUpdated(*current.IBPOrderer) (bool, error)
	UpdateAdminSecret(*current.IBPOrderer) error
	GetInitOrderer(instance *current.IBPOrderer, storagePath string) (*initializer.Orderer, error)
	GetUpdatedOrderer(instance *current.IBPOrderer) (*initializer.Orderer, error)
	UpdateSecrets(prefix commoninit.SecretType, instance *current.IBPOrderer, crypto *commonconfig.Response) error
	GenerateSecretsFromResponse(instance *current.IBPOrderer, cryptoResponse *commonconfig.CryptoResponse) error
	UpdateSecretsFromResponse(instance *current.IBPOrderer, cryptoResponse *commonconfig.CryptoResponse) error
	GetCrypto(instance *current.IBPOrderer) (*commonconfig.CryptoResponse, error)
	GetCoreConfigFromFile(instance *current.IBPOrderer, file string) (initializer.OrdererConfig, error)
	GetCoreConfigFromBytes(instance *current.IBPOrderer, bytes []byte) (initializer.OrdererConfig, error)
}

type Manager

type Manager struct {
	Client controllerclient.Client
	Scheme *runtime.Scheme
	Config *config.Config
}

func (*Manager) GetNode

func (m *Manager) GetNode(nodeNumber int, renewCertTimers map[string]*time.Timer, restartManager RestartManager) *Node

type Node

type Node struct {
	Client controllerclient.Client
	Scheme *runtime.Scheme
	Config *config.Config

	DeploymentManager     DeploymentManager
	ServiceManager        resources.Manager
	PVCManager            resources.Manager
	EnvConfigMapManager   resources.Manager
	RoleManager           resources.Manager
	RoleBindingManager    resources.Manager
	ServiceAccountManager resources.Manager

	Override    Override
	Initializer InitializeIBPOrderer
	Name        string

	CertificateManager CertificateManager
	RenewCertTimers    map[string]*time.Timer

	Restart RestartManager
}

func NewNode

func NewNode(client controllerclient.Client, scheme *runtime.Scheme, config *config.Config, name string, renewCertTimers map[string]*time.Timer, restartManager RestartManager) *Node

func NewNodeWithOverrides

func NewNodeWithOverrides(client controllerclient.Client, scheme *runtime.Scheme, config *config.Config, name string, o Override, renewCertTimers map[string]*time.Timer, restartManager RestartManager) *Node

func (*Node) CanSetCertificateTimer

func (n *Node) CanSetCertificateTimer(instance *current.IBPOrderer, update Update) bool

This function checks whether the parent orderer node (if parent exists) or node itself is in Deployed or Warning state. We don't want to set a timer to renew certifictes before all nodes are Deployed as a certificate renewal updates the parent status to Warning while renewing.

func (*Node) CheckCertificates

func (n *Node) CheckCertificates(instance *current.IBPOrderer) (*current.CRStatus, error)

func (*Node) CheckStates

func (n *Node) CheckStates(instance *current.IBPOrderer) error

func (*Node) ConfigExists

func (n *Node) ConfigExists(instance *current.IBPOrderer) bool

func (*Node) CreateGenesisSecret

func (n *Node) CreateGenesisSecret(instance *current.IBPOrderer) error

func (*Node) CreateManagers

func (n *Node) CreateManagers()

func (*Node) CustomLogic

func (n *Node) CustomLogic(instance *current.IBPOrderer, update Update) (*current.CRStatus, *common.Result, error)

func (*Node) Delete

func (n *Node) Delete(instance *current.IBPOrderer) error

func (*Node) EnrollForEcert

func (n *Node) EnrollForEcert(instance *current.IBPOrderer) error

func (*Node) EnrollForTLSCert

func (n *Node) EnrollForTLSCert(instance *current.IBPOrderer) error

func (*Node) FabricOrdererMigration

func (n *Node) FabricOrdererMigration(instance *current.IBPOrderer) (*ordererconfig.Orderer, error)

Moving to fabric version above 1.4.6 require that the `msp/keystore` value be removed from BCCSP section if configured to use PKCS11 (HSM). NOTE: This does not support migration across major release, will not cover migration orderer from 1.4.x to 2.x

func (*Node) FabricOrdererMigrationV2_0

func (n *Node) FabricOrdererMigrationV2_0(instance *current.IBPOrderer) error

func (*Node) FabricOrdererMigrationV2_4

func (n *Node) FabricOrdererMigrationV2_4(instance *current.IBPOrderer) error

func (*Node) FabricOrdererMigrationV2_5

func (n *Node) FabricOrdererMigrationV2_5(instance *current.IBPOrderer) error

func (*Node) GetBCCSPSectionForInstance

func (n *Node) GetBCCSPSectionForInstance(instance *current.IBPOrderer) (*commonapi.BCCSP, error)

func (*Node) GetEndpoints

func (n *Node) GetEndpoints(instance *current.IBPOrderer) *current.OrdererEndpoints

func (*Node) GetInitStoragePath

func (n *Node) GetInitStoragePath(instance *current.IBPOrderer) string

func (*Node) GetLabels

func (n *Node) GetLabels(instance v1.Object) map[string]string

func (*Node) HandleActions

func (n *Node) HandleActions(instance *current.IBPOrderer, update Update) error

func (*Node) HandleRestart

func (n *Node) HandleRestart(instance *current.IBPOrderer, update Update) error

func (*Node) Initialize

func (n *Node) Initialize(instance *current.IBPOrderer, update Update) error

func (*Node) InitializeCreate

func (n *Node) InitializeCreate(instance *current.IBPOrderer, initOrderer *initializer.Orderer) error

func (*Node) InitializeUpdateConfigOverride

func (n *Node) InitializeUpdateConfigOverride(instance *current.IBPOrderer, initOrderer *initializer.Orderer) error

func (*Node) InitializeUpdateNodeOU

func (n *Node) InitializeUpdateNodeOU(instance *current.IBPOrderer) error

func (*Node) PreReconcileChecks

func (n *Node) PreReconcileChecks(instance *current.IBPOrderer, update Update) (bool, error)

PreReconcileChecks validate CR request before starting reconcile flow

func (*Node) Reconcile

func (n *Node) Reconcile(instance *current.IBPOrderer, update Update) (common.Result, error)

func (*Node) ReconcileFabricOrdererMigration

func (n *Node) ReconcileFabricOrdererMigration(instance *current.IBPOrderer) error

func (*Node) ReconcileGenesisSecret

func (n *Node) ReconcileGenesisSecret(instance *current.IBPOrderer) error

func (*Node) ReconcileHSMImages

func (n *Node) ReconcileHSMImages(instance *current.IBPOrderer) bool

func (*Node) ReconcileManagers

func (n *Node) ReconcileManagers(instance *current.IBPOrderer, updated Update, genesisBlock []byte) error

func (*Node) ReconcileRBAC

func (n *Node) ReconcileRBAC(instance *current.IBPOrderer) error

func (*Node) ReenrollEcert

func (n *Node) ReenrollEcert(instance *current.IBPOrderer) error

func (*Node) ReenrollEcertNewKey

func (n *Node) ReenrollEcertNewKey(instance *current.IBPOrderer) error

func (*Node) ReenrollTLSCert

func (n *Node) ReenrollTLSCert(instance *current.IBPOrderer) error

func (*Node) ReenrollTLSCertNewKey

func (n *Node) ReenrollTLSCertNewKey(instance *current.IBPOrderer) error

func (*Node) RenewCert

func (n *Node) RenewCert(certType commoninit.SecretType, obj runtime.Object, newKey bool) error

func (*Node) RestartAction

func (n *Node) RestartAction(instance *current.IBPOrderer) error

func (*Node) SelectRegion

func (n *Node) SelectRegion(instance *current.IBPOrderer) (bool, error)

func (*Node) SelectZone

func (n *Node) SelectZone(instance *current.IBPOrderer) (bool, error)

func (*Node) SetCertificateTimer

func (n *Node) SetCertificateTimer(instance *current.IBPOrderer, certType commoninit.SecretType) error

func (*Node) SetVersion

func (n *Node) SetVersion(instance *current.IBPOrderer) (bool, error)

func (*Node) UpdateCRStatus

func (n *Node) UpdateCRStatus(instance *current.IBPOrderer) error

NOTE: This is called by the timer's subroutine when it goes off, not during a reconcile loop. Therefore, it won't be overriden by the "SetStatus" method in ibporderer_controller.go

func (*Node) UpdateConnectionProfile

func (n *Node) UpdateConnectionProfile(instance *current.IBPOrderer) error

func (*Node) UpdateConnectionProfileConfigmap

func (n *Node) UpdateConnectionProfileConfigmap(instance *current.IBPOrderer, endpoints current.OrdererEndpoints, tlscert string, tlscacerts []string, ecert string, cacert []string, admincerts []string) error

func (*Node) UpdateExternalEndpoint

func (n *Node) UpdateExternalEndpoint(instance *current.IBPOrderer) bool

func (*Node) UpdateMSPCertificates

func (n *Node) UpdateMSPCertificates(instance *current.IBPOrderer) error

func (*Node) UpdateParentStatus

func (n *Node) UpdateParentStatus(instance *current.IBPOrderer) error

type NodeManager

type NodeManager interface {
	GetNode(int, map[string]*time.Timer, RestartManager) *Node
}

type Orderer

type Orderer struct {
	Client k8sclient.Client
	Scheme *runtime.Scheme
	Config *config.Config

	NodeManager        NodeManager
	OrdererNodeManager resources.Manager

	Override        Override
	RenewCertTimers map[string]*time.Timer
	RestartManager  *restart.RestartManager
}

func New

func New(client k8sclient.Client, scheme *runtime.Scheme, config *config.Config, o Override) *Orderer

func (*Orderer) AddHostPortToProfile

func (o *Orderer) AddHostPortToProfile(initProfile *configtx.Profile, instance *current.IBPOrderer) error

func (*Orderer) CheckCSRHosts

func (o *Orderer) CheckCSRHosts(instance *current.IBPOrderer, hosts []string)

func (*Orderer) ClusterSizeUpdate

func (o *Orderer) ClusterSizeUpdate(instance *current.IBPOrderer) bool

func (*Orderer) CreateManagers

func (o *Orderer) CreateManagers()

func (*Orderer) CreateNodeCR

func (o *Orderer) CreateNodeCR(instance *current.IBPOrderer, number int) error

func (*Orderer) DeleteNode

func (o *Orderer) DeleteNode(instance *current.IBPOrderer, nodes int) error

func (*Orderer) GenerateGenesisBlock

func (o *Orderer) GenerateGenesisBlock(instance *current.IBPOrderer, addHostPortToProfile func(*configtx.Profile, *current.IBPOrderer) error) ([]byte, error)

func (*Orderer) GenerateGenesisSecretForNodes

func (o *Orderer) GenerateGenesisSecretForNodes(genesisBlock []byte, nodes []current.IBPOrderer) error

func (*Orderer) GetClusterNodes

func (o *Orderer) GetClusterNodes(instance *current.IBPOrderer) (current.IBPOrdererList, error)

func (*Orderer) GetLabels

func (o *Orderer) GetLabels(instance v1.Object) map[string]string

func (*Orderer) GetMSPConfig

func (o *Orderer) GetMSPConfig(instance *current.IBPOrderer, ID string) (*msp.MSPConfig, error)

func (*Orderer) GetNode

func (o *Orderer) GetNode(nodeNumber int) *Node

func (*Orderer) GetNodes

func (o *Orderer) GetNodes(instance *current.IBPOrderer) []*Node

func (*Orderer) Initialize

func (o *Orderer) Initialize(instance *current.IBPOrderer, update Update) error

func (*Orderer) LoadInitialProfile

func (o *Orderer) LoadInitialProfile(instance *current.IBPOrderer) (*configtx.Profile, error)

func (*Orderer) PatchStatus

func (o *Orderer) PatchStatus(instance *current.IBPOrderer) error

func (*Orderer) PreReconcileChecks

func (o *Orderer) PreReconcileChecks(instance *current.IBPOrderer, update Update) (bool, error)

func (*Orderer) ReadOUConfigFile

func (o *Orderer) ReadOUConfigFile(instance *current.IBPOrderer, configFile string) ([]*msp.FabricOUIdentifier, *msp.FabricNodeOUs, error)

func (*Orderer) Reconcile

func (o *Orderer) Reconcile(instance *current.IBPOrderer, update Update) (common.Result, error)

func (*Orderer) ReconcileCluster

func (o *Orderer) ReconcileCluster(instance *current.IBPOrderer, update Update, addHostPortToProfile func(*configtx.Profile, *current.IBPOrderer) error) (common.Result, error)

func (*Orderer) ReconcileManagers

func (o *Orderer) ReconcileManagers(instance *current.IBPOrderer, update Update, genesisBlock []byte) error

func (*Orderer) ReconcileNode

func (o *Orderer) ReconcileNode(instance *current.IBPOrderer, update bool) (reconcile.Result, error)

func (*Orderer) SetVersion

func (o *Orderer) SetVersion(instance *current.IBPOrderer) (bool, error)

func (*Orderer) UpdateNodesWithGenesisBlock

func (o *Orderer) UpdateNodesWithGenesisBlock(genesisBlock string, nodes []current.IBPOrderer) error

func (*Orderer) UpdateStatus

func (o *Orderer) UpdateStatus(instance *current.IBPOrderer) error

type OrdererConfig

type OrdererConfig interface {
	MergeWith(interface{}, bool) error
	ToBytes() ([]byte, error)
	UsingPKCS11() bool
	SetPKCS11Defaults(bool)
	GetBCCSPSection() *commonapi.BCCSP
	SetDefaultKeyStore()
	SetBCCSPLibrary(string)
}

type RestartManager

type RestartManager interface {
	ForAdminCertUpdate(instance v1.Object) error
	ForCertUpdate(certType commoninit.SecretType, instance v1.Object) error
	ForConfigOverride(instance v1.Object) error
	ForNodeOU(instance v1.Object) error
	TriggerIfNeeded(instance restart.Instance) error
	ForRestartAction(instance v1.Object) error
}

type Update

type Update interface {
	SpecUpdated() bool
	ConfigOverridesUpdated() bool
	TLSCertUpdated() bool
	EcertUpdated() bool
	OrdererTagUpdated() bool
	CertificateUpdated() bool
	RestartNeeded() bool
	EcertReenrollNeeded() bool
	TLScertReenrollNeeded() bool
	EcertNewKeyReenroll() bool
	TLScertNewKeyReenroll() bool
	DeploymentUpdated() bool
	MSPUpdated() bool
	EcertEnroll() bool
	TLScertEnroll() bool
	CertificateCreated() bool
	GetCreatedCertType() commoninit.SecretType
	CryptoBackupNeeded() bool
	MigrateToV2() bool
	MigrateToV24() bool
	MigrateToV25() bool
	NodeOUUpdated() bool
	ImagesUpdated() bool
	FabricVersionUpdated() bool
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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