-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[WIP] DNS nanny - Autoscale replication controller based on number of nodes #1427
Conversation
917d8c9
to
cd4c32b
Compare
@Q-Lee since you wrote the addon-resizer can you take a look at this? |
I think the failsafe checks need a little change, instead of continuing with the old params, I think it will be more correct that if we fail to parse the config, we log.Fatal and just bail out of the container. |
862276c
to
a17f110
Compare
Why aren't we using |
If we decide to write something new, please don't use a generic name like |
The existing addon-resizer works so differently - it doesn't resize replicas, but rather the cpu and memory limits of the pod itself and it works on pods and deployments, not on RCs - that it would have been pretty much two different functionalities in the same binary with more complicated flags than to make a new one for DNS RC replica resizing. I will change the name to be DNS specific (although the new one is written as a generic sidecar container that can resize any RC it belongs to, so it can be dropped into any RC and it will auto-scale it based on the configmap params) |
0dc925c
to
fc7f812
Compare
# pod-autoscaler | ||
|
||
This container image watches over the number of schedulable nodes in the cluster and resizes | ||
the number of replicas in its parent object. Works only for pods which are children of RCs or RSs objects. |
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.
a short explanation of HOW would be good.
You're going to have to break this into multiple commits. One for your As a name, can I propose "horizontal-self-scaler" ? On Wed, Jul 27, 2016 at 10:05 AM, Girish Kalele [email protected]
|
// "resourceVersion":"20339"}} | ||
// | ||
|
||
func (k *kubernetesClient) GetParentRc(namespace, podname string) (string, 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.
General note: if you give a function a public name (leading capital letter) you had better have a GoDoc comment explaining it. Given that this is all one package (which is fine) I doubt this needs a public name. Same elsewhere.
log.Fatal(err) | ||
} | ||
k8s := nanny.NewKubernetesClient(*podNamespace, *podName, clientset) | ||
log.Printf("Looking for parent/owner of pod %s/%s\n", *podNamespace, *podName) |
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.
Is there a log.Infof?
Will do...I am in the process of moving it to a new repo, will send out the PR for that one. |
func (s Scaler) scaleWithNodes(numCurrentNodes uint64) uint64 { | ||
newMap, err := ParseScalerParamsFile(s.ConfigFile) | ||
if err != nil { | ||
log.Fatalf("Parse failure: The configmap volume file is malformed (%s)\n", err) |
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.
Can you validate this at start up?
@mml this PR is trying to solve a problem that you have thought about: given a pod, find its controller (you in the context of disruption budget). You might have useful comments. |
@bgrant0607 said not to use |
The addon-resizer was written with the intent to be extended in this fashion if the use case ever arose. It should be straight forward to extend it in this fashion. |
I'm not a fan of doing this from every DNS pod in the cluster. |
We hope owner references will be in beta and on-by-default in 1.4 but it's not certain at this point. |
I created kubernetes/kubernetes#29922 to request addition of the Created-By annotation to ReplicaSets but we can close that if the OwnerReferences will work for going from ReplicaSet -> parent Deployments. |
Have a simpler solution? On Tue, Aug 2, 2016 at 3:46 PM, Daniel Smith [email protected]
|
Run one sizing thing on the master node. Alternatively, run one of these On Tue, Aug 2, 2016 at 4:31 PM, Tim Hockin [email protected] wrote:
|
There should be no assumptions in the code that this container must scale its own pod. Inferring defaults is fine, but I need to be able to explicitly override that behavior. And if owner references are not a sure thing for 1.4, then we may consider dropping the inference altogether in this release. @thockin - I think dan has a good point. If we extend the addon-resizer to another type of scaling, then we could also change it to scale multiple pods. Then it can consume a yaml object per scale, and a single pod could watch all of our addons. The only down side is that this pod would require a deployment every time an addon is enabled or disabled. |
I figured running as a sidecar was cute, but I guess it could just be a What do you think Girish? For the sake of simplicity, do we really want to jam this together with the On Tue, Aug 2, 2016 at 5:53 PM, Q-Lee [email protected] wrote:
|
@thockin That works too - we can add another RC that provides one replica of the horizontal resizer and point it towards the rc/deployment it should be scaling. The addon-resizer scales the fluentd pod vertically and the DNS use-case is horizontal scaling. My first look at it, I figured combining them would make it overly complex for a single component, and would be better as two independent modules. |
I'd say - IF we want to combine them, we do it later. Let's get something On Tue, Aug 2, 2016 at 9:48 PM, Girish Kalele [email protected]
|
To summarize a few of the points:
|
Moved out of contrib repo. |
Adaption of the addon-resizer nanny worked out pretty well.