basepeer

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCouchContainer     = "./definitions/peer/couchdb.yaml"
	DefaultCouchInitContainer = "./definitions/peer/couchdb-init.yaml"

	DaysToSecondsConversion = int64(24 * 60 * 60)
)

Variables

This section is empty.

Functions

This section is empty.

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 CoreConfig

type CoreConfig interface {
	GetMaxNameLength() *int
	GetAddressOverrides() []peerconfig.AddressOverride
	GetBCCSPSection() *commonapi.BCCSP
	MergeWith(interface{}, bool) error
	SetPKCS11Defaults(bool)
	ToBytes() ([]byte, error)
	UsingPKCS11() bool
	SetBCCSPLibrary(string)
}

type DeploymentManager

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

type IBPPeer

type IBPPeer interface {
	Initialize(instance *current.IBPPeer, update Update) error
	CheckStates(instance *current.IBPPeer) error
	PreReconcileChecks(instance *current.IBPPeer, update Update) (bool, error)
	ReconcileManagers(instance *current.IBPPeer, update Update) error
	Reconcile(instance *current.IBPPeer, update Update) (common.Result, error)
}

type InitializeIBPPeer

type InitializeIBPPeer interface {
	GenerateOrdererCACertsSecret(instance *current.IBPPeer, certs map[string][]byte) error
	GenerateSecrets(prefix commoninit.SecretType, instance v1.Object, crypto *commonconfig.Response) error
	Create(initializer.CoreConfig, initializer.IBPPeer, string) (*initializer.Response, error)
	Update(initializer.CoreConfig, initializer.IBPPeer) (*initializer.Response, error)
	CheckIfAdminCertsUpdated(*current.IBPPeer) (bool, error)
	UpdateAdminSecret(*current.IBPPeer) error
	MissingCrypto(*current.IBPPeer) bool
	GetInitPeer(instance *current.IBPPeer, storagePath string) (*initializer.Peer, error)
	GetUpdatedPeer(instance *current.IBPPeer) (*initializer.Peer, error)
	GenerateSecretsFromResponse(instance *current.IBPPeer, cryptoResponse *commonconfig.CryptoResponse) error
	UpdateSecretsFromResponse(instance *current.IBPPeer, cryptoResponse *commonconfig.CryptoResponse) error
	GetCrypto(instance *current.IBPPeer) (*commonconfig.CryptoResponse, error)
	CoreConfigMap() *initializer.CoreConfigMap
}

type JobStatus

type JobStatus string
const (
	COMPLETED JobStatus = "completed"
	RUNNING   JobStatus = "running"
	NOTFOUND  JobStatus = "not-found"
	UNKNOWN   JobStatus = "unknown"
)

type Peer

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

	DeploymentManager       DeploymentManager
	ServiceManager          resources.Manager
	PVCManager              resources.Manager
	StateDBPVCManager       resources.Manager
	FluentDConfigMapManager resources.Manager
	RoleManager             resources.Manager
	RoleBindingManager      resources.Manager
	ServiceAccountManager   resources.Manager

	Override    Override
	Initializer InitializeIBPPeer

	CertificateManager CertificateManager
	RenewCertTimers    map[string]*time.Timer

	Restart RestartManager
}

func New

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

func (*Peer) CanSetCertificateTimer

func (p *Peer) CanSetCertificateTimer(instance *current.IBPPeer, update Update) bool

This function checks whether the instance is in Deployed or Warning state when a cert update is detected. Only if Deployed or in Warning will a timer be set; otherwise, the update will be requeued until the Peer has completed deploying.

func (*Peer) CheckCSRHosts

func (p *Peer) CheckCSRHosts(instance *current.IBPPeer, hosts []string) bool

func (*Peer) CheckCertificates

func (p *Peer) CheckCertificates(instance *current.IBPPeer) (*current.CRStatus, error)

func (*Peer) CheckDBType

func (p *Peer) CheckDBType(instance *current.IBPPeer) bool

func (*Peer) CheckForRunningJobs

func (p *Peer) CheckForRunningJobs(listOpt k8sclient.ListOption) (JobStatus, *jobv1.Job, error)

func (*Peer) CheckStates

func (p *Peer) CheckStates(instance *current.IBPPeer) error

this function makes sure the deployment spec matches the expected state

func (*Peer) ConfigExists

func (p *Peer) ConfigExists(instance *current.IBPPeer) bool

func (*Peer) CreateManagers

func (p *Peer) CreateManagers()

func (*Peer) CreateSecret

func (p *Peer) CreateSecret(instance *current.IBPPeer) error

func (*Peer) CustomLogic

func (p *Peer) CustomLogic(instance *current.IBPPeer, update Update) (*current.CRStatus, *common.Result, error)

func (*Peer) EnrollForEcert

func (p *Peer) EnrollForEcert(instance *current.IBPPeer) error

func (*Peer) EnrollForTLSCert

func (p *Peer) EnrollForTLSCert(instance *current.IBPPeer) error

func (*Peer) FabricPeerMigrationV1_4

func (p *Peer) FabricPeerMigrationV1_4(instance *current.IBPPeer) (*peerconfig.Core, 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 peer from 1.4.x to 2.x

func (*Peer) GetBCCSPSectionForInstance

func (p *Peer) GetBCCSPSectionForInstance(instance *current.IBPPeer) (*commonapi.BCCSP, error)

func (*Peer) GetEndpoints

func (p *Peer) GetEndpoints(instance *current.IBPPeer) *current.PeerEndpoints

func (*Peer) GetInitStoragePath

func (p *Peer) GetInitStoragePath(instance *current.IBPPeer) string

func (*Peer) GetLabels

func (p *Peer) GetLabels(instance v1.Object) map[string]string

func (*Peer) HandleActions

func (p *Peer) HandleActions(instance *current.IBPPeer, update Update) error

func (*Peer) HandleMigrationJobs

func (p *Peer) HandleMigrationJobs(listOpt k8sclient.ListOption, instance *current.IBPPeer) (bool, error)

func (*Peer) HandleRestart

func (p *Peer) HandleRestart(instance *current.IBPPeer, update Update) error

func (*Peer) Initialize

func (p *Peer) Initialize(instance *current.IBPPeer, update Update) error

func (*Peer) InitializeCreate

func (p *Peer) InitializeCreate(instance *current.IBPPeer, initPeer *initializer.Peer) error

func (*Peer) InitializeUpdateConfigOverride

func (p *Peer) InitializeUpdateConfigOverride(instance *current.IBPPeer, initPeer *initializer.Peer) error

func (*Peer) InitializeUpdateNodeOU

func (p *Peer) InitializeUpdateNodeOU(instance *current.IBPPeer) error

func (*Peer) PreReconcileChecks

func (p *Peer) PreReconcileChecks(instance *current.IBPPeer, update Update) (bool, error)

func (*Peer) Reconcile

func (p *Peer) Reconcile(instance *current.IBPPeer, update Update) (common.Result, error)

func (*Peer) ReconcileFabricPeerMigrationV1_4

func (p *Peer) ReconcileFabricPeerMigrationV1_4(instance *current.IBPPeer) error

func (*Peer) ReconcileFabricPeerMigrationV2_0

func (p *Peer) ReconcileFabricPeerMigrationV2_0(instance *current.IBPPeer) error

func (*Peer) ReconcileFabricPeerMigrationV2_4

func (p *Peer) ReconcileFabricPeerMigrationV2_4(instance *current.IBPPeer) error

func (*Peer) ReconcileHSMImages

func (p *Peer) ReconcileHSMImages(instance *current.IBPPeer) bool

func (*Peer) ReconcileManagers

func (p *Peer) ReconcileManagers(instance *current.IBPPeer, updated Update) error

func (*Peer) ReconcilePeerRBAC

func (p *Peer) ReconcilePeerRBAC(instance *current.IBPPeer) error

func (*Peer) ReconcileSecret

func (p *Peer) ReconcileSecret(instance *current.IBPPeer) error

func (*Peer) ReenrollEcert

func (p *Peer) ReenrollEcert(instance *current.IBPPeer) error

func (*Peer) ReenrollEcertNewKey

func (p *Peer) ReenrollEcertNewKey(instance *current.IBPPeer) error

func (*Peer) ReenrollTLSCert

func (p *Peer) ReenrollTLSCert(instance *current.IBPPeer) error

func (*Peer) ReenrollTLSCertNewKey

func (p *Peer) ReenrollTLSCertNewKey(instance *current.IBPPeer) error

func (*Peer) RenewCert

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

func (*Peer) RestartAction

func (p *Peer) RestartAction(instance *current.IBPPeer) error

func (*Peer) SelectRegion

func (p *Peer) SelectRegion(instance *current.IBPPeer) (bool, error)

func (*Peer) SelectZone

func (p *Peer) SelectZone(instance *current.IBPPeer) (bool, error)

func (*Peer) SetCertificateTimer

func (p *Peer) SetCertificateTimer(instance *current.IBPPeer, certType commoninit.SecretType) error

func (*Peer) SetVersion

func (p *Peer) SetVersion(instance *current.IBPPeer) (bool, error)

func (*Peer) UpdateCRStatus

func (p *Peer) UpdateCRStatus(instance *current.IBPPeer) 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 ibppeer_controller.go

func (*Peer) UpdateConnectionProfile

func (p *Peer) UpdateConnectionProfile(instance *current.IBPPeer) error

func (*Peer) UpdateConnectionProfileConfigmap

func (p *Peer) UpdateConnectionProfileConfigmap(instance *current.IBPPeer, endpoints current.PeerEndpoints, tlscert string, tlscacerts []string, ecert string, cacert []string, admincerts []string) error

func (*Peer) UpdateExternalEndpoint

func (p *Peer) UpdateExternalEndpoint(instance *current.IBPPeer) bool

func (*Peer) UpdateMSPCertificates

func (p *Peer) UpdateMSPCertificates(instance *current.IBPPeer) error

func (*Peer) UpdateSecret

func (p *Peer) UpdateSecret(instance *current.IBPPeer, secret *corev1.Secret) error

func (*Peer) UpgradeDBs

func (p *Peer) UpgradeDBs(instance *current.IBPPeer) error

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
	ForRestartAction(instance v1.Object) error
	TriggerIfNeeded(instance restart.Instance) error
}

type Update

type Update interface {
	SpecUpdated() bool
	ConfigOverridesUpdated() bool
	DindArgsUpdated() bool
	TLSCertUpdated() bool
	EcertUpdated() bool
	PeerTagUpdated() bool
	CertificateUpdated() bool
	SetDindArgsUpdated(updated bool)
	RestartNeeded() bool
	EcertReenrollNeeded() bool
	TLSReenrollNeeded() bool
	EcertNewKeyReenroll() bool
	TLScertNewKeyReenroll() bool
	MigrateToV2() bool
	MigrateToV24() bool
	UpgradeDBs() bool
	MSPUpdated() bool
	EcertEnroll() bool
	TLSCertEnroll() bool
	CertificateCreated() bool
	GetCreatedCertType() commoninit.SecretType
	CryptoBackupNeeded() bool
	NodeOUUpdated() bool
	FabricVersionUpdated() bool
	ImagesUpdated() 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