cluster

package
v0.8.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: AGPL-3.0 Imports: 96 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CueTemplateName = "cluster_template.cue"
)
View Source
const (
	EnvExperimentalExpose = "KBCLI_EXPERIMENTAL_EXPOSE"
)

Variables

This section is empty.

Functions

func MultipleSourceComponents

func MultipleSourceComponents(fileName string, in io.Reader) ([]byte, error)

MultipleSourceComponents gets component data from multiple source, such as stdin, URI and local file

func New

func New(clusterName string, namespace string, cli dynamic.Interface, component ...string) *configObjectsWrapper

func NewCancelCmd

func NewCancelCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewClusterCmd

func NewClusterCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewClusterCmd creates the cluster command

func NewConnectCmd

func NewConnectCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewConnectCmd returns the cmd of connecting to a cluster

func NewCreateAccountCmd

func NewCreateAccountCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewCreateBackupCmd

func NewCreateBackupCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewCreateCmd

func NewCreateCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewCreateRestoreCmd

func NewCreateRestoreCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDeleteAccountCmd

func NewDeleteAccountCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDeleteBackupCmd

func NewDeleteBackupCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDeleteCmd

func NewDeleteCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDeleteOpsCmd

func NewDeleteOpsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDescAccountCmd

func NewDescAccountCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDescribeBackupCmd

func NewDescribeBackupCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDescribeBackupPolicyCmd

func NewDescribeBackupPolicyCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDescribeCmd

func NewDescribeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDescribeOpsCmd

func NewDescribeOpsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewDescribeReconfigureCmd

func NewDescribeReconfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewDescribeReconfigureCmd shows details of history modifications or configuration file of reconfiguring operations

func NewDiffConfigureCmd

func NewDiffConfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewDiffConfigureCmd shows the difference between two configuration version.

func NewEditBackupPolicyCmd

func NewEditBackupPolicyCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewEditConfigureCmd

func NewEditConfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewEditConfigureCmd shows the difference between two configuration version.

func NewExplainReconfigureCmd

func NewExplainReconfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewExplainReconfigureCmd shows details of modifiable parameters.

func NewExposeCmd

func NewExposeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewExposeCmd creates an expose command

func NewGrantOptions

func NewGrantOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewHorizontalScalingCmd

func NewHorizontalScalingCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewHorizontalScalingCmd creates a horizontal scaling command

func NewLabelCmd

func NewLabelCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListAccountsCmd

func NewListAccountsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListBackupCmd

func NewListBackupCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListBackupPolicyCmd

func NewListBackupPolicyCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListCmd

func NewListCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListComponentsCmd

func NewListComponentsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListEventsCmd

func NewListEventsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListInstancesCmd

func NewListInstancesCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListLogsCmd

func NewListLogsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewListOpsCmd

func NewListOpsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewLogsCmd

func NewLogsCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewLogsCmd returns the logic of accessing cluster log file

func NewPromoteCmd

func NewPromoteCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewPromoteCmd creates a promote command

func NewReconfigureCmd

func NewReconfigureCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewReconfigureCmd creates a Reconfiguring command

func NewRestartCmd

func NewRestartCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewRestartCmd creates a restart command

func NewRevokeOptions

func NewRevokeOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewStartCmd

func NewStartCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewStartCmd creates a start command

func NewStopCmd

func NewStopCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewStopCmd creates a stop command

func NewUpdateCmd

func NewUpdateCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

func NewUpgradeCmd

func NewUpgradeCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewUpgradeCmd creates an upgrade command

func NewVerticalScalingCmd

func NewVerticalScalingCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewVerticalScalingCmd creates a vertical scaling command

func NewVolumeExpansionCmd

func NewVolumeExpansionCmd(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command

NewVolumeExpansionCmd creates a volume expanding command

func PrintBackupList

func PrintBackupList(o ListBackupOptions) error

func PrintBackupPolicyList

func PrintBackupPolicyList(o action.ListOptions) error

PrintBackupPolicyList prints the backup policy list.

Types

type ConfigRelatedObjects

type ConfigRelatedObjects struct {
	Cluster        *appsv1alpha1.Cluster
	ClusterDef     *appsv1alpha1.ClusterDefinition
	ClusterVersion *appsv1alpha1.ClusterVersion

	ConfigSpecs map[string]configSpecsType
}

type ConnectOptions

type ConnectOptions struct {
	*action.ExecOptions
	// contains filtered or unexported fields
}

type CreateBackupOptions

type CreateBackupOptions struct {
	BackupMethod     string `json:"backupMethod"`
	BackupName       string `json:"backupName"`
	BackupPolicy     string `json:"backupPolicy"`
	DeletionPolicy   string `json:"deletionPolicy"`
	RetentionPeriod  string `json:"retentionPeriod"`
	ParentBackupName string `json:"parentBackupName"`

	action.CreateOptions `json:"-"`
}

func (*CreateBackupOptions) CompleteBackup

func (o *CreateBackupOptions) CompleteBackup() error

func (*CreateBackupOptions) RegisterBackupFlagCompletionFunc

func (o *CreateBackupOptions) RegisterBackupFlagCompletionFunc(cmd *cobra.Command, f cmdutil.Factory)

func (*CreateBackupOptions) Validate

func (o *CreateBackupOptions) Validate() error

type CreateOptions

type CreateOptions struct {
	// ClusterDefRef reference clusterDefinition
	ClusterDefRef     string                   `json:"clusterDefRef"`
	ClusterVersionRef string                   `json:"clusterVersionRef"`
	Tolerations       []interface{}            `json:"tolerations,omitempty"`
	ComponentSpecs    []map[string]interface{} `json:"componentSpecs"`
	Annotations       map[string]string        `json:"annotations,omitempty"`
	SetFile           string                   `json:"-"`
	Values            []string                 `json:"-"`
	RBACEnabled       bool                     `json:"-"`
	Storages          []string                 `json:"-"`
	ServiceRef        []string                 `json:"-"`

	// backup name to restore in creation
	Backup              string `json:"backup,omitempty"`
	RestoreTime         string `json:"restoreTime,omitempty"`
	VolumeRestorePolicy string `json:"-"`

	// backup config
	BackupConfig *appsv1alpha1.ClusterBackup `json:"backupConfig,omitempty"`

	Cmd *cobra.Command `json:"-"`

	UpdatableFlags
	action.CreateOptions `json:"-"`
}

func NewCreateOptions

func NewCreateOptions(f cmdutil.Factory, streams genericiooptions.IOStreams) *CreateOptions

func (*CreateOptions) CleanUp

func (o *CreateOptions) CleanUp() error

func (*CreateOptions) Complete

func (o *CreateOptions) Complete() error

func (*CreateOptions) CreateDependencies

func (o *CreateOptions) CreateDependencies(dryRun []string) error

func (*CreateOptions) PreCreate

func (o *CreateOptions) PreCreate(obj *unstructured.Unstructured) error

PreCreate before saving yaml to k8s, makes changes on Unstructured yaml

func (*CreateOptions) Validate

func (o *CreateOptions) Validate() error

type CreateRestoreOptions

type CreateRestoreOptions struct {
	// backup name to restore in creation
	Backup string `json:"backup,omitempty"`

	// point in time recovery args
	RestoreTime         *time.Time `json:"restoreTime,omitempty"`
	RestoreTimeStr      string     `json:"restoreTimeStr,omitempty"`
	VolumeRestorePolicy string     `json:"volumeRestorePolicy,omitempty"`

	action.CreateOptions `json:"-"`
}

func (*CreateRestoreOptions) Run

func (o *CreateRestoreOptions) Run() error

func (*CreateRestoreOptions) Validate

func (o *CreateRestoreOptions) Validate() error

type DescribeBackupOptions

type DescribeBackupOptions struct {
	Factory cmdutil.Factory

	// resource type and names
	Gvr schema.GroupVersionResource

	genericiooptions.IOStreams
	// contains filtered or unexported fields
}

func (*DescribeBackupOptions) Complete

func (o *DescribeBackupOptions) Complete(args []string) error

func (*DescribeBackupOptions) Run

func (o *DescribeBackupOptions) Run() error

type DescribeBackupPolicyOptions

type DescribeBackupPolicyOptions struct {
	Factory cmdutil.Factory

	LabelSelector string
	ClusterNames  []string
	Names         []string

	genericiooptions.IOStreams
	// contains filtered or unexported fields
}

func (*DescribeBackupPolicyOptions) Complete

func (o *DescribeBackupPolicyOptions) Complete() error

func (*DescribeBackupPolicyOptions) Run

func (*DescribeBackupPolicyOptions) Validate

func (o *DescribeBackupPolicyOptions) Validate() error

type LabelOptions

type LabelOptions struct {
	Factory cmdutil.Factory
	GVR     schema.GroupVersionResource

	genericiooptions.IOStreams
	// contains filtered or unexported fields
}

type ListBackupOptions

type ListBackupOptions struct {
	*action.ListOptions
	BackupName string
}

type ListLogsOptions

type ListLogsOptions struct {
	genericiooptions.IOStreams
	// contains filtered or unexported fields
}

ListLogsOptions declares the arguments accepted by the list-logs command

func (*ListLogsOptions) Complete

func (o *ListLogsOptions) Complete(f cmdutil.Factory, args []string) error

func (*ListLogsOptions) Run

func (o *ListLogsOptions) Run() error

func (*ListLogsOptions) Validate

func (o *ListLogsOptions) Validate(args []string) error

type LogsOptions

type LogsOptions struct {
	*action.ExecOptions
	// contains filtered or unexported fields
}

LogsOptions declares the arguments accepted by the logs command

type OperationsOptions

type OperationsOptions struct {
	action.CreateOptions  `json:"-"`
	HasComponentNamesFlag bool `json:"-"`

	ComponentNames         []string `json:"componentNames,omitempty"`
	OpsRequestName         string   `json:"opsRequestName"`
	TTLSecondsAfterSucceed int      `json:"ttlSecondsAfterSucceed"`

	// OpsType operation type
	OpsType appsv1alpha1.OpsType `json:"type"`

	// OpsTypeLower lower OpsType
	OpsTypeLower string `json:"typeLower"`

	// Upgrade options
	ClusterVersionRef string `json:"clusterVersionRef"`

	// VerticalScaling options
	CPU         string                   `json:"cpu"`
	Memory      string                   `json:"memory"`
	Class       string                   `json:"class"`
	ClassDefRef appsv1alpha1.ClassDefRef `json:"classDefRef,omitempty"`

	// HorizontalScaling options
	Replicas int `json:"replicas"`

	// Reconfiguring options
	KeyValues       map[string]*string `json:"keyValues"`
	CfgTemplateName string             `json:"cfgTemplateName"`
	CfgFile         string             `json:"cfgFile"`
	ForceRestart    bool               `json:"forceRestart"`
	FileContent     string             `json:"fileContent"`
	HasPatch        bool               `json:"hasPatch"`

	// VolumeExpansion options.
	// VCTNames VolumeClaimTemplate names
	VCTNames []string `json:"vctNames,omitempty"`
	Storage  string   `json:"storage"`

	// Expose options
	ExposeType    string                                 `json:"-"`
	ExposeEnabled string                                 `json:"-"`
	Services      []appsv1alpha1.ClusterComponentService `json:"services,omitempty"`

	// Switchover options
	Component string `json:"component"`
	Instance  string `json:"instance"`
	// contains filtered or unexported fields
}

func (*OperationsOptions) CompleteComponentsFlag

func (o *OperationsOptions) CompleteComponentsFlag() error

CompleteComponentsFlag when components flag is null and the cluster only has one component, auto complete it.

func (*OperationsOptions) CompleteRestartOps

func (o *OperationsOptions) CompleteRestartOps() error

CompleteRestartOps restarts all components of the cluster we should set all component names to ComponentNames flag.

func (*OperationsOptions) Validate

func (o *OperationsOptions) Validate() error

Validate command flags or args is legal

type UpdatableFlags

type UpdatableFlags struct {
	// Options for cluster termination policy
	TerminationPolicy string `json:"terminationPolicy"`

	// Add-on switches for cluster observability
	MonitoringInterval uint8 `json:"monitor"`
	EnableAllLogs      bool  `json:"enableAllLogs"`

	// Configuration and options for cluster affinity and tolerations
	PodAntiAffinity string `json:"podAntiAffinity"`
	// TopologyKeys if TopologyKeys is nil, add omitempty json tag, because CueLang can not covert null to list.
	TopologyKeys   []string          `json:"topologyKeys,omitempty"`
	NodeLabels     map[string]string `json:"nodeLabels,omitempty"`
	Tenancy        string            `json:"tenancy"`
	TolerationsRaw []string          `json:"-"`

	// backup config
	BackupEnabled                 bool   `json:"-"`
	BackupRetentionPeriod         string `json:"-"`
	BackupMethod                  string `json:"-"`
	BackupCronExpression          string `json:"-"`
	BackupStartingDeadlineMinutes int64  `json:"-"`
	BackupRepoName                string `json:"-"`
	BackupPITREnabled             bool   `json:"-"`
}

UpdatableFlags is the flags that cat be updated by update command

Jump to

Keyboard shortcuts

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