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
[CN-1029] Add support for scale subresource #941
[CN-1029] Add support for scale subresource #941
Conversation
a15310c
to
8ec69b1
Compare
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.
LGTM 👍
) | ||
} | ||
|
||
if ok, err := util.CheckIfRunning(ctx, r.Client, &statefulSet, *h.Spec.ClusterSize); !ok { | ||
if 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.
better to simplify this condition
if err == nil {
return ...
}else{
return ...
}
into this
if err != nil {
return ...
}
return ...
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.
It is not advised to to that:
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.
Yes, that is why I suggested.
That is the part of code that I pointed.
if err==nil{
return r.update(ctx, h, recoptions.RetryAfter(retryAfter),
withHzPhase(hazelcastv1alpha1.Pending),
r.withMemberStatuses(ctx, h, err),
withHzStatefulSet(statefulSet),
)
} else {
return r.update(ctx, h, recoptions.Error(err),
withHzFailedPhase(err.Error()),
r.withMemberStatuses(ctx, h, err),
withHzStatefulSet(statefulSet),
)
}
Description
Add support for scale subresource. Users will be able to use
kubectl scale
withhazelcast
resource. In addition we setselectorpath
argument pointed to the string form of a label selector, so the HorizontalPodAutoscaler will be able to autoscale our clusters resource.We will later need to update controller-runtime to 0.14 to be able to test it in our e2e and/or integration tests: kubernetes-sigs/controller-runtime#2072
User Impact
User can now use
scale
sub-command to control cluster size: