Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

adding scale subresource so that HPA can be used with the cluster #394

Closed

Conversation

Padarn
Copy link

@Padarn Padarn commented Jan 17, 2021

WIP - addresses #389

@functicons functicons self-requested a review January 19, 2021 08:01
@functicons
Copy link
Collaborator

/gcbrun

@functicons
Copy link
Collaborator

/gcbrun

Copy link
Collaborator

@functicons functicons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Could you update the user guide, adding a section on how to use this feature?

@@ -412,6 +412,18 @@ type JobSpec struct {
SecurityContext *corev1.PodSecurityContext `json:"securityContext,omitempty"`
}

// HPASpec defines properties of a HPA for the cluster.
type HPASpec struct {
// Taskmanager lower limit for the number of pods.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to define the default value for optional fields.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D you mean a default value for the HPASpec or for the struct fields?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the fields, e.g., if the user doesn't specify the value, what is the default value / behavior?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 got it

@@ -519,7 +534,10 @@ type FlinkClusterComponentsStatus struct {
JobManagerIngress *JobManagerIngressStatus `json:"jobManagerIngress,omitempty"`

// The state of TaskManager StatefulSet.
TaskManagerStatefulSet FlinkClusterComponentState `json:"taskManagerStatefulSet"`
TaskManagerStatefulSet TaskManagerStatefulSetStatus `json:"taskManagerStatefulSet"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

MaxReplicas int32 `json:"maxReplicas"`

// Taskmanager target average CPU utilization
TargetCPUUtilizationPercentage *int32 `json:"targetCPUUtilizationPercentage,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "Percentage" seems to be unnecessary, can we remove it here and below?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly agree, but it does disambiguate whether is a percentage, proportion or even absolute value. It also matches the autoscaling k8s api.

@@ -103,6 +104,11 @@ func (reconciler *ClusterReconciler) reconcile() (ctrl.Result, error) {
return ctrl.Result{}, err
}

err = reconciler.reconcileHPA()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put HPA at the end? because if it fails, other reconciliation can be done unaffected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, changing this

}
return nil
}
reconciler.log.Info("JobManager ingress already exists, no action")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong log message.

if err != nil {
log.Error(err, "Failed to delete HPA")
} else {
log.Info("Ingress HPA")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong log message "Ingress".

@Padarn
Copy link
Author

Padarn commented Feb 12, 2021

Thank for the review @functicons. Yep if we're happy with the approach I'll modify the user guide and see if I can put some tests together 👍

@functicons
Copy link
Collaborator

@Padarn go ahead, thanks!

@Padarn
Copy link
Author

Padarn commented Feb 13, 2021

@functicons while I was working on this I realised something (I should have seen this before): We will also need to scale the jobs parallelism for it to be useful.

This gets a bit confusing because parallelism doesn't make sense unless you are using a job right now. I'd suggest for this version:

  • HPA required you to be using job mode
  • HPA will make you set parallelism per task manager

this feels a bit ugly, but without deeper thought, I'm not sure how it would be best to work. Thouhts?

@functicons
Copy link
Collaborator

@Padarn parallelism per task manager sounds like a good idea, I don't feel it is ugly, we just need to document it well.

@Padarn
Copy link
Author

Padarn commented Feb 28, 2021

after battling with this for some time, I realised it was simpler to separate this PR between the HPA and the scale subresource

I've made a new PR here: #425

@Padarn Padarn closed this Feb 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants