From fb17bd46232538045e498d62ba7f78ed448eb428 Mon Sep 17 00:00:00 2001 From: grego952 Date: Tue, 12 Mar 2024 15:22:09 +0100 Subject: [PATCH 01/10] Apply Markdown linting in the Keda Manager repo --- .markdownlint.json | 26 +++++++++++++++ .markdownlintignore | 3 ++ CONTRIBUTING.md | 2 +- README.md | 5 +-- docs/contributor/01-10-installation.md | 16 ++++++---- docs/contributor/01-20-extend-ui.md | 2 +- docs/contributor/02-10-management.md | 6 ++-- docs/contributor/03-10-scripts-not-working.md | 3 +- docs/contributor/04-10-ci-cd.md | 4 +-- .../contributor/04-20-lifecycle-management.md | 2 +- docs/contributor/04-30-project-structure.md | 4 +-- docs/user/01-20-configuration.md | 4 ++- docs/user/04-10-footprint.md | 3 +- docs/user/04-20-demo-applications.md | 32 +++++++++++-------- docs/user/05-01-conditions.md | 2 +- docs/user/README.md | 7 ++-- examples/scale-to-zero-with-keda/README.md | 28 ++++++++++------ 17 files changed, 100 insertions(+), 49 deletions(-) create mode 100644 .markdownlint.json create mode 100644 .markdownlintignore diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 00000000..32472690 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,26 @@ +{ + "default": true, + "MD013": false, + "MD029": false, + "MD034": false, + "MD044": { + "code_blocks": false, + "html_elements": false, + "names": [ + "Kyma", + "Kubernetes", + "ConfigMap", + "CronJob", + "CustomResourceDefinition", + "Ingress", + "Node", + "PodPreset", + "Pod", + "ProwJob", + "Secret", + "ServiceBinding", + "ServiceClass", + "ServiceInstance" + ] + } +} \ No newline at end of file diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 00000000..17546b3a --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1,3 @@ +.github +_sidebar.md +NOTICE.md \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 71bc0fc6..10c6bcc7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -## Overview +# Overview To contribute to this project, follow the general [contributing](https://github.com/kyma-project/community/blob/main/docs/contributing/02-contributing.md) guidelines. diff --git a/README.md b/README.md index 11768261..b4a02bf4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # Keda Manager ## Status + ![GitHub tag checks state](https://img.shields.io/github/checks-status/kyma-project/keda-manager/main?label=keda-operator&link=https%3A%2F%2Fgithub.com%2Fkyma-project%2Fkeda-manager%2Fcommits%2Fmain) [![REUSE status](https://api.reuse.software/badge/github.com/kyma-project/keda-manager)](https://api.reuse.software/info/github.com/kyma-project/keda-manager) -## Overview +## Overview Keda Manager is an extension to the Kyma runtime. It allows users to install KEDA. It follows the Kubernetes operator pattern to manage the lifecycle of the KEDA installation based on the existence and the content of the dedicated Keda custom resource (CR). @@ -29,7 +30,6 @@ KEDA is a flexible Event Driven Autoscaler for the Kubernetes workloads. It exte ### Procedure - 1. To install KEDA, you must install Keda Manager first. Apply the following script: ```bash @@ -42,6 +42,7 @@ KEDA is a flexible Event Driven Autoscaler for the Kubernetes workloads. It exte ```bash kubectl apply -f https://github.com/kyma-project/keda-manager/releases/latest/download/keda-default-cr.yaml ``` + You should get a result similar to this example: ```bash diff --git a/docs/contributor/01-10-installation.md b/docs/contributor/01-10-installation.md index 9e73e789..1ba5ad8e 100644 --- a/docs/contributor/01-10-installation.md +++ b/docs/contributor/01-10-installation.md @@ -1,15 +1,15 @@ -# Install Keda Manager +# Install Keda Manager - [Install Keda Manager](#install-keda-manager) - - [Install Keda Manager from the local sources](#install-keda-manager-from-the-local-sources) + - [Install Keda Manager From the Local Sources](#install-keda-manager-from-the-local-sources) - [Prerequisites](#prerequisites) - [Procedure](#procedure) - - [Make targets to run Keda Manager locally on k3d](#make-targets-to-run-keda-manager-locally-on-k3d) + - [Make Targets To Run Keda Manager Locally on k3d](#make-targets-to-run-keda-manager-locally-on-k3d) - [Run Keda Manager](#run-keda-manager) Learn how to install the Keda module locally (on k3d) or on your remote cluster. -## Install Keda Manager From the Local Sources +## Install Keda Manager From the Local Sources ### Prerequisites @@ -35,6 +35,7 @@ Run the following commands to deploy Keda Manager in a target Kubernetes cluster 2. Set the Keda Manager image name. > NOTE: You can use the local k3d registry or your Docker Hub account to push intermediate images. + ```bash export IMG=/custom-keda-manager:0.0.2 ``` @@ -44,11 +45,13 @@ Run the following commands to deploy Keda Manager in a target Kubernetes cluster ```bash make test ``` + 4. Build and push the image to the registry. ```bash make module-image ``` + 5. Create a target namespace. ```bash @@ -69,7 +72,7 @@ Run the following commands to deploy Keda Manager in a target Kubernetes cluster You should get a result similar to this example: - ``` + ```bash NAME READY UP-TO-DATE AVAILABLE AGE keda-manager 1/1 1 1 1m ``` @@ -86,10 +89,11 @@ Thanks to that, you don't need to push the Keda module images to a remote regist ```bash git clone https://github.com/kyma-project/keda-manager.git && cd keda-manager/ ``` + 2. Build the manager locally and run it in the k3d cluster. ```bash make -C hack/local run ``` -3. If you want to clean up the k3d cluster, use the `make -C hack/local stop` make target. +3. If you want to clean up the k3d cluster, use the `make -C hack/local stop` make target. diff --git a/docs/contributor/01-20-extend-ui.md b/docs/contributor/01-20-extend-ui.md index 38f72f6f..d38facdf 100644 --- a/docs/contributor/01-20-extend-ui.md +++ b/docs/contributor/01-20-extend-ui.md @@ -3,4 +3,4 @@ Keda Manager is not only an API extension to the Kyma runtime. You can also use it to configure a dedicated UI for your CustomResourceDefinition (CRD). To do that, use the [UI extensibility](https://github.com/kyma-project/busola/tree/main/docs/extensibility) feature of Kyma dashboard. In the [ui-extensions](../../config/ui-extensions/) folder, you can find configuration for the UI components (for example, the `list`, `form`, or `details` views) that allows you to create a dedicated UI page for your Keda CR - `ScaledObjects`. -This configuration is applied as part of the Keda Manager resources. Thanks to that, it comes and goes depending on whether the Keda module is enabled or disabled. \ No newline at end of file +This configuration is applied as part of the Keda Manager resources. Thanks to that, it comes and goes depending on whether the Keda module is enabled or disabled. diff --git a/docs/contributor/02-10-management.md b/docs/contributor/02-10-management.md index 096b32f5..e6e9f583 100644 --- a/docs/contributor/02-10-management.md +++ b/docs/contributor/02-10-management.md @@ -24,6 +24,7 @@ Keda Manager reconciles KEDA deployment based on the watched Keda custom resourc ```bash kubectl delete -f config/samples/keda-default-cr.yaml ``` + This uninstalls all KEDA workloads but leaves Keda Manager. > **NOTE:** Keda Manager uses finalizers to uninstall the Keda module from the cluster. It means that Keda Manager blocks the uninstallation process of KEDA until there are user-created CRs (for example, ScaledObjects). @@ -32,8 +33,7 @@ Keda Manager reconciles KEDA deployment based on the watched Keda custom resourc The [configuration example](../user/01-20-configuration.md) shows how to modify the Keda properties using the `keda.operator.kyma-project.io` CR. - - ```bash + ```bash cat </2 (avg) 1 5 0 27h ``` + 2. List Pods by Function name label and check that you see only the build job's Pod. No runtime Pod is up. + ```bash kubectl get pods -l serverless.kyma-project.io/function-name=scalable-worker-fn -w NAME READY STATUS RESTARTS AGE @@ -78,6 +84,7 @@ The message is pushed to Kyma Eventing. It takes time to scale up a Function from zero. But no message is lost as Eventing retries delivery of the message to the subscriber until a running worker Pod eventually consumes it. 4. Observe worker Function scaling up from zero. You can notice it by watching Function Pods or HPA. + ```bash kubectl get pods -l serverless.kyma-project.io/function-name=scalable-worker-fn -w NAME READY STATUS RESTARTS AGE @@ -90,6 +97,7 @@ scalable-worker-fn-2n269-6f6d5f675-t6nwr 0/2 Init:0/1 0 1s scalable-worker-fn-2n269-6f6d5f675-t6nwr 0/2 PodInitializing 0 2s scalable-worker-fn-2n269-6f6d5f675-t6nwr 0/2 Running 0 7s ``` + ```bash kubectl get hpa -w NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE @@ -111,7 +119,7 @@ Processing ... {"foo":"bar"} ``` - + If the traffic stops, the worker Function is scaled down back to zero replicas (after a configurable cooldown period). - -6. If you generate a much higher load, for example,> 2 req/sec - as configured in the threshold value of the scaledObject, you will observe scaling up to more replicas. One replica must be added for each additional 2req/sec measured. + +6. If you generate a much higher load, for example,> 2 req/sec - as configured in the threshold value of the scaledObject, you will observe scaling up to more replicas. One replica must be added for each additional 2req/sec measured. From f13c0a4f17205f68f6082aa3e98a8f915a25e1f8 Mon Sep 17 00:00:00 2001 From: grego952 Date: Thu, 14 Mar 2024 11:02:25 +0100 Subject: [PATCH 02/10] Change markdowlint format to yaml and add comments --- .markdownlint.json | 26 -------------------------- .markdownlint.yaml | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 26 deletions(-) delete mode 100644 .markdownlint.json create mode 100644 .markdownlint.yaml diff --git a/.markdownlint.json b/.markdownlint.json deleted file mode 100644 index 32472690..00000000 --- a/.markdownlint.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "default": true, - "MD013": false, - "MD029": false, - "MD034": false, - "MD044": { - "code_blocks": false, - "html_elements": false, - "names": [ - "Kyma", - "Kubernetes", - "ConfigMap", - "CronJob", - "CustomResourceDefinition", - "Ingress", - "Node", - "PodPreset", - "Pod", - "ProwJob", - "Secret", - "ServiceBinding", - "ServiceClass", - "ServiceInstance" - ] - } -} \ No newline at end of file diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 00000000..8acab43e --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,24 @@ +# This is a configuration file for the markdownlint. You can use this file to overwrite the default settings. +# MD013 is set to false by default because many files include lines longer than the conventional 80 character limit +MD013: false +# MD029 is set to false because it generated some issues with longer lists +MD029: false +# MD044 is used to set capitalization for the particular words. You can determine whether it should be used also for code blocks and html elements +MD044: + code_blocks: false + html_elements: false + names: + - Kyma + - Kubernetes + - ConfigMap + - CronJob + - CustomResourceDefinition + - Ingress + - Node + - PodPreset + - Pod + - ProwJob + - Secret + - ServiceBinding + - ServiceClass + - ServiceInstance From fa8b484921cc72f3a0c32f5c5fdb870afbebf9bb Mon Sep 17 00:00:00 2001 From: grego952 Date: Mon, 18 Mar 2024 12:36:41 +0100 Subject: [PATCH 03/10] Apply custom capitalize heading rule --- .markdownlint.yaml | 2 ++ docs/user/01-20-configuration.md | 2 +- docs/user/04-20-demo-applications.md | 2 +- heading_uppercase.js | 28 ++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 heading_uppercase.js diff --git a/.markdownlint.yaml b/.markdownlint.yaml index 8acab43e..6321315a 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,6 +1,8 @@ # This is a configuration file for the markdownlint. You can use this file to overwrite the default settings. # MD013 is set to false by default because many files include lines longer than the conventional 80 character limit MD013: false +# Disable the Multiple headings with the same content rule +MD024: false # MD029 is set to false because it generated some issues with longer lists MD029: false # MD044 is used to set capitalization for the particular words. You can determine whether it should be used also for code blocks and html elements diff --git a/docs/user/01-20-configuration.md b/docs/user/01-20-configuration.md index 2295eff0..105e46bd 100644 --- a/docs/user/01-20-configuration.md +++ b/docs/user/01-20-configuration.md @@ -5,7 +5,7 @@ See how to configure the **logging.level** or resource consumption. - To change the logging level, choose one of the accepted values: `debug`, `info`, or `error`. For example: - ```yaml + ```bash spec: logging: operator: diff --git a/docs/user/04-20-demo-applications.md b/docs/user/04-20-demo-applications.md index 89b38e85..78925de7 100644 --- a/docs/user/04-20-demo-applications.md +++ b/docs/user/04-20-demo-applications.md @@ -1,4 +1,4 @@ -# Demo applications +# Demo Application ## Keda CPU Scaler Example diff --git a/heading_uppercase.js b/heading_uppercase.js new file mode 100644 index 00000000..d81b6fd3 --- /dev/null +++ b/heading_uppercase.js @@ -0,0 +1,28 @@ +module.exports = [{ + "names": [ "custom/capitalize-headings" ], + "description": "Heading words longer than 4 characters should be capitalized", + "tags": [ "formatting" ], + "function": function rule(params, onError) { + params.tokens.filter(function filterToken(token) { + return token.type === "heading_open"; + }).forEach(function forToken(heading) { + var headingTokenContent = heading.line.trim(); + var wordsInHeading = headingTokenContent.split(' '); + + for (var i = 0; i < wordsInHeading.length; i++) { + if (wordsInHeading[i].length >= 4 && wordsInHeading[i] && + wordsInHeading[i].charAt(0) !== wordsInHeading[i].charAt(0).toUpperCase()) { + var capitalizedWord = wordsInHeading[i].charAt(0).toUpperCase() + wordsInHeading[i].slice(1); + var detailMessage = "Word " + "'" + wordsInHeading[i] + "'" + " should be changed to " + "'" + capitalizedWord + "'"; + + onError({ + "lineNumber": heading.lineNumber, + "detail": detailMessage, + "context": headingTokenContent, // Show the whole heading as context + "range": [headingTokenContent.indexOf(wordsInHeading[i]), wordsInHeading[i].length] // Underline the word which needs a change + }); + } + } + }); + } +}]; \ No newline at end of file From 60dc8b05409c6f9f9cc5a1941c8d79cd955a0bd5 Mon Sep 17 00:00:00 2001 From: grego952 Date: Mon, 18 Mar 2024 12:37:44 +0100 Subject: [PATCH 04/10] remove markdownlintignore --- .markdownlintignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .markdownlintignore diff --git a/.markdownlintignore b/.markdownlintignore deleted file mode 100644 index 17546b3a..00000000 --- a/.markdownlintignore +++ /dev/null @@ -1,3 +0,0 @@ -.github -_sidebar.md -NOTICE.md \ No newline at end of file From 45d2caa9306ff4ec79a70371e82632c730f6c834 Mon Sep 17 00:00:00 2001 From: grego952 Date: Mon, 18 Mar 2024 12:38:41 +0100 Subject: [PATCH 05/10] change bash to yaml --- docs/user/01-20-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/01-20-configuration.md b/docs/user/01-20-configuration.md index 105e46bd..2295eff0 100644 --- a/docs/user/01-20-configuration.md +++ b/docs/user/01-20-configuration.md @@ -5,7 +5,7 @@ See how to configure the **logging.level** or resource consumption. - To change the logging level, choose one of the accepted values: `debug`, `info`, or `error`. For example: - ```bash + ```yaml spec: logging: operator: From 462ad4c154828686631bea2a2d559f5dbd299646 Mon Sep 17 00:00:00 2001 From: grego952 Date: Mon, 18 Mar 2024 12:40:39 +0100 Subject: [PATCH 06/10] Small fix --- docs/user/04-20-demo-applications.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/04-20-demo-applications.md b/docs/user/04-20-demo-applications.md index 78925de7..fe57877c 100644 --- a/docs/user/04-20-demo-applications.md +++ b/docs/user/04-20-demo-applications.md @@ -1,4 +1,4 @@ -# Demo Application +# Demo Applications ## Keda CPU Scaler Example From b03f88336b45818db35168aaef25c6430299a6d8 Mon Sep 17 00:00:00 2001 From: grego952 Date: Mon, 18 Mar 2024 12:41:36 +0100 Subject: [PATCH 07/10] Small fix --- docs/user/04-20-demo-applications.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/04-20-demo-applications.md b/docs/user/04-20-demo-applications.md index fe57877c..4eff0ec6 100644 --- a/docs/user/04-20-demo-applications.md +++ b/docs/user/04-20-demo-applications.md @@ -8,7 +8,7 @@ This demo application shows how to scale the Kubernetes workloads using KEDA API See the KEDA documentation: -- [API of Scaled Object Custom Resource](https://keda.sh/docs/latest/concepts/scaling-deployments/#scaledobject-spec) +- [API of the ScaledObject custom resource](https://keda.sh/docs/latest/concepts/scaling-deployments/#scaledobject-spec) - [Available scalers](https://keda.sh/docs/latest/scalers/) The KEDA demo application consists of: From 09b9e323d69028f4e5346f401a3f4f88d340b558 Mon Sep 17 00:00:00 2001 From: grego952 Date: Mon, 18 Mar 2024 14:12:28 +0100 Subject: [PATCH 08/10] Change the file name --- heading_uppercase.js => heading_capitalization.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename heading_uppercase.js => heading_capitalization.js (100%) diff --git a/heading_uppercase.js b/heading_capitalization.js similarity index 100% rename from heading_uppercase.js rename to heading_capitalization.js From 51407a5d04e0302dcc5f8790e17d178f7c7aa7e5 Mon Sep 17 00:00:00 2001 From: grego952 Date: Mon, 18 Mar 2024 14:25:51 +0100 Subject: [PATCH 09/10] Change description in capitalization.js and add markdownlintignore --- .markdownlintignore | 1 + heading_capitalization.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 .markdownlintignore diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 00000000..578db9cb --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1 @@ +_sidebar.md \ No newline at end of file diff --git a/heading_capitalization.js b/heading_capitalization.js index d81b6fd3..c3aedd44 100644 --- a/heading_capitalization.js +++ b/heading_capitalization.js @@ -13,7 +13,7 @@ module.exports = [{ if (wordsInHeading[i].length >= 4 && wordsInHeading[i] && wordsInHeading[i].charAt(0) !== wordsInHeading[i].charAt(0).toUpperCase()) { var capitalizedWord = wordsInHeading[i].charAt(0).toUpperCase() + wordsInHeading[i].slice(1); - var detailMessage = "Word " + "'" + wordsInHeading[i] + "'" + " should be changed to " + "'" + capitalizedWord + "'"; + var detailMessage = "Change " + "'" + wordsInHeading[i] + "'" + " to " + "'" + capitalizedWord + "'"; onError({ "lineNumber": heading.lineNumber, From 2b1fc0883858a8d8a31a20939e3f1b1ba9597488 Mon Sep 17 00:00:00 2001 From: grego952 Date: Mon, 18 Mar 2024 15:02:09 +0100 Subject: [PATCH 10/10] Fix the capitalization rule --- heading_capitalization.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heading_capitalization.js b/heading_capitalization.js index c3aedd44..8eb2a5f0 100644 --- a/heading_capitalization.js +++ b/heading_capitalization.js @@ -10,7 +10,7 @@ module.exports = [{ var wordsInHeading = headingTokenContent.split(' '); for (var i = 0; i < wordsInHeading.length; i++) { - if (wordsInHeading[i].length >= 4 && wordsInHeading[i] && + if (wordsInHeading[i].length > 4 && wordsInHeading[i] && wordsInHeading[i].charAt(0) !== wordsInHeading[i].charAt(0).toUpperCase()) { var capitalizedWord = wordsInHeading[i].charAt(0).toUpperCase() + wordsInHeading[i].slice(1); var detailMessage = "Change " + "'" + wordsInHeading[i] + "'" + " to " + "'" + capitalizedWord + "'";