-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
reconcilePeriod is not honored when installing HorizontalPodAutoscalers #3708
Comments
Hey there, I've taken a look at this and been able to reproduce the behavior. A couple points:
Hopefully this clears it, but I don't think any of the behavior you're seeing is unexpected. |
I think you are wrong here. I'm not questioning the presence of the
Doc is clear enough.
Sure. We can argue there's no bug in the implementation, if we stick to what the doc says. My point remains, the Ansible operator should not obsess over HPAs. The On the other hand, I can't have all my playbooks constantly running. I've been deploying Tekton, KubeVirt, Prometheus, ... using StatefulSets, DaemonSets, Deployments, DeploymentConfigs, Ingress, Routes, ... never seen this, until dealing with HPAs. I can't really ignore this. CPU usage is a mess. There's no global max-workers count. Setting CPU limits on the operator, eventually you'ld see the k8s plugin timing out, and your playbooks randomly failing. |
Have you tried the blacklist feature? https://v0-19-x.sdk.operatorframework.io/docs/ansible/reference/watches/ |
@faust64 The ansible operator sets up watches on all dependent resources that are created by the operator. This is intentional so that when those objects change, we can trigger a re-reconcile. If I'm understanding this correctly, what I think you might want is a way to tell the ansible operator, "When an event arrives that was triggered by a change made by kube-controller-manager, ignore that event." Or maybe "When an event arrives where only specific fields changed, ignore that event". Am I understanding that correctly? Can you tell what change the kube-controller-manager is making to the HPA that is causing an event to occur? |
@joelanford this is correct. I think the blacklist feature @asmacdo mentioned might just do it. I'll try it out, thanks! |
I don't think the blacklist thing works .... Or I'm doing it wrong. After patching my watches.yaml, adding the following block to all my CRs:
Then re-enabling HPAs configurations by my operator, I'm back with those playbooks constantly restarting:
|
. allright, works fine with:
my bad. It's not perfect, as manual deletions won't trigger a new reconcile. But in may case, that's good enough. |
Bug Report
What did you do?
I'm trying to have some Ansible operator install an HPA alongside my deployments.
Overall it works fine. Although as I've been looking at metrics exported by my operator, I realized any playbook I have, where those HPA configuration is enabled, would be running on a loop - as if some object got changed, either manually or during the last playbook run.
I could confirm that when HPAs configuration is disabled, the same playbooks would only apply once every
reconcilePeriod
, as defined in my watches.yaml.When managing HPAs, my operator would create the following object, using the
k8s
plugin:The operator would not update that object, unless its spec actually needs to be changed - so once done with the first run, creating HPAs, I would see the operator skipping any step creating or patching HPAs.
In the end, the operator did not apply anything, yet that playbook is always running.
As far as I understand, it has to do with HPAs being regularly updated by a controller. This somehow triggers a new run of Ansible, while in that specific case, this really isn't necessary.
If I dump that object, I can see, among others, who last updated it:
The managedFields array mentions, in addition to the
Swagger-Codegen
edit, one made by somekube-controller-manager
, whosetime
frequently changes matching current date.What did you expect to see?
I would expect the
reconcilePeriod
defined in my watches.yaml to be observed, regardless of my operator managing HPAs or not.What did you see instead? Under which circumstances?
When installing HPAs,
reconcilePeriod
is "ignored", as some controller constantly updates HPA - child resources of objets being watched by my operator.Environment
operator-sdk version: 0.19.2
go version: (whichever ships in that image)
Kubernetes version information:
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:43:34Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
vanilla / kube-spray, calico, containerd
Ansible
The text was updated successfully, but these errors were encountered: