v1alpha1

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package v1alpha1 contains API Schema definitions for the ndb v1alpha1 API group +kubebuilder:object:generate=true +groupName=ndb.nutanix.com

Index

Constants

View Source
const (
	DATABASE_CR_STATUS_DELETING     = "DELETING"
	DATABASE_CR_STATUS_EMPTY        = ""
	DATABASE_CR_STATUS_READY        = "READY"
	DATABASE_CR_STATUS_PROVISIONING = "PROVISIONING"

	DATABASE_ENGINE_TYPE_GENERIC  = "Generic"
	DATABASE_ENGINE_TYPE_POSTGRES = "postgres_database"
	DATABASE_ENGINE_TYPE_MYSQL    = "mysql_database"
	DATABASE_ENGINE_TYPE_MONGODB  = "mongodb_database"

	FINALIZER_DATABASE_INSTANCE = "ndb.nutanix.com/finalizerdatabaseinstance"
	FINALIZER_DATABASE_SERVER   = "ndb.nutanix.com/finalizerdatabaseserver"

	PROFILE_TYPE_COMPUTE            = "Compute"
	PROFILE_TYPE_DATABASE_PARAMETER = "Database_Parameter"
	PROFILE_TYPE_NETWORK            = "Network"
	PROFILE_TYPE_SOFTWARE           = "Software"
	PROFILE_TYPE_STORAGE            = "Storage"

	PROPERTY_NAME_VM_IP = "vm_ip"

	SLA_NAME_NONE = "NONE"

	TOPOLOGY_ALL      = "ALL"
	TOPOLOGY_CLUSTER  = "cluster"
	TOPOLOGY_DATABASE = "database"
	TOPOLOGY_INSTANCE = "instance"
	TOPOLOGY_SINGLE   = "single"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "ndb.nutanix.com", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func GetDatabaseEngineName

func GetDatabaseEngineName(dbType string) string

func GetOOBProfiles

func GetOOBProfiles(ctx context.Context, ndbclient *ndbclient.NDBClient, dbType string) (profileMap map[string]ProfileResponse, err error)

Fetches all the profiles and returns a map of OOB profiles Returns an error if one or more OOB profiles is not found

Types

type ActionArgument

type ActionArgument struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

+kubebuilder:object:generate:=false

type Credentials

type Credentials struct {
	// Username for NDB
	LoginUser string `json:"loginUser"`
	// Password for NDB
	Password string `json:"password"`
	// SSH public key for the database vm
	SSHPublicKey string `json:"sshPublicKey"`
}

func (*Credentials) DeepCopy

func (in *Credentials) DeepCopy() *Credentials

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Credentials.

func (*Credentials) DeepCopyInto

func (in *Credentials) DeepCopyInto(out *Credentials)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Database

type Database struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   DatabaseSpec   `json:"spec,omitempty"`
	Status DatabaseStatus `json:"status,omitempty"`
}

Database is the Schema for the databases API +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:shortName={"db","dbs"} +kubebuilder:printcolumn:name="IP Address",type=string,JSONPath=`.status.ipAddress` +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.status` +kubebuilder:printcolumn:name="Database Instance ID",type=string,JSONPath=`.status.id` +kubebuilder:printcolumn:name="Database Server ID",type=string,JSONPath=`.status.dbServerId`

func (*Database) DeepCopy

func (in *Database) DeepCopy() *Database

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Database.

func (*Database) DeepCopyInto

func (in *Database) DeepCopyInto(out *Database)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Database) DeepCopyObject

func (in *Database) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DatabaseDeprovisionRequest

type DatabaseDeprovisionRequest struct {
	Delete               bool `json:"delete"`
	Remove               bool `json:"remove"`
	SoftRemove           bool `json:"softRemove"`
	Forced               bool `json:"forced"`
	DeleteTimeMachine    bool `json:"deleteTimeMachine"`
	DeleteLogicalCluster bool `json:"deleteLogicalCluster"`
}

+kubebuilder:object:generate:=false

func GenerateDeprovisionDatabaseRequest

func GenerateDeprovisionDatabaseRequest() (req *DatabaseDeprovisionRequest)

Returns a request to delete a database instance

type DatabaseList

type DatabaseList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Database `json:"items"`
}

+kubebuilder:object:root=true DatabaseList contains a list of Database

func (*DatabaseList) DeepCopy

func (in *DatabaseList) DeepCopy() *DatabaseList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseList.

func (*DatabaseList) DeepCopyInto

func (in *DatabaseList) DeepCopyInto(out *DatabaseList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DatabaseList) DeepCopyObject

func (in *DatabaseList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DatabaseNode

type DatabaseNode struct {
	Id               string `json:"id"`
	Name             string `json:"name"`
	DatabaseServerId string `json:"dbServerId"`
}

+kubebuilder:object:generate:=false

type DatabaseProvisionRequest

type DatabaseProvisionRequest struct {
	DatabaseType             string           `json:"databaseType"`
	Name                     string           `json:"name"`
	DatabaseDescription      string           `json:"databaseDescription"`
	SoftwareProfileId        string           `json:"softwareProfileId"`
	SoftwareProfileVersionId string           `json:"softwareProfileVersionId"`
	ComputeProfileId         string           `json:"computeProfileId"`
	NetworkProfileId         string           `json:"networkProfileId"`
	DbParameterProfileId     string           `json:"dbParameterProfileId"`
	NewDbServerTimeZone      string           `json:"newDbServerTimeZone"`
	CreateDbServer           bool             `json:"createDbserver"`
	NodeCount                int              `json:"nodeCount"`
	NxClusterId              string           `json:"nxClusterId"`
	SSHPublicKey             string           `json:"sshPublicKey"`
	Clustered                bool             `json:"clustered"`
	AutoTuneStagingDrive     bool             `json:"autoTuneStagingDrive"`
	TimeMachineInfo          TimeMachineInfo  `json:"timeMachineInfo"`
	ActionArguments          []ActionArgument `json:"actionArguments"`
	Nodes                    []Node           `json:"nodes"`
}

+kubebuilder:object:generate:=false

func GenerateProvisioningRequest

func GenerateProvisioningRequest(ctx context.Context, ndbclient *ndbclient.NDBClient, dbSpec DatabaseSpec) (req *DatabaseProvisionRequest, err error)

This function generates and returns a request for provisioning a database (and a dbserver vm) on NDB The database provisioned has a NONE time machine SLA attached to it, and uses the default OOB profiles

type DatabaseResponse

type DatabaseResponse struct {
	Id            string         `json:"id"`
	Name          string         `json:"name"`
	Status        string         `json:"status"`
	DatabaseNodes []DatabaseNode `json:"databaseNodes"`
	Properties    []Property     `json:"properties"`
}

+kubebuilder:object:generate:=false

func GetAllDatabases

func GetAllDatabases(ctx context.Context, ndbClient *ndbclient.NDBClient) (databases []DatabaseResponse, err error)

Fetches all the databases on the NDB instance and retutns a slice of the databases

func GetDatabaseById

func GetDatabaseById(ctx context.Context, ndbClient *ndbclient.NDBClient, id string) (database DatabaseResponse, err error)

Fetches and returns a database by an Id

type DatabaseServerDeprovisionRequest

type DatabaseServerDeprovisionRequest struct {
	Delete            bool `json:"delete"`
	Remove            bool `json:"remove"`
	SoftRemove        bool `json:"softRemove"`
	DeleteVgs         bool `json:"deleteVgs"`
	DeleteVmSnapshots bool `json:"deleteVmSnapshots"`
}

+kubebuilder:object:generate:=false

func GenerateDeprovisionDatabaseServerRequest

func GenerateDeprovisionDatabaseServerRequest() (req *DatabaseServerDeprovisionRequest)

Returns a request to delete a database server vm

type DatabaseSpec

type DatabaseSpec struct {
	NDB      NDB      `json:"ndb"`
	Instance Instance `json:"databaseInstance"`
}

DatabaseSpec defines the desired state of Database

func (*DatabaseSpec) DeepCopy

func (in *DatabaseSpec) DeepCopy() *DatabaseSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseSpec.

func (*DatabaseSpec) DeepCopyInto

func (in *DatabaseSpec) DeepCopyInto(out *DatabaseSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DatabaseStatus

type DatabaseStatus struct {
	IPAddress        string `json:"ipAddress"`
	Id               string `json:"id"`
	Status           string `json:"status"`
	DatabaseServerId string `json:"dbServerId"`
}

DatabaseStatus defines the observed state of Database

func (*DatabaseStatus) DeepCopy

func (in *DatabaseStatus) DeepCopy() *DatabaseStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseStatus.

func (*DatabaseStatus) DeepCopyInto

func (in *DatabaseStatus) DeepCopyInto(out *DatabaseStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Instance

type Instance struct {
	// +kubebuilder:default:=database_instance_name
	// Name of the database instance
	DatabaseInstanceName string `json:"databaseInstanceName"`
	// +kubebuilder:default:={"database_one", "database_two", "database_three"}
	// +kubebuilder:validation:MinItems:=1
	// Name of the database to be provisiond in the database instance
	DatabaseNames []string `json:"databaseNames"`
	// Password of the database instance
	Password string `json:"password"`
	// +kubebuilder:validation:Minimum:=10
	// +kubebuilder:default:=10
	// +optional
	// Size of the database instance
	Size int `json:"size"`
	// +kubebuilder:default:=UTC
	// +optional
	TimeZone string `json:"timezone"`
	// +kubebuilder:validation:Enum=mysql;postgres;mongodb
	// +kubebuilder:default:=postgres
	Type string `json:"type"`
	// +optional
	Profiles Profiles `json:"profiles"`
}

Database instance specific details

func (*Instance) DeepCopy

func (in *Instance) DeepCopy() *Instance

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Instance.

func (*Instance) DeepCopyInto

func (in *Instance) DeepCopyInto(out *Instance)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NDB

type NDB struct {
	ClusterId   string      `json:"clusterId"`
	Credentials Credentials `json:"credentials"`
	Server      string      `json:"server"`
}

Details of the NDB installation

func (*NDB) DeepCopy

func (in *NDB) DeepCopy() *NDB

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NDB.

func (*NDB) DeepCopyInto

func (in *NDB) DeepCopyInto(out *NDB)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Node

type Node struct {
	Properties []string `json:"properties"`
	VmName     string   `json:"vmName"`
}

+kubebuilder:object:generate:=false

type Profile

type Profile struct {
	// +optional
	Id string `json:"id"`
	// +optional
	VersionId string `json:"versionId"`
}

func (*Profile) DeepCopy

func (in *Profile) DeepCopy() *Profile

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Profile.

func (*Profile) DeepCopyInto

func (in *Profile) DeepCopyInto(out *Profile)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ProfileResponse

type ProfileResponse struct {
	Id              string `json:"id"`
	Name            string `json:"name"`
	Type            string `json:"type"`
	EngineType      string `json:"engineType"`
	LatestVersionId string `json:"latestVersionId"`
	Topology        string `json:"topology"`
}

+kubebuilder:object:generate:=false

func GetAllProfiles

func GetAllProfiles(ctx context.Context, ndbClient *ndbclient.NDBClient) (profiles []ProfileResponse, err error)

Fetches and returns all the available profiles as a profile slice

type Profiles

type Profiles struct {
	// +optional
	Software Profile `json:"software"`

	// +optional
	Compute Profile `json:"compute"`

	// +optional
	Network Profile `json:"network"`

	// +optional
	DbParam Profile `json:"dbParam"`
}

func (*Profiles) DeepCopy

func (in *Profiles) DeepCopy() *Profiles

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Profiles.

func (*Profiles) DeepCopyInto

func (in *Profiles) DeepCopyInto(out *Profiles)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Property

type Property struct {
	Name        string `json:"name"`
	Value       string `json:"value"`
	Description string `json:"description"`
}

used by database response +kubebuilder:object:generate:=false

type SLAResponse

type SLAResponse struct {
	Id                 string `json:"id"`
	Name               string `json:"name"`
	UniqueName         string `json:"uniqueName"`
	Description        string `json:"description"`
	DailyRetention     int    `json:"dailyRetention"`
	WeeklyRetention    int    `json:"weeklyRetention"`
	MonthlyRetention   int    `json:"monthlyRetention"`
	QuarterlyRetention int    `json:"quarterlyRetention"`
	YearlyRetention    int    `json:"yearlyRetention"`
}

+kubebuilder:object:generate:=false

func GetAllSLAs

func GetAllSLAs(ctx context.Context, ndbClient *ndbclient.NDBClient) (slas []SLAResponse, err error)

Fetches and returns all the SLAs as a sla slice

func GetNoneTimeMachineSLA

func GetNoneTimeMachineSLA(ctx context.Context, ndbclient *ndbclient.NDBClient) (sla SLAResponse, err error)

Fetches all the SLAs from the ndb and returns the NONE TM SLA. Returns an error if not found.

type TaskInfoSummaryResponse

type TaskInfoSummaryResponse struct {
	Name                 string                    `json:"name"`
	WorkId               string                    `json:"workId"`
	OperationId          string                    `json:"operationId"`
	DbServerId           string                    `json:"dbserverId"`
	Message              string                    `json:"messgae"`
	EntityId             string                    `json:"entityId"`
	EntityName           string                    `json:"entityName"`
	EntityType           string                    `json:"entityType"`
	Status               string                    `json:"status"`
	AssociatedOperations []TaskInfoSummaryResponse `json:"associatedOperations"`
	DependencyReport     interface{}               `json:"dependencyReport"`
}

+kubebuilder:object:generate:=false

func DeprovisionDatabase

func DeprovisionDatabase(ctx context.Context, ndbClient *ndbclient.NDBClient, id string, req DatabaseDeprovisionRequest) (task TaskInfoSummaryResponse, err error)

Deprovisions a database instance given a database id Returns the task info summary response for the operation

func DeprovisionDatabaseServer

func DeprovisionDatabaseServer(ctx context.Context, ndbClient *ndbclient.NDBClient, id string, req DatabaseServerDeprovisionRequest) (task TaskInfoSummaryResponse, err error)

Deprovisions a database server vm given a server id Returns the task info summary response for the operation

func ProvisionDatabase

func ProvisionDatabase(ctx context.Context, ndbClient *ndbclient.NDBClient, req *DatabaseProvisionRequest) (task TaskInfoSummaryResponse, err error)

Provisions a database instance based on the database provisioning request Returns the task info summary response for the operation

type TimeMachineInfo

type TimeMachineInfo struct {
	Name             string            `json:"name"`
	Description      string            `json:"description"`
	SlaId            string            `json:"slaId"`
	Schedule         map[string]string `json:"schedule"`
	Tags             []string          `json:"tags"`
	AutoTuneLogDrive bool              `json:"autoTuneLogDrive"`
}

+kubebuilder:object:generate:=false

Jump to

Keyboard shortcuts

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