-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scale down observer #174
scale down observer #174
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
not close pvc resource |
api/doris/v1/types.go
Outdated
|
||
const ( | ||
PHASE_INITIALIZING Phase = "initializing" | ||
PHASE_OPERABLE Phase = "operable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not phase name as operable
api/doris/v1/types.go
Outdated
@@ -386,6 +419,7 @@ const ( | |||
// +kubebuilder:subresource:status | |||
// +kubebuilder:resource:shortName=dcr | |||
// +kubebuilder:subresource:status | |||
// +kubebuilder:printcolumn:name="ClusterPhase",type=string,JSONPath=`.status.clusterPhase.phase` | |||
// +kubebuilder:printcolumn:name="FeStatus",type=string,JSONPath=`.status.feStatus.componentCondition.phase` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed.
pkg/common/utils/k8s/client.go
Outdated
return &svc, nil | ||
} | ||
|
||
func GetPods(ctx context.Context, k8sclient client.Client, targetDCR dorisv1.DorisCluster) (corev1.PodList, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetPods is a common function, so why use fe filter in the function?
pkg/common/utils/k8s/client.go
Outdated
} | ||
|
||
for _, pod := range pods.Items { | ||
fmt.Printf("pod --- Name: %s, pod: %s \n", pod.GetName(), pod.Status.PodIP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this log format should not appear.
} | ||
|
||
// recycleBEResources pvc resource for be recycle | ||
func (d *SubDefaultController) recycleBEResources(ctx context.Context, dcr *dorisv1.DorisCluster) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is very very dangerous!!!!!! I have told you don't clear be resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
return err | ||
} | ||
if scaleNumber != -1 { | ||
klog.Info("controlClusterPhaseAndPreOperation scale down observer task is not completed, %d tasks are left. ", -scaleNumber-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
出现了负号?????
var mergeError error | ||
for ; baseOrdinal > int(replicas); baseOrdinal-- { | ||
pvc := resource.BuildPVC(volume, selector, dcr.Namespace, stsName, strconv.Itoa(baseOrdinal-1)) | ||
if err := k8s.DeletePVC(ctx, d.K8sclient, dcr.Namespace, pvc.Name); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not right, first get next delete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check
} | ||
|
||
// sort fe by index and return top scaleNumber | ||
func getTopFrontends(frontendMap map[int]*mysql.Frontend, scaleNumber int32) []*mysql.Frontend { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findNeedDeleteFrontends
} | ||
|
||
// deletePVCs will Loop to remove excess pvc | ||
func (d *SubDefaultController) deletePVCs(ctx context.Context, dcr *dorisv1.DorisCluster, selector map[string]string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where used pvcs?
api/doris/v1/types.go
Outdated
Phase Phase `json:"phase,omitempty"` | ||
|
||
// describe change status task of the doris cluster need retry | ||
Retry RetrySign `json:"retry,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cluster spec =每一个服务的spec,每一个pod的状态满足预期。
return errors.New(fmt.Sprintf("There is a conflict in crd operation. currently, cluster Phase is %+v ", phase.Phase)) | ||
} | ||
|
||
if phase.Phase == v1.PHASE_OPERABLE || phase.Retry == v1.RETRY_OPERATOR_FE { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
statefulset的pod的数量和所有pod的状态。
) | ||
|
||
// ControlClusterPhaseAndPreOperation means Pre-operation and status control on the client side | ||
func (fc *Controller) controlClusterPhaseAndPreOperation(ctx context.Context, cluster *v1.DorisCluster) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
判断是否可以执行 缩容
- statefulset的replicas 和 pod 数量。
- 所有pod的状态。
switch componentType { | ||
case dorisv1.Component_FE: | ||
return d.recycleFEResources(ctx, dcr) | ||
case dorisv1.Component_BE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case fe:
xxxx
default:
return
No description provided.