Skip to content

Commit

Permalink
chore: update the group of the ops to "operations" (#8162)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei authored Sep 20, 2024
1 parent 2fb045e commit 749cb70
Show file tree
Hide file tree
Showing 137 changed files with 9,327 additions and 13,607 deletions.
38 changes: 17 additions & 21 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: kubeblocks.io
layout:
- go.kubebuilder.io/v3
Expand Down Expand Up @@ -93,15 +89,6 @@ resources:
kind: BackupPolicyTemplate
path: github.com/apecloud/kubeblocks/apis/apps/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: kubeblocks.io
group: apps
kind: OpsRequest
path: github.com/apecloud/kubeblocks/apis/apps/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
Expand Down Expand Up @@ -249,14 +236,6 @@ resources:
webhooks:
conversion: true
webhookVersion: v1
- api:
crdVersion: v1
controller: true
domain: kubeblocks.io
group: apps
kind: OpsDefinition
path: github.com/apecloud/kubeblocks/apis/apps/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
Expand Down Expand Up @@ -300,4 +279,21 @@ resources:
kind: NodeCountScaler
path: github.com/apecloud/kubeblocks/apis/experimental/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: kubeblocks.io
controller: true
group: operations
kind: OpsRequest
path: github.com/apecloud/kubeblocks/apis/operations/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
domain: kubeblocks.io
group: operations
kind: OpsDefinition
path: github.com/apecloud/kubeblocks/apis/apps/v1alpha1
version: v1alpha1
version: "3"
131 changes: 24 additions & 107 deletions apis/apps/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr"

kbappsv1 "github.com/apecloud/kubeblocks/apis/apps/v1"
)

const (
APIVersion = "apps.kubeblocks.io/v1alpha1"
ClusterDefinitionKind = "ClusterDefinition"
ClusterKind = "Cluster"
ComponentKind = "Component"
OpsRequestKind = "OpsRequestKind"

defaultInstanceTemplateReplicas = 1
)
Expand Down Expand Up @@ -325,32 +322,6 @@ const (
UnavailablePhase Phase = "Unavailable"
)

// OpsPhase defines opsRequest phase.
// +enum
// +kubebuilder:validation:Enum={Pending,Creating,Running,Cancelling,Cancelled,Aborted,Failed,Succeed}
type OpsPhase string

const (
OpsPendingPhase OpsPhase = "Pending"
OpsCreatingPhase OpsPhase = "Creating"
OpsRunningPhase OpsPhase = "Running"
OpsCancellingPhase OpsPhase = "Cancelling"
OpsSucceedPhase OpsPhase = "Succeed"
OpsCancelledPhase OpsPhase = "Cancelled"
OpsFailedPhase OpsPhase = "Failed"
OpsAbortedPhase OpsPhase = "Aborted"
)

// PodSelectionPolicy pod selection strategy.
// +enum
// +kubebuilder:validation:Enum={All,Any}
type PodSelectionPolicy string

const (
All PodSelectionPolicy = "All"
Any PodSelectionPolicy = "Any"
)

// PodAvailabilityPolicy pod availability strategy.
// +enum
// +kubebuilder:validation:Enum={Available,PreferredAvailable,None}
Expand All @@ -362,45 +333,6 @@ const (
NoneAvailabilityPolicy PodAvailabilityPolicy = "None"
)

// OpsWorkloadType policy after action failure.
// +enum
// +kubebuilder:validation:Enum={Job,Pod}
type OpsWorkloadType string

const (
PodWorkload OpsWorkloadType = "Pod"
JobWorkload OpsWorkloadType = "Job"
)

// OpsType defines operation types.
// +enum
// +kubebuilder:validation:Enum={Upgrade,VerticalScaling,VolumeExpansion,HorizontalScaling,Restart,Reconfiguring,Start,Stop,Expose,Switchover,Backup,Restore,RebuildInstance,Custom}
type OpsType string

const (
VerticalScalingType OpsType = "VerticalScaling"
HorizontalScalingType OpsType = "HorizontalScaling"
VolumeExpansionType OpsType = "VolumeExpansion"
UpgradeType OpsType = "Upgrade"
ReconfiguringType OpsType = "Reconfiguring"
SwitchoverType OpsType = "Switchover"
RestartType OpsType = "Restart" // RestartType the restart operation is a special case of the rolling update operation.
StopType OpsType = "Stop" // StopType the stop operation will delete all pods in a cluster concurrently.
StartType OpsType = "Start" // StartType the start operation will start the pods which is deleted in stop operation.
ExposeType OpsType = "Expose"
BackupType OpsType = "Backup"
RestoreType OpsType = "Restore"
RebuildInstanceType OpsType = "RebuildInstance" // RebuildInstance rebuilding an instance is very useful when a node is offline or an instance is unrecoverable.
CustomType OpsType = "Custom" // use opsDefinition
)

// ComponentResourceKey defines the resource key of component, such as pod/pvc.
// +enum
// +kubebuilder:validation:Enum={pods}
type ComponentResourceKey string

const PodsCompResourceKey ComponentResourceKey = "pods"

// AccessMode defines the modes of access granted to the SVC.
// The modes can be `None`, `Readonly`, or `ReadWrite`.
//
Expand Down Expand Up @@ -548,45 +480,6 @@ const (
AvailabilityPolicyNone AvailabilityPolicyType = "none"
)

// ProgressStatus defines the status of the opsRequest progress.
// +enum
// +kubebuilder:validation:Enum={Processing,Pending,Failed,Succeed}
type ProgressStatus string

const (
PendingProgressStatus ProgressStatus = "Pending"
ProcessingProgressStatus ProgressStatus = "Processing"
FailedProgressStatus ProgressStatus = "Failed"
SucceedProgressStatus ProgressStatus = "Succeed"
)

// ActionTaskStatus defines the status of the task.
// +enum
// +kubebuilder:validation:Enum={Processing,Failed,Succeed}
type ActionTaskStatus string

const (
ProcessingActionTaskStatus ActionTaskStatus = "Processing"
FailedActionTaskStatus ActionTaskStatus = "Failed"
SucceedActionTaskStatus ActionTaskStatus = "Succeed"
)

type OpsRequestBehaviour struct {
FromClusterPhases []kbappsv1.ClusterPhase
ToClusterPhase kbappsv1.ClusterPhase
}

type OpsRecorder struct {
// name OpsRequest name
Name string `json:"name"`
// opsRequest type
Type OpsType `json:"type"`
// indicates whether the current opsRequest is in the queue
InQueue bool `json:"inQueue,omitempty"`
// indicates that the operation is queued for execution within its own-type scope.
QueueBySelf bool `json:"queueBySelf,omitempty"`
}

// LetterCase defines the available cases to be used in password generation.
//
// +enum
Expand Down Expand Up @@ -1176,3 +1069,27 @@ const (
HTTPProtocol PrometheusScheme = "http"
HTTPSProtocol PrometheusScheme = "https"
)

// FailurePolicyType specifies the type of failure policy.
//
// +enum
// +kubebuilder:validation:Enum={Ignore,Fail}
type FailurePolicyType string

const (
// FailurePolicyIgnore means that an error will be ignored but logged.
FailurePolicyIgnore FailurePolicyType = "Ignore"
// FailurePolicyFail means that an error will be reported.
FailurePolicyFail FailurePolicyType = "Fail"
)

const (
ReasonReconfigurePersisting = "ReconfigurePersisting"
ReasonReconfigurePersisted = "ReconfigurePersisted"
ReasonReconfigureFailed = "ReconfigureFailed"
ReasonReconfigureRestartFailed = "ReconfigureRestartFailed"
ReasonReconfigureRestart = "ReconfigureRestarted"
ReasonReconfigureNoChanged = "ReconfigureNoChanged"
ReasonReconfigureSucceed = "ReconfigureSucceed"
ReasonReconfigureRunning = "ReconfigureRunning"
)
Loading

0 comments on commit 749cb70

Please sign in to comment.