Merge pull request #122 from MaciekPytel/nicer_faq
Divide CA's FAQ TOC to sections
This commit is contained in:
commit
ac6cc9f15f
|
|
@ -2,32 +2,36 @@
|
|||
|
||||
# Table of Contents:
|
||||
<!--- TOC BEGIN -->
|
||||
* [What is Cluster Autoscaler?](#what-is-cluster-autoscaler)
|
||||
* [When does Cluster Autoscaler change the size of a cluster?](#when-does-cluster-autoscaler-change-the-size-of-a-cluster)
|
||||
* [What types of pods can prevent CA from removing a node?](#what-types-of-pods-can-prevent-ca-from-removing-a-node)
|
||||
* [How does Horizontal Pod Autoscaler work with Cluster Autoscaler?](#how-does-horizontal-pod-autoscaler-work-with-cluster-autoscaler)
|
||||
* [What are the key best practices for running Cluster Autoscaler?](#what-are-the-key-best-practices-for-running-cluster-autoscaler)
|
||||
* [Should I use a CPU-usage-based node autoscaler with Kubernetes?](#should-i-use-a-cpuusagebased-node-autoscaler-with-kubernetes)
|
||||
* [How is Cluster Autoscaler different from CPU-usage-based node autoscalers?](#how-is-cluster-autoscaler-different-from-cpuusagebased-node-autoscalers)
|
||||
* [Is Cluster Autoscaler compatible with CPU-usage-based node autoscalers?](#is-cluster-autoscaler-compatible-with-cpuusagebased-node-autoscalers)
|
||||
* [Are all of the mentioned heuristics and timings final?](#are-all-of-the-mentioned-heuristics-and-timings-final)
|
||||
* [How does scale up work?](#how-does-scale-up-work)
|
||||
* [How does scale down work?](#how-does-scale-down-work)
|
||||
* [Does CA work with PodDisruptionBudget in scale down?](#does-ca-work-with-poddisruptionbudget-in-scale-down)
|
||||
* [Does CA respect GracefulTermination in scale down?](#does-ca-respect-gracefultermination-in-scale-down)
|
||||
* [How does CA deal with unready nodes in version <= 0.4.0?](#how-does-ca-deal-with-unready-nodes-in-version--040)
|
||||
* [How does CA deal with unready nodes in version >=0.5.0 ?](#how-does-ca-deal-with-unready-nodes-in-version-050-)
|
||||
* [How fast is Cluster Autoscaler?](#how-fast-is-cluster-autoscaler)
|
||||
* [How fast is HPA when combined with CA?](#how-fast-is-hpa-when-combined-with-ca)
|
||||
* [Where can I find the designs of the upcoming features.](#where-can-i-find-the-designs-of-the-upcoming-features)
|
||||
* [I have a couple of nodes with low utilization, but they are not scaled down. Why?](#i-have-a-couple-of-nodes-with-low-utilization-but-they-are-not-scaled-down-why)
|
||||
* [I have a couple of pending pods, but there was no scale up?](#i-have-a-couple-of-pending-pods-but-there-was-no-scale-up)
|
||||
* [CA doesn’t work but it used to work yesterday. Why?](#ca-doesnt-work-but-it-used-to-work-yesterday-why)
|
||||
* [How can I check what is going on in CA ?](#how-can-i-check-what-is-going-on-in-ca-)
|
||||
* [What events are emitted by CA?](#what-events-are-emitted-by-ca)
|
||||
* [What happens in scale up when I have no more quota in the cloud provider?](#what-happens-in-scale-up-when-i-have-no-more-quota-in-the-cloud-provider)
|
||||
* [How can I run e2e tests?](#how-can-i-run-e2e-tests)
|
||||
* [How should I test my code before submitting PR?](#how-should-i-test-my-code-before-submitting-pr)
|
||||
* [Basics](#basics)
|
||||
* [What is Cluster Autoscaler?](#what-is-cluster-autoscaler)
|
||||
* [When does Cluster Autoscaler change the size of a cluster?](#when-does-cluster-autoscaler-change-the-size-of-a-cluster)
|
||||
* [What types of pods can prevent CA from removing a node?](#what-types-of-pods-can-prevent-ca-from-removing-a-node)
|
||||
* [How does Horizontal Pod Autoscaler work with Cluster Autoscaler?](#how-does-horizontal-pod-autoscaler-work-with-cluster-autoscaler)
|
||||
* [What are the key best practices for running Cluster Autoscaler?](#what-are-the-key-best-practices-for-running-cluster-autoscaler)
|
||||
* [Should I use a CPU-usage-based node autoscaler with Kubernetes?](#should-i-use-a-cpuusagebased-node-autoscaler-with-kubernetes)
|
||||
* [How is Cluster Autoscaler different from CPU-usage-based node autoscalers?](#how-is-cluster-autoscaler-different-from-cpuusagebased-node-autoscalers)
|
||||
* [Is Cluster Autoscaler compatible with CPU-usage-based node autoscalers?](#is-cluster-autoscaler-compatible-with-cpuusagebased-node-autoscalers)
|
||||
* [Internals](#internals)
|
||||
* [Are all of the mentioned heuristics and timings final?](#are-all-of-the-mentioned-heuristics-and-timings-final)
|
||||
* [How does scale up work?](#how-does-scale-up-work)
|
||||
* [How does scale down work?](#how-does-scale-down-work)
|
||||
* [Does CA work with PodDisruptionBudget in scale down?](#does-ca-work-with-poddisruptionbudget-in-scale-down)
|
||||
* [Does CA respect GracefulTermination in scale down?](#does-ca-respect-gracefultermination-in-scale-down)
|
||||
* [How does CA deal with unready nodes in version <= 0.4.0?](#how-does-ca-deal-with-unready-nodes-in-version--040)
|
||||
* [How does CA deal with unready nodes in version >=0.5.0 ?](#how-does-ca-deal-with-unready-nodes-in-version-050-)
|
||||
* [How fast is Cluster Autoscaler?](#how-fast-is-cluster-autoscaler)
|
||||
* [How fast is HPA when combined with CA?](#how-fast-is-hpa-when-combined-with-ca)
|
||||
* [Where can I find the designs of the upcoming features.](#where-can-i-find-the-designs-of-the-upcoming-features)
|
||||
* [Troubleshooting](#troubleshooting)
|
||||
* [I have a couple of nodes with low utilization, but they are not scaled down. Why?](#i-have-a-couple-of-nodes-with-low-utilization-but-they-are-not-scaled-down-why)
|
||||
* [I have a couple of pending pods, but there was no scale up?](#i-have-a-couple-of-pending-pods-but-there-was-no-scale-up)
|
||||
* [CA doesn’t work but it used to work yesterday. Why?](#ca-doesnt-work-but-it-used-to-work-yesterday-why)
|
||||
* [How can I check what is going on in CA ?](#how-can-i-check-what-is-going-on-in-ca-)
|
||||
* [What events are emitted by CA?](#what-events-are-emitted-by-ca)
|
||||
* [What happens in scale up when I have no more quota in the cloud provider?](#what-happens-in-scale-up-when-i-have-no-more-quota-in-the-cloud-provider)
|
||||
* [Developer](#developer)
|
||||
* [How can I run e2e tests?](#how-can-i-run-e2e-tests)
|
||||
* [How should I test my code before submitting PR?](#how-should-i-test-my-code-before-submitting-pr)
|
||||
<!--- TOC END -->
|
||||
|
||||
# Basics
|
||||
|
|
@ -368,3 +372,7 @@ required to activate them:
|
|||
|
||||
We are aware that this process is tedious and we will work to improve it.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,25 +16,40 @@
|
|||
|
||||
import re
|
||||
|
||||
SECTION_PREFIX = "# "
|
||||
QUESTION_PREFIX = "### "
|
||||
|
||||
def updateFAQ():
|
||||
with open("FAQ.md","r") as faq_file:
|
||||
faq_content = faq_file.read()
|
||||
faq_content = faq_file.read()
|
||||
|
||||
question_prefix = "### "
|
||||
questions = [line.strip()[len(question_prefix):].strip() for line in faq_content.split("\n") if line.strip().startswith(question_prefix)]
|
||||
prefixes = (SECTION_PREFIX, QUESTION_PREFIX)
|
||||
toc_elements = []
|
||||
after_toc = False
|
||||
for line in faq_content.splitlines():
|
||||
if line.strip() == "<!--- TOC END -->":
|
||||
after_toc = True
|
||||
if not after_toc:
|
||||
continue
|
||||
for i, pref in enumerate(prefixes):
|
||||
if line.strip().startswith(pref):
|
||||
processed_line = line.strip()[len(pref):].strip()
|
||||
if processed_line[-1] == ':':
|
||||
processed_line = processed_line[:-1]
|
||||
toc_elements.append((processed_line, i))
|
||||
in_toc = False
|
||||
|
||||
with open("FAQ.md","w") as faq_file:
|
||||
for line in faq_content.split("\n"):
|
||||
if line.strip() == "<!--- TOC BEGIN -->":
|
||||
in_toc = True
|
||||
faq_file.write(line +"\n")
|
||||
for question in questions:
|
||||
faq_file.write("* [%s](#%s)\n" % (question, re.sub("[^a-z0-9 ]+", "", question.lower()).replace(" ","-")))
|
||||
if line.strip() == "<!--- TOC END -->":
|
||||
in_toc = False
|
||||
if not in_toc:
|
||||
faq_file.write(line+"\n")
|
||||
for line in faq_content.split("\n"):
|
||||
if line.strip() == "<!--- TOC BEGIN -->":
|
||||
in_toc = True
|
||||
faq_file.write(line +"\n")
|
||||
for question, indent in toc_elements:
|
||||
faq_file.write("%s* [%s](#%s)\n" % (' ' * 2 * indent, question, re.sub("[^a-z0-9 ]+", "", question.lower()).replace(" ","-")))
|
||||
if line.strip() == "<!--- TOC END -->":
|
||||
in_toc = False
|
||||
if not in_toc:
|
||||
faq_file.write(line+"\n")
|
||||
|
||||
if __name__ == '__main__':
|
||||
updateFAQ()
|
||||
|
|
|
|||
Loading…
Reference in New Issue