system

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ReadmeReady is a template for system.status.readme
	ReadmeReady = template.Must(template.New("system_status_readme_ready").
				Parse(bundle.File_deploy_internal_text_system_status_readme_ready_tmpl))

	// ReadmeProgress is a template for system.status.readme
	ReadmeProgress = template.Must(template.New("system_status_readme_progress").
					Parse(bundle.File_deploy_internal_text_system_status_readme_progress_tmpl))

	// ReadmeRejected is a template for system.status.readme
	ReadmeRejected = template.Must(template.New("system_status_readme_rejected").
					Parse(bundle.File_deploy_internal_text_system_status_readme_rejected_tmpl))
)

Functions

func CheckSystem added in v2.0.8

func CheckSystem(sys *nbv1.NooBaa) bool

CheckSystem checks the state of the system and initializes its status fields

func CheckWaitingFor

func CheckWaitingFor(sys *nbv1.NooBaa) error

CheckWaitingFor checks what the system deployment is waiting for in order to become ready in order to help the user troubleshoot common deployment issues.

func Cmd

func Cmd() *cobra.Command

Cmd returns a CLI command

func CmdAPICall added in v2.0.8

func CmdAPICall() *cobra.Command

CmdAPICall returns a CLI command

func CmdCreate

func CmdCreate() *cobra.Command

CmdCreate returns a CLI command

func CmdDelete

func CmdDelete() *cobra.Command

CmdDelete returns a CLI command

func CmdList

func CmdList() *cobra.Command

CmdList returns a CLI command

func CmdReconcile

func CmdReconcile() *cobra.Command

CmdReconcile returns a CLI command

func CmdStatus

func CmdStatus() *cobra.Command

CmdStatus returns a CLI command

func CmdUI added in v2.0.9

func CmdUI() *cobra.Command

CmdUI returns a CLI command

func CmdYaml

func CmdYaml() *cobra.Command

CmdYaml returns a CLI command

func GetNBClient

func GetNBClient() nb.Client

GetNBClient returns an api client

func LoadSystemDefaults

func LoadSystemDefaults() *nbv1.NooBaa

LoadSystemDefaults loads a noobaa system CR from bundled yamls and apply's changes from CLI flags to the defaults.

func OpenURLInBrowser added in v2.0.9

func OpenURLInBrowser(u string) error

OpenURLInBrowser opens the url in a browser according to the current OS

func RunAPICall added in v2.0.8

func RunAPICall(cmd *cobra.Command, args []string)

RunAPICall runs a CLI command

func RunCreate

func RunCreate(cmd *cobra.Command, args []string)

RunCreate runs a CLI command

func RunDelete

func RunDelete(cmd *cobra.Command, args []string)

RunDelete runs a CLI command

func RunList

func RunList(cmd *cobra.Command, args []string)

RunList runs a CLI command

func RunOperatorCreate

func RunOperatorCreate(cmd *cobra.Command, args []string)

RunOperatorCreate creates the default system when the operator starts.

func RunReconcile

func RunReconcile(cmd *cobra.Command, args []string)

RunReconcile runs a CLI command

func RunStatus

func RunStatus(cmd *cobra.Command, args []string)

RunStatus runs a CLI command

func RunUI added in v2.0.9

func RunUI(cmd *cobra.Command, args []string)

RunUI runs a CLI command

func RunYaml

func RunYaml(cmd *cobra.Command, args []string)

RunYaml runs a CLI command

func WaitReady

func WaitReady() bool

WaitReady waits until the system phase changes to ready by the operator

Types

type Client

type Client struct {
	NooBaa      *nbv1.NooBaa
	ServiceMgmt *corev1.Service
	SecretOp    *corev1.Secret
	SecretAdmin *corev1.Secret
	NBClient    nb.Client
	MgmtURL     *url.URL
	S3URL       *url.URL
}

Client is the system client for making mgmt or s3 calls (with operator/admin credentials)

func Connect

func Connect(isExternal bool) (*Client, error)

Connect loads the mgmt and S3 api details from the system. It gets the endpoint address and token from the system status and secret that the operator creates for the system. When isExternal is true we return : s3 => external DNS, mgmt => port-forwarding (router) When isExternal is false we return : s3 => internal DNS, mgmt => node-port

type Reconciler

type Reconciler struct {
	Request         types.NamespacedName
	Client          client.Client
	Scheme          *runtime.Scheme
	Ctx             context.Context
	Logger          *logrus.Entry
	Recorder        record.EventRecorder
	NBClient        nb.Client
	CoreVersion     string
	OperatorVersion string
	OAuthEndpoints  *util.OAuth2Endpoints

	NooBaa              *nbv1.NooBaa
	ServiceAccount      *corev1.ServiceAccount
	CoreApp             *appsv1.StatefulSet
	NooBaaDB            *appsv1.StatefulSet
	ServiceMgmt         *corev1.Service
	ServiceS3           *corev1.Service
	ServiceDb           *corev1.Service
	SecretServer        *corev1.Secret
	SecretOp            *corev1.Secret
	SecretAdmin         *corev1.Secret
	SecretEndpoints     *corev1.Secret
	AWSCloudCreds       *cloudcredsv1.CredentialsRequest
	AzureCloudCreds     *cloudcredsv1.CredentialsRequest
	AzureContainerCreds *corev1.Secret
	DefaultBackingStore *nbv1.BackingStore
	DefaultBucketClass  *nbv1.BucketClass
	OBCStorageClass     *storagev1.StorageClass
	PrometheusRule      *monitoringv1.PrometheusRule
	ServiceMonitor      *monitoringv1.ServiceMonitor
	SystemInfo          *nb.SystemInfo
	CephObjectstoreUser *cephv1.CephObjectStoreUser
	RouteMgmt           *routev1.Route
	RouteS3             *routev1.Route
	DeploymentEndpoint  *appsv1.Deployment
	HPAEndpoint         *autoscalingv1.HorizontalPodAutoscaler
	JoinSecret          *corev1.Secret
}

Reconciler is the context for loading or reconciling a noobaa system

func NewReconciler

func NewReconciler(
	req types.NamespacedName,
	client client.Client,
	scheme *runtime.Scheme,
	recorder record.EventRecorder,
) *Reconciler

NewReconciler initializes a reconciler to be used for loading or reconciling a noobaa system

func (*Reconciler) CheckAccountNameAvailability added in v2.3.0

func (r *Reconciler) CheckAccountNameAvailability(accountName string) (storage.CheckNameAvailabilityResult, error)

CheckAccountNameAvailability checks if the storage account name is available. Storage account names must be unique across Azure and meet other requirements.

func (*Reconciler) CheckAll

func (r *Reconciler) CheckAll()

CheckAll checks the state of all the objects controlled by the system

func (*Reconciler) CheckJoinSecret added in v2.1.0

func (r *Reconciler) CheckJoinSecret() error

CheckJoinSecret checks that all need information to allow to join another noobaa clauster is specified in the join secret

func (*Reconciler) CheckServiceStatus

func (r *Reconciler) CheckServiceStatus(srv *corev1.Service, route *routev1.Route, status *nbv1.ServiceStatus, portName string)

CheckServiceStatus populates the status of a service by detecting all of its addresses

func (*Reconciler) CheckSystemCR

func (r *Reconciler) CheckSystemCR() error

CheckSystemCR checks the validity of the system CR (i.e system.metadata.name and system.spec.image) and updates the status accordingly

func (*Reconciler) CreateContainer added in v2.3.0

func (r *Reconciler) CreateContainer(accountName, accountGroupName, containerName string) (azblob.ContainerURL, error)

CreateContainer creates a new container with the specified name in the specified account

func (*Reconciler) CreateStorageAccount added in v2.3.0

func (r *Reconciler) CreateStorageAccount(accountName, accountGroupName string) (storage.Account, error)

CreateStorageAccount starts creation of a new storage account and waits for the account to be created.

func (*Reconciler) DeleteContainer added in v2.3.0

func (r *Reconciler) DeleteContainer(accountName, accountGroupName, containerName string) error

DeleteContainer deletes the named container.

func (*Reconciler) DeleteStorageAccount added in v2.3.0

func (r *Reconciler) DeleteStorageAccount(accountName, accountGroupName string) (autorest.Response, error)

DeleteStorageAccount deletes an existing storate account

func (*Reconciler) Environment added in v2.3.0

func (r *Reconciler) Environment() *azure.Environment

Environment returns an `azure.Environment{...}` for the current cloud.

func (*Reconciler) GetAccountKeys added in v2.3.0

func (r *Reconciler) GetAccountKeys(accountName, accountGroupName string) (storage.AccountListKeysResult, error)

GetAccountKeys gets the storage account keys

func (*Reconciler) GetContainer added in v2.3.0

func (r *Reconciler) GetContainer(accountName, accountGroupName, containerName string) (azblob.ContainerURL, error)

GetContainer gets info about an existing container.

func (*Reconciler) GetResourceManagementAuthorizer added in v2.3.0

func (r *Reconciler) GetResourceManagementAuthorizer() (autorest.Authorizer, error)

GetResourceManagementAuthorizer gets an OAuthTokenAuthorizer for Azure Resource Manager

func (*Reconciler) GetStorageAccount added in v2.3.0

func (r *Reconciler) GetStorageAccount(accountName, accountGroupName string) (storage.Account, error)

GetStorageAccount gets details on the specified storage account

func (*Reconciler) InitNBClient added in v2.1.0

func (r *Reconciler) InitNBClient() error

InitNBClient initialize the noobaa client for making calls to the server.

func (*Reconciler) Own

func (r *Reconciler) Own(obj metav1.Object)

Own sets the object owner references to the noobaa system

func (*Reconciler) PrintMemUsage added in v2.1.0

func (r *Reconciler) PrintMemUsage(phase string)

PrintMemUsage prints memory usage message.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile() (reconcile.Result, error)

Reconcile reads that state of the cluster for a System object, and makes changes based on the state read and what is in the System.Spec. The Controller will requeue the Request to be processed again if the returned error is non-nil or Result.Requeue is true, otherwise upon completion it will remove the work from the queue.

func (*Reconciler) ReconcileAWSCredentials added in v2.0.4

func (r *Reconciler) ReconcileAWSCredentials() error

ReconcileAWSCredentials creates a CredentialsRequest resource if cloud credentials operator is available

func (*Reconciler) ReconcileAzureCredentials added in v2.3.0

func (r *Reconciler) ReconcileAzureCredentials() error

ReconcileAzureCredentials creates a CredentialsRequest resource if cloud credentials operator is available

func (*Reconciler) ReconcileBackingStoreCredentials added in v2.0.4

func (r *Reconciler) ReconcileBackingStoreCredentials() error

ReconcileBackingStoreCredentials creates a CredentialsRequest resource if neccesary and returns the bucket name allowed for the credentials. nil is returned if cloud credentials are not supported

func (*Reconciler) ReconcileDefaultBackingStore

func (r *Reconciler) ReconcileDefaultBackingStore() error

ReconcileDefaultBackingStore attempts to get credentials to cloud storage using the cloud-credentials operator and use it for the default backing store

func (*Reconciler) ReconcileDefaultBucketClass

func (r *Reconciler) ReconcileDefaultBucketClass() error

ReconcileDefaultBucketClass creates the default bucket class

func (*Reconciler) ReconcileDeploymentEndpointStatus added in v2.1.0

func (r *Reconciler) ReconcileDeploymentEndpointStatus() error

ReconcileDeploymentEndpointStatus creates/updates the endpoints deployment

func (*Reconciler) ReconcileHPAEndpoint added in v2.1.0

func (r *Reconciler) ReconcileHPAEndpoint() error

ReconcileHPAEndpoint reconcile the endpoint's HPS and report the configuration back to the noobaa core

func (*Reconciler) ReconcileOBCStorageClass

func (r *Reconciler) ReconcileOBCStorageClass() error

ReconcileOBCStorageClass reconciles default OBC storage class for the system

func (*Reconciler) ReconcileObject

func (r *Reconciler) ReconcileObject(obj runtime.Object, desiredFunc func() error) error

ReconcileObject is a generic call to reconcile a kubernetes object desiredFunc can be passed to modify the object before create/update. Currently we ignore enforcing a desired state, but it might be needed on upgrades.

func (*Reconciler) ReconcileObjectOptional added in v2.0.5

func (r *Reconciler) ReconcileObjectOptional(obj runtime.Object, desiredFunc func() error) error

ReconcileObjectOptional is like ReconcileObject but also ignores if the CRD is missing

func (*Reconciler) ReconcilePhaseConfiguring

func (r *Reconciler) ReconcilePhaseConfiguring() error

ReconcilePhaseConfiguring runs the reconcile phase

func (*Reconciler) ReconcilePhaseConnecting

func (r *Reconciler) ReconcilePhaseConnecting() error

ReconcilePhaseConnecting runs the reconcile phase

func (*Reconciler) ReconcilePhaseCreating

func (r *Reconciler) ReconcilePhaseCreating() error

ReconcilePhaseCreating runs the reconcile phase

func (*Reconciler) ReconcilePhaseCreatingForMainClusters added in v2.1.0

func (r *Reconciler) ReconcilePhaseCreatingForMainClusters() error

ReconcilePhaseCreatingForMainClusters reconcile all object for full deployment clusters

func (*Reconciler) ReconcilePhaseVerifying

func (r *Reconciler) ReconcilePhaseVerifying() error

ReconcilePhaseVerifying runs the reconcile verify phase

func (*Reconciler) ReconcilePhases

func (r *Reconciler) ReconcilePhases() error

ReconcilePhases runs the reconcile flow and populates System.Status.

func (*Reconciler) ReconcilePrometheusRule added in v2.1.0

func (r *Reconciler) ReconcilePrometheusRule() error

ReconcilePrometheusRule reconciles prometheus rule

func (*Reconciler) ReconcileRGWCredentials added in v2.0.4

func (r *Reconciler) ReconcileRGWCredentials() error

ReconcileRGWCredentials creates a ceph objectstore user if a ceph objectstore exists in the same namespace

func (*Reconciler) ReconcileReadSystem added in v2.0.5

func (r *Reconciler) ReconcileReadSystem() error

ReconcileReadSystem calls read_system on noobaa server and stores the result

func (*Reconciler) ReconcileServiceMonitor added in v2.1.0

func (r *Reconciler) ReconcileServiceMonitor() error

ReconcileServiceMonitor reconciles service monitor

func (*Reconciler) ReconcileSystemSecrets added in v2.1.0

func (r *Reconciler) ReconcileSystemSecrets() error

ReconcileSystemSecrets reconciles secrets used by the system and create the system if does not exists

func (*Reconciler) RegisterToCluster added in v2.1.0

func (r *Reconciler) RegisterToCluster() error

RegisterToCluster registers the noobaa client with the noobaa cluster

func (*Reconciler) SetDesiredAgentProfile

func (r *Reconciler) SetDesiredAgentProfile(profileString string) string

SetDesiredAgentProfile updates the value of the AGENT_PROFILE env

func (*Reconciler) SetDesiredCoreApp

func (r *Reconciler) SetDesiredCoreApp() error

SetDesiredCoreApp updates the CoreApp as desired for reconciling

func (*Reconciler) SetDesiredDeploymentEndpoint added in v2.1.0

func (r *Reconciler) SetDesiredDeploymentEndpoint() error

SetDesiredDeploymentEndpoint updates the endpoint deployment as desired for reconciling

func (*Reconciler) SetDesiredHPAEndpoint added in v2.1.0

func (r *Reconciler) SetDesiredHPAEndpoint() error

SetDesiredHPAEndpoint updates the endpoint horizontal pod autoscaler as desired for reconciling

func (*Reconciler) SetDesiredNooBaaDB added in v2.1.0

func (r *Reconciler) SetDesiredNooBaaDB() error

SetDesiredNooBaaDB updates the NooBaaDB as desired for reconciling

func (*Reconciler) SetDesiredSecretAdmin added in v2.1.0

func (r *Reconciler) SetDesiredSecretAdmin() error

SetDesiredSecretAdmin set auth related info in admin secret

func (*Reconciler) SetDesiredSecretAdminAccountInfo added in v2.1.0

func (r *Reconciler) SetDesiredSecretAdminAccountInfo() error

SetDesiredSecretAdminAccountInfo set account related info in admin secret

func (*Reconciler) SetDesiredSecretEndpoints added in v2.1.0

func (r *Reconciler) SetDesiredSecretEndpoints() error

SetDesiredSecretEndpoints set auth related info in endpoints secret

func (*Reconciler) SetDesiredSecretOp added in v2.1.0

func (r *Reconciler) SetDesiredSecretOp() error

SetDesiredSecretOp set auth token in operator secret

func (*Reconciler) SetDesiredServiceAccount added in v2.0.6

func (r *Reconciler) SetDesiredServiceAccount() error

SetDesiredServiceAccount updates the ServiceAccount as desired for reconciling

func (*Reconciler) SetDesiredServiceDB added in v2.1.0

func (r *Reconciler) SetDesiredServiceDB() error

SetDesiredServiceDB updates the ServiceS3 as desired for reconciling

func (*Reconciler) SetDesiredServiceMgmt

func (r *Reconciler) SetDesiredServiceMgmt() error

SetDesiredServiceMgmt updates the ServiceMgmt as desired for reconciling

func (*Reconciler) SetDesiredServiceS3

func (r *Reconciler) SetDesiredServiceS3() error

SetDesiredServiceS3 updates the ServiceS3 as desired for reconciling

func (*Reconciler) SetPhase

func (r *Reconciler) SetPhase(phase nbv1.SystemPhase, reason string, message string)

SetPhase updates the status phase and conditions

func (*Reconciler) SetReadme

func (r *Reconciler) SetReadme(t *template.Template)

SetReadme runs the template and sets the readme

func (*Reconciler) UpdateBackingStoresPhase added in v2.1.0

func (r *Reconciler) UpdateBackingStoresPhase(pools []nb.PoolInfo)

UpdateBackingStoresPhase updates newPhase of backingstore after readSystem

func (*Reconciler) UpdateBucketClassesPhase added in v2.1.0

func (r *Reconciler) UpdateBucketClassesPhase(Buckets []nb.BucketInfo)

UpdateBucketClassesPhase updates newPhase of bucketclass after readSystem

func (*Reconciler) UpdateStatus

func (r *Reconciler) UpdateStatus()

UpdateStatus updates the system status in kubernetes from the memory

func (*Reconciler) UpgradeSplitDB added in v2.1.0

func (r *Reconciler) UpgradeSplitDB() error

UpgradeSplitDB removes the old pvc and create a new one with the same PV

func (*Reconciler) UpgradeSplitDBCreateNewPVC added in v2.1.0

func (r *Reconciler) UpgradeSplitDBCreateNewPVC(oldPvc *corev1.PersistentVolumeClaim) error

UpgradeSplitDBCreateNewPVC creates new pvc and checks it

func (*Reconciler) UpgradeSplitDBDeleteOldPVC added in v2.1.0

func (r *Reconciler) UpgradeSplitDBDeleteOldPVC(oldPVC *corev1.PersistentVolumeClaim) error

UpgradeSplitDBDeleteOldPVC deletes the parameter oldPvc and checks it

func (*Reconciler) UpgradeSplitDBDeleteOldSTS added in v2.1.0

func (r *Reconciler) UpgradeSplitDBDeleteOldSTS() error

UpgradeSplitDBDeleteOldSTS deletes old STS named noobaa-core and checks it

func (*Reconciler) UpgradeSplitDBSetReclaimPolicy added in v2.1.0

func (r *Reconciler) UpgradeSplitDBSetReclaimPolicy(oldPvc *corev1.PersistentVolumeClaim, reclaim corev1.PersistentVolumeReclaimPolicy) error

UpgradeSplitDBSetReclaimPolicy sets the reclaim policy to reclaim parameter and checks it

func (*Reconciler) VerifyObjectBucketCleanup added in v2.3.0

func (r *Reconciler) VerifyObjectBucketCleanup() error

VerifyObjectBucketCleanup checks if the uninstallation is in mode graceful and if OBs still exist in the system the operator will wait and the finalizer on noobaa CR won't be reomved

Jump to

Keyboard shortcuts

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