From 721a46eb7347a8558f4ecdefc16d1f822dc1dbaf Mon Sep 17 00:00:00 2001 From: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> Date: Fri, 6 Sep 2024 05:14:16 -0700 Subject: [PATCH] Read config file from absolute and relative references (#111) * Read file from absolute and relative references Signed-off-by: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> * Add tests Signed-off-by: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> * Bump versions Signed-off-by: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> * Fix lint Signed-off-by: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> --------- Signed-off-by: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> --- index.js | 8 +- package-lock.json | 2 +- package.json | 2 +- tests/basic.test.js | 16 ++ tests/expected-readme.config.md | 305 ++++++++++++++++++++++++++++++++ tests/test-config.json | 24 +++ tests/test-readme.config.md | 305 ++++++++++++++++++++++++++++++++ 7 files changed, 654 insertions(+), 8 deletions(-) create mode 100644 tests/expected-readme.config.md create mode 100644 tests/test-config.json create mode 100644 tests/test-readme.config.md diff --git a/index.js b/index.js index c583f82..8c2822a 100644 --- a/index.js +++ b/index.js @@ -14,11 +14,7 @@ const { checkKeys } = require('./lib/checker'); const { combineMetadataAndValues, buildParamsToRenderList } = require('./lib/builder'); const { insertReadmeTable, renderOpenAPISchema } = require('./lib/render'); -function getParsedMetadata(options) { - const valuesFilePath = options.values; - const configPath = options.config ? options.config : `${__dirname}/config.json`; - const config = require(configPath); - +function getParsedMetadata(valuesFilePath, config) { const valuesObject = createValuesObject(valuesFilePath); const valuesMetadata = parseMetadataComments(valuesFilePath, config); @@ -49,7 +45,7 @@ function runReadmeGenerator(options) { } const configPath = options.config ? options.config : `${__dirname}/config.json`; const config = JSON.parse(fs.readFileSync(configPath)); - const parsedMetadata = getParsedMetadata(options); + const parsedMetadata = getParsedMetadata(options.values, config); if (readmeFilePath) { /* eslint no-param-reassign: ["error", { "props": false }] */ diff --git a/package-lock.json b/package-lock.json index e48f8ec..37cc3ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@bitnami/readme-generator-for-helm", - "version": "2.6.1", + "version": "2.6.2", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index cf86cbc..7bdc647 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bitnami/readme-generator-for-helm", - "version": "2.6.1", + "version": "2.6.2", "description": "Autogenerate READMEs tables and OpenAPI schemas for Helm Charts", "main": "index.js", "scripts": { diff --git a/tests/basic.test.js b/tests/basic.test.js index 4cb175c..331ac78 100644 --- a/tests/basic.test.js +++ b/tests/basic.test.js @@ -12,6 +12,9 @@ const testReadmeLastSectionWithTextBelowPath = `${__dirname}/test-readme.last-se const expectedReadmeLastSectionWithTextBelowPath = `${__dirname}/expected-readme.last-section-text-below.md`; // File that must result from executing the tool providing the test README and values const testSchemaPath = `${__dirname}/test-schema.json`; // File where the content will end after the tool is executed const expectedSchemaPath = `${__dirname}/expected-schema.json`; // File that must result from executing the tool providing the test README and values +const testReadConfigFile = `${__dirname}/test-readme.config.md`; // Configuration file +const testConfigFile = `${__dirname}/test-config.json`; // Configuration file +const expectedReadmeConfig = `${__dirname}/expected-readme.config.md`; // File where the content will end after the tool is executed const { runReadmeGenerator } = require('../index.js'); @@ -79,3 +82,16 @@ test('Check schema', () => { // Check the output is the expected one expect(fs.readFileSync(testSchemaPath)).toEqual(fs.readFileSync(expectedSchemaPath)); }); + +test('Check config file', () => { + // Run readme generator with the test files + const options = { + readme: testReadConfigFile, + values: testValuesPath, + config: testConfigFile, + }; + runReadmeGenerator(options); + + // Check the output is the expected one + expect(fs.readFileSync(testReadConfigFile)).toEqual(fs.readFileSync(expectedReadmeConfig)); +}); diff --git a/tests/expected-readme.config.md b/tests/expected-readme.config.md new file mode 100644 index 0000000..acefad2 --- /dev/null +++ b/tests/expected-readme.config.md @@ -0,0 +1,305 @@ +# kubewatch + +[kubewatch](https://github.com/bitnami-labs/kubewatch) is a Kubernetes watcher that currently publishes notification to Slack. Run it in your k8s cluster, and you will get event notifications in a slack channel. + +## TL;DR + +```console +helm repo add bitnami https://charts.bitnami.com/bitnami +helm install my-release bitnami/kubewatch +``` + +## Introduction + +This chart bootstraps a kubewatch deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.12+ +- Helm 3.1.0 + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +helm install my-release bitnami/kubewatch +``` + +The command deploys kubewatch on the Kubernetes cluster in the default configuration. The [Parameters](#new-parameters-section) section lists the parameters that can be configured during installation. + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## New Parameters Section + +### Global parameters + +| Name | Description | Value | +| ------------------------- | ----------------------------------------------- | ----- | +| `global.imageRegistry` | Global Docker image registry | `""` | +| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` | + +### Common parameters + +This section contains parameters common to most of the Helm Charts in the wild +as they are mainly auto-generated by initializing a new Helm Chart directory. + +It even supports multiple lines and [Link parsing](#common-parameters). + +| Name | Description | Value | +| ------------------- | -------------------------------------------------- | ----- | +| `nameOverride` | String to partially override common.names.fullname | `""` | +| `fullnameOverride` | String to fully override common.names.fullname | `""` | +| `commonLabels` | Labels to add to all deployed objects | `{}` | +| `commonAnnotations` | Annotations to add to all deployed objects | `{}` | +| `extraDeploy` | Array of extra objects to deploy with the release | `[]` | +| `hostAliases` | Add deployment host aliases | `[]` | + +### Kubewatch parameters + +This description starts in a new line instead of the same line of description start tag. It does not have multiple lines. + +| Name | Description | Value | +| ---------------------------------------- | --------------------------------------------------- | --------------------------- | +| `image.registry` | Kubewatch image registry | `REGISTRY_NAME` | +| `image.repository` | Kubewatch image name | `REPOSITORY_NAME/kubewatch` | +| `image.pullPolicy` | Kubewatch image pull policy | `IfNotPresent` | +| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` | +| `slack.enabled` | Enable Slack notifications | `true` | +| `slack.channel` | Slack channel to notify | `XXXX` | +| `slack.token` | Slack API token | `XXXX` | +| `hipchat.enabled` | Enable HipChat notifications | `false` | +| `hipchat.room` | HipChat room to notify | `""` | +| `hipchat.token` | HipChat token | `""` | +| `hipchat.url` | HipChat URL | `""` | +| `mattermost.enabled` | Enable Mattermost notifications | `false` | +| `mattermost.channel` | Mattermost channel to notify | `""` | +| `mattermost.username` | Mattermost user to notify | `""` | +| `mattermost.url` | Mattermost URL | `""` | +| `flock.enabled` | Enable Flock notifications | `false` | +| `flock.url` | Flock URL | `""` | +| `msteams.enabled` | Enable Microsoft Teams notifications | `false` | +| `msteams.webhookurl` | Microsoft Teams webhook URL | `""` | +| `webhook` | Enable Webhook notifications | `{}` | +| `smtp.enabled` | Enable SMTP (email) notifications | `false` | +| `smtp.to` | Destination email address (required) | `""` | +| `smtp.from` | Source email address (required) | `""` | +| `smtp.hello` | SMTP hello field (optional) | `""` | +| `smtp.smarthost` | SMTP server address (name:port) (required) | `""` | +| `smtp.subject` | SMTP subject for the email | `""` | +| `smtp.requireTLS` | Force STARTTLS | `false` | +| `smtp.auth.username` | Username for LOGIN and PLAIN auth mech | `""` | +| `smtp.auth.password` | Password for LOGIN and PLAIN auth mech | `""` | +| `smtp.auth.secret` | Secret for CRAM-MD5 auth mech | `""` | +| `smtp.auth.identity` | Identity for PLAIN auth mech | `""` | +| `namespaceToWatch` | Namespace to watch, leave it empty for watching all | `""` | +| `resourcesToWatch.pod` | Watch changes to Pods | `true` | +| `resourcesToWatch.deployment` | Watch changes to Deployments | `true` | +| `resourcesToWatch.replicationcontroller` | Watch changes to ReplicationControllers | `false` | +| `resourcesToWatch.replicaset` | Watch changes to ReplicaSets | `false` | +| `resourcesToWatch.daemonset` | Watch changes to DaemonSets | `false` | +| `resourcesToWatch.services` | Watch changes to Services | `false` | +| `resourcesToWatch.job` | Watch changes to Jobs | `false` | +| `resourcesToWatch.persistentvolume` | Watch changes to PersistentVolumes | `false` | + +### Deployment parameters + +| Name | Description | Value | +| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------ | +| `command` | Override default container command (useful when using custom images) | `[]` | +| `args` | Override default container args (useful when using custom images) | `[]` | +| `extraEnvVars[0].name` | Name of the env var | `FOO` | +| `extraEnvVars[0].value` | Value for the env var | `bar` | +| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `""` | +| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars | `""` | +| `replicaCount` | Number of Kubewatch replicas to deploy | `1` | +| `podSecurityContext.enabled` | Enabled Kubewatch pods' Security Context | `false` | +| `podSecurityContext.fsGroup` | Set Kubewatch pod's Security Context fsGroup | `1001` | +| `containerSecurityContext.enabled` | Enabled Kubewatch containers' Security Context | `false` | +| `containerSecurityContext.runAsUser` | Set Kubewatch container's Security Context runAsUser | `1001` | +| `containerSecurityContext.runAsNonRoot` | Set Kubewatch container's Security Context runAsNonRoot | `true` | +| `livenessProbe.enabled` | Enable livenessProbe | `false` | +| `livenessProbe.initialDelaySeconds` | Initial delay seconds for livenessProbe | `10` | +| `livenessProbe.periodSeconds` | Period seconds for livenessProbe | `10` | +| `livenessProbe.timeoutSeconds` | Timeout seconds for livenessProbe | `1` | +| `livenessProbe.failureThreshold` | Failure threshold for livenessProbe | `3` | +| `livenessProbe.successThreshold` | Success threshold for livenessProbe | `1` | +| `readinessProbe.enabled` | Enable readinessProbe | `false` | +| `readinessProbe.initialDelaySeconds` | Initial delay seconds for readinessProbe | `10` | +| `readinessProbe.periodSeconds` | Period seconds for readinessProbe | `10` | +| `readinessProbe.timeoutSeconds` | Timeout seconds for readinessProbe | `1` | +| `readinessProbe.failureThreshold` | Failure threshold for readinessProbe | `3` | +| `readinessProbe.successThreshold` | Success threshold for readinessProbe | `1` | +| `customLivenessProbe` | Override default liveness probe | `{}` | +| `customReadinessProbe` | Override default readiness probe | `{}` | +| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` | +| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `nodeAffinityPreset.key` | Node label key to match. Ignored if `affinity` is set | `""` | +| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set | `[]` | +| `affinity` | Affinity for pod assignment | `{}` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `tolerations` | Tolerations for pod assignment | `[]` | +| `podLabels` | Extra labels for Kubewatch pods | `{}` | +| `podAnnotations` | Annotations for Kubewatch pods | `{}` | +| `extraVolumes` | Optionally specify extra list of additional volumes for Kubewatch pods | `[]` | +| `extraVolumeMounts` | Optionally specify extra list of additional volumeMounts for Kubewatch container(s) | `[]` | +| `initContainers` | Add additional init containers to the Kubewatch pods | `{}` | +| `sidecars` | Add additional sidecar containers to the Kubewatch pods | `{}` | +| `rbac.create` | Weather to create & use RBAC resources or not | `false` | +| `serviceAccount.create` | Enable the creation of a ServiceAccount for Kubewatch pods | `true` | +| `serviceAccount.name` | Name of the created ServiceAccount | `""` | +| `inventedArray` | Test parameter to check arrays | `["a","b"]` | +| `arrayModifier` | Test parameter for modifier array | `[]` | +| `configuration` | haproxy configuration | `""` | +| `jobs[0].nameOverride` | String to partially override jobs.names.fullname | `""` | +| `jobs[0].fullnameOverride` | String to fully override jobs.names.fullname | `""` | +| `jobs[0].resources.limits` | The resources limits override for the Job | `{}` | +| `jobs[0].newOption.subArray[0].object` | Test object inside Arrat | `a` | +| `jobs[0].newOption.subArray[0].plainArray` | Test nested arrays | `["b"]` | +| `jobs[0].newOption.subArray[0].threeLevelsArray[0].c` | Test 3 levels array | `d` | +| `jobs[0].newOption.subArray[0].emptyObject` | Empty object | `{}` | +| `extraTest` | An object that we want to document even though it is not at the end of the YAML tree | | +| `extraTest.content` | Content of the object | `whatever` | +| `forceSchemaArrayModifier` | The parameter should appear completely into the schema but with the modifier value into the README | `[]` | +| `linkInDescription` | Link with square brackets present in description. [More information here](#deployment-parameters). | `{}` | +| `nullable` | Nullable parameter | `nil` | +| `nullableNullStringWithValueChange` | Nullable null string. We apply string modifier that will change the type and value, but the schema will show `nullable: true`. | `""` | +| `nullableNullArray` | Nullable null array. We apply array modifier that will change the type in the schema plus `nullable: true`. | `nil` | +| `nullableNullString` | Nullable null string. We apply string modifier to avoid infering an object type. The null must be preverved as value. | `nil` | +| `nullableNotNull` | Nullable parameter with a non null value | `somestring` | +| `nullableObject` | Nullable parameter with an object value | `{}` | +| `nullableArray` | Nullable parameter with an array value | `[]` | +| `arrayEmptyModifier` | Test empty array modifier | `[]` | +| `annotations.prometheus.io/scrape` | A Prometheus annotation | `true` | +| `weird.key.with.weird.format/and.object` | A weird key with weird format and an object inside. | `asValue` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +helm install my-release bitnami/kubewatch \ + --set=slack.channel="#bots",slack.token="XXXX-XXXX-XXXX" +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +helm install my-release -f values.yaml bitnami/kubewatch +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Configuration and installation details + +### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/) + +It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image. + +Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist. + +### Create a Slack bot + +Open [https://my.slack.com/services/new/bot](https://my.slack.com/services/new/bot) to create a new Slack bot. +The API token can be found on the edit page (it starts with `xoxb-`). + +Invite the Bot to your channel by typing `/join @name_of_your_bot` in the Slack message area. + +### Adding extra environment variables + +In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the `extraEnvVars` property. + +```yaml +extraEnvVars: + - name: LOG_LEVEL + value: DEBUG +``` + +Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the `extraEnvVarsCM` or the `extraEnvVarsSecret` values. + +### Sidecars and Init Containers + +If you have a need for additional containers to run within the same pod as the Kubewatch app (e.g. an additional metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec. + +```yaml +sidecars: + - name: your-image-name + image: your-image + imagePullPolicy: Always + ports: + - name: portname + containerPort: 1234 +``` + +Similarly, you can add extra init containers using the `initContainers` parameter. + +```yaml +initContainers: + - name: your-image-name + image: your-image + imagePullPolicy: Always + ports: + - name: portname + containerPort: 1234 +``` + +### Deploying extra resources + +There are cases where you may want to deploy extra objects, such a ConfigMap containing your app's configuration or some extra deployment with a micro service used by your app. For covering this case, the chart allows adding the full specification of other objects using the `extraDeploy` parameter. + +### Setting Pod's affinity + +This chart allows you to set your custom affinity using the `affinity` parameter. Find more information about Pod's affinity in the [kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity). + +As an alternative, you can use of the preset configurations for pod affinity, pod anti-affinity, and node affinity available at the [bitnami/common](https://github.com/bitnami/charts/tree/master/bitnami/common#affinities) chart. To do so, set the `podAffinityPreset`, `podAntiAffinityPreset`, or `nodeAffinityPreset` parameters. + +## Troubleshooting + +Find more information about how to deal with common errors related to Bitnami’s Helm charts in [this troubleshooting guide](https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues). + +## Upgrading + +### To 3.0.0 + +- Chart labels were adapted to follow the [Helm charts standard labels](https://helm.sh/docs/chart_best_practices/labels/#standard-labels). +- This version also introduces `bitnami/common`, a [library chart](https://helm.sh/docs/topics/library_charts/#helm) as a dependency. More documentation about this new utility could be found [here](https://github.com/bitnami/charts/tree/master/bitnami/common#bitnami-common-library-chart). Please, make sure that you have updated the chart dependencies before executing any upgrade. + +Consequences: + +- Backwards compatibility is not guaranteed. To upgrade to `3.0.0`, install a new release of the Kubewatch chart. + +### To 2.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +#### What changes were introduced in this major version? + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +#### Considerations when upgrading to this version + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +#### Useful links + +- +- +- + +### To 1.0.0 + +Helm performs a lookup for the object based on its group (apps), version (v1), and kind (Deployment). Also known as its GroupVersionKind, or GVK. Changing the GVK is considered a compatibility breaker from Kubernetes' point of view, so you cannot "upgrade" those objects to the new GVK in-place. Earlier versions of Helm 3 did not perform the lookup correctly which has since been fixed to match the spec. + +In the `apiVersion` of the deployment resources was updated to `apps/v1` in tune with the api's deprecated, resulting in compatibility breakage. + +This major version signifies this change. diff --git a/tests/test-config.json b/tests/test-config.json new file mode 100644 index 0000000..808c690 --- /dev/null +++ b/tests/test-config.json @@ -0,0 +1,24 @@ +{ + "comments": { + "format": "##" + }, + "tags": { + "param": "@param", + "section": "@section", + "descriptionStart": "@descriptionStart", + "descriptionEnd": "@descriptionEnd", + "skip": "@skip", + "extra": "@extra" + }, + "modifiers": { + "array": "array", + "object": "object", + "string": "string", + "nullable": "nullable", + "default": "default" + }, + "regexp": { + "paramsSectionTitle": "New Parameters Section" + } + } + \ No newline at end of file diff --git a/tests/test-readme.config.md b/tests/test-readme.config.md new file mode 100644 index 0000000..acefad2 --- /dev/null +++ b/tests/test-readme.config.md @@ -0,0 +1,305 @@ +# kubewatch + +[kubewatch](https://github.com/bitnami-labs/kubewatch) is a Kubernetes watcher that currently publishes notification to Slack. Run it in your k8s cluster, and you will get event notifications in a slack channel. + +## TL;DR + +```console +helm repo add bitnami https://charts.bitnami.com/bitnami +helm install my-release bitnami/kubewatch +``` + +## Introduction + +This chart bootstraps a kubewatch deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.12+ +- Helm 3.1.0 + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```console +helm install my-release bitnami/kubewatch +``` + +The command deploys kubewatch on the Kubernetes cluster in the default configuration. The [Parameters](#new-parameters-section) section lists the parameters that can be configured during installation. + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## New Parameters Section + +### Global parameters + +| Name | Description | Value | +| ------------------------- | ----------------------------------------------- | ----- | +| `global.imageRegistry` | Global Docker image registry | `""` | +| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` | + +### Common parameters + +This section contains parameters common to most of the Helm Charts in the wild +as they are mainly auto-generated by initializing a new Helm Chart directory. + +It even supports multiple lines and [Link parsing](#common-parameters). + +| Name | Description | Value | +| ------------------- | -------------------------------------------------- | ----- | +| `nameOverride` | String to partially override common.names.fullname | `""` | +| `fullnameOverride` | String to fully override common.names.fullname | `""` | +| `commonLabels` | Labels to add to all deployed objects | `{}` | +| `commonAnnotations` | Annotations to add to all deployed objects | `{}` | +| `extraDeploy` | Array of extra objects to deploy with the release | `[]` | +| `hostAliases` | Add deployment host aliases | `[]` | + +### Kubewatch parameters + +This description starts in a new line instead of the same line of description start tag. It does not have multiple lines. + +| Name | Description | Value | +| ---------------------------------------- | --------------------------------------------------- | --------------------------- | +| `image.registry` | Kubewatch image registry | `REGISTRY_NAME` | +| `image.repository` | Kubewatch image name | `REPOSITORY_NAME/kubewatch` | +| `image.pullPolicy` | Kubewatch image pull policy | `IfNotPresent` | +| `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` | +| `slack.enabled` | Enable Slack notifications | `true` | +| `slack.channel` | Slack channel to notify | `XXXX` | +| `slack.token` | Slack API token | `XXXX` | +| `hipchat.enabled` | Enable HipChat notifications | `false` | +| `hipchat.room` | HipChat room to notify | `""` | +| `hipchat.token` | HipChat token | `""` | +| `hipchat.url` | HipChat URL | `""` | +| `mattermost.enabled` | Enable Mattermost notifications | `false` | +| `mattermost.channel` | Mattermost channel to notify | `""` | +| `mattermost.username` | Mattermost user to notify | `""` | +| `mattermost.url` | Mattermost URL | `""` | +| `flock.enabled` | Enable Flock notifications | `false` | +| `flock.url` | Flock URL | `""` | +| `msteams.enabled` | Enable Microsoft Teams notifications | `false` | +| `msteams.webhookurl` | Microsoft Teams webhook URL | `""` | +| `webhook` | Enable Webhook notifications | `{}` | +| `smtp.enabled` | Enable SMTP (email) notifications | `false` | +| `smtp.to` | Destination email address (required) | `""` | +| `smtp.from` | Source email address (required) | `""` | +| `smtp.hello` | SMTP hello field (optional) | `""` | +| `smtp.smarthost` | SMTP server address (name:port) (required) | `""` | +| `smtp.subject` | SMTP subject for the email | `""` | +| `smtp.requireTLS` | Force STARTTLS | `false` | +| `smtp.auth.username` | Username for LOGIN and PLAIN auth mech | `""` | +| `smtp.auth.password` | Password for LOGIN and PLAIN auth mech | `""` | +| `smtp.auth.secret` | Secret for CRAM-MD5 auth mech | `""` | +| `smtp.auth.identity` | Identity for PLAIN auth mech | `""` | +| `namespaceToWatch` | Namespace to watch, leave it empty for watching all | `""` | +| `resourcesToWatch.pod` | Watch changes to Pods | `true` | +| `resourcesToWatch.deployment` | Watch changes to Deployments | `true` | +| `resourcesToWatch.replicationcontroller` | Watch changes to ReplicationControllers | `false` | +| `resourcesToWatch.replicaset` | Watch changes to ReplicaSets | `false` | +| `resourcesToWatch.daemonset` | Watch changes to DaemonSets | `false` | +| `resourcesToWatch.services` | Watch changes to Services | `false` | +| `resourcesToWatch.job` | Watch changes to Jobs | `false` | +| `resourcesToWatch.persistentvolume` | Watch changes to PersistentVolumes | `false` | + +### Deployment parameters + +| Name | Description | Value | +| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------ | +| `command` | Override default container command (useful when using custom images) | `[]` | +| `args` | Override default container args (useful when using custom images) | `[]` | +| `extraEnvVars[0].name` | Name of the env var | `FOO` | +| `extraEnvVars[0].value` | Value for the env var | `bar` | +| `extraEnvVarsCM` | Name of existing ConfigMap containing extra env vars | `""` | +| `extraEnvVarsSecret` | Name of existing Secret containing extra env vars | `""` | +| `replicaCount` | Number of Kubewatch replicas to deploy | `1` | +| `podSecurityContext.enabled` | Enabled Kubewatch pods' Security Context | `false` | +| `podSecurityContext.fsGroup` | Set Kubewatch pod's Security Context fsGroup | `1001` | +| `containerSecurityContext.enabled` | Enabled Kubewatch containers' Security Context | `false` | +| `containerSecurityContext.runAsUser` | Set Kubewatch container's Security Context runAsUser | `1001` | +| `containerSecurityContext.runAsNonRoot` | Set Kubewatch container's Security Context runAsNonRoot | `true` | +| `livenessProbe.enabled` | Enable livenessProbe | `false` | +| `livenessProbe.initialDelaySeconds` | Initial delay seconds for livenessProbe | `10` | +| `livenessProbe.periodSeconds` | Period seconds for livenessProbe | `10` | +| `livenessProbe.timeoutSeconds` | Timeout seconds for livenessProbe | `1` | +| `livenessProbe.failureThreshold` | Failure threshold for livenessProbe | `3` | +| `livenessProbe.successThreshold` | Success threshold for livenessProbe | `1` | +| `readinessProbe.enabled` | Enable readinessProbe | `false` | +| `readinessProbe.initialDelaySeconds` | Initial delay seconds for readinessProbe | `10` | +| `readinessProbe.periodSeconds` | Period seconds for readinessProbe | `10` | +| `readinessProbe.timeoutSeconds` | Timeout seconds for readinessProbe | `1` | +| `readinessProbe.failureThreshold` | Failure threshold for readinessProbe | `3` | +| `readinessProbe.successThreshold` | Success threshold for readinessProbe | `1` | +| `customLivenessProbe` | Override default liveness probe | `{}` | +| `customReadinessProbe` | Override default readiness probe | `{}` | +| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` | +| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `nodeAffinityPreset.key` | Node label key to match. Ignored if `affinity` is set | `""` | +| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set | `[]` | +| `affinity` | Affinity for pod assignment | `{}` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `tolerations` | Tolerations for pod assignment | `[]` | +| `podLabels` | Extra labels for Kubewatch pods | `{}` | +| `podAnnotations` | Annotations for Kubewatch pods | `{}` | +| `extraVolumes` | Optionally specify extra list of additional volumes for Kubewatch pods | `[]` | +| `extraVolumeMounts` | Optionally specify extra list of additional volumeMounts for Kubewatch container(s) | `[]` | +| `initContainers` | Add additional init containers to the Kubewatch pods | `{}` | +| `sidecars` | Add additional sidecar containers to the Kubewatch pods | `{}` | +| `rbac.create` | Weather to create & use RBAC resources or not | `false` | +| `serviceAccount.create` | Enable the creation of a ServiceAccount for Kubewatch pods | `true` | +| `serviceAccount.name` | Name of the created ServiceAccount | `""` | +| `inventedArray` | Test parameter to check arrays | `["a","b"]` | +| `arrayModifier` | Test parameter for modifier array | `[]` | +| `configuration` | haproxy configuration | `""` | +| `jobs[0].nameOverride` | String to partially override jobs.names.fullname | `""` | +| `jobs[0].fullnameOverride` | String to fully override jobs.names.fullname | `""` | +| `jobs[0].resources.limits` | The resources limits override for the Job | `{}` | +| `jobs[0].newOption.subArray[0].object` | Test object inside Arrat | `a` | +| `jobs[0].newOption.subArray[0].plainArray` | Test nested arrays | `["b"]` | +| `jobs[0].newOption.subArray[0].threeLevelsArray[0].c` | Test 3 levels array | `d` | +| `jobs[0].newOption.subArray[0].emptyObject` | Empty object | `{}` | +| `extraTest` | An object that we want to document even though it is not at the end of the YAML tree | | +| `extraTest.content` | Content of the object | `whatever` | +| `forceSchemaArrayModifier` | The parameter should appear completely into the schema but with the modifier value into the README | `[]` | +| `linkInDescription` | Link with square brackets present in description. [More information here](#deployment-parameters). | `{}` | +| `nullable` | Nullable parameter | `nil` | +| `nullableNullStringWithValueChange` | Nullable null string. We apply string modifier that will change the type and value, but the schema will show `nullable: true`. | `""` | +| `nullableNullArray` | Nullable null array. We apply array modifier that will change the type in the schema plus `nullable: true`. | `nil` | +| `nullableNullString` | Nullable null string. We apply string modifier to avoid infering an object type. The null must be preverved as value. | `nil` | +| `nullableNotNull` | Nullable parameter with a non null value | `somestring` | +| `nullableObject` | Nullable parameter with an object value | `{}` | +| `nullableArray` | Nullable parameter with an array value | `[]` | +| `arrayEmptyModifier` | Test empty array modifier | `[]` | +| `annotations.prometheus.io/scrape` | A Prometheus annotation | `true` | +| `weird.key.with.weird.format/and.object` | A weird key with weird format and an object inside. | `asValue` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +helm install my-release bitnami/kubewatch \ + --set=slack.channel="#bots",slack.token="XXXX-XXXX-XXXX" +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +helm install my-release -f values.yaml bitnami/kubewatch +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Configuration and installation details + +### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/) + +It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image. + +Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist. + +### Create a Slack bot + +Open [https://my.slack.com/services/new/bot](https://my.slack.com/services/new/bot) to create a new Slack bot. +The API token can be found on the edit page (it starts with `xoxb-`). + +Invite the Bot to your channel by typing `/join @name_of_your_bot` in the Slack message area. + +### Adding extra environment variables + +In case you want to add extra environment variables (useful for advanced operations like custom init scripts), you can use the `extraEnvVars` property. + +```yaml +extraEnvVars: + - name: LOG_LEVEL + value: DEBUG +``` + +Alternatively, you can use a ConfigMap or a Secret with the environment variables. To do so, use the `extraEnvVarsCM` or the `extraEnvVarsSecret` values. + +### Sidecars and Init Containers + +If you have a need for additional containers to run within the same pod as the Kubewatch app (e.g. an additional metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec. + +```yaml +sidecars: + - name: your-image-name + image: your-image + imagePullPolicy: Always + ports: + - name: portname + containerPort: 1234 +``` + +Similarly, you can add extra init containers using the `initContainers` parameter. + +```yaml +initContainers: + - name: your-image-name + image: your-image + imagePullPolicy: Always + ports: + - name: portname + containerPort: 1234 +``` + +### Deploying extra resources + +There are cases where you may want to deploy extra objects, such a ConfigMap containing your app's configuration or some extra deployment with a micro service used by your app. For covering this case, the chart allows adding the full specification of other objects using the `extraDeploy` parameter. + +### Setting Pod's affinity + +This chart allows you to set your custom affinity using the `affinity` parameter. Find more information about Pod's affinity in the [kubernetes documentation](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity). + +As an alternative, you can use of the preset configurations for pod affinity, pod anti-affinity, and node affinity available at the [bitnami/common](https://github.com/bitnami/charts/tree/master/bitnami/common#affinities) chart. To do so, set the `podAffinityPreset`, `podAntiAffinityPreset`, or `nodeAffinityPreset` parameters. + +## Troubleshooting + +Find more information about how to deal with common errors related to Bitnami’s Helm charts in [this troubleshooting guide](https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues). + +## Upgrading + +### To 3.0.0 + +- Chart labels were adapted to follow the [Helm charts standard labels](https://helm.sh/docs/chart_best_practices/labels/#standard-labels). +- This version also introduces `bitnami/common`, a [library chart](https://helm.sh/docs/topics/library_charts/#helm) as a dependency. More documentation about this new utility could be found [here](https://github.com/bitnami/charts/tree/master/bitnami/common#bitnami-common-library-chart). Please, make sure that you have updated the chart dependencies before executing any upgrade. + +Consequences: + +- Backwards compatibility is not guaranteed. To upgrade to `3.0.0`, install a new release of the Kubewatch chart. + +### To 2.0.0 + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +#### What changes were introduced in this major version? + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +#### Considerations when upgrading to this version + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +#### Useful links + +- +- +- + +### To 1.0.0 + +Helm performs a lookup for the object based on its group (apps), version (v1), and kind (Deployment). Also known as its GroupVersionKind, or GVK. Changing the GVK is considered a compatibility breaker from Kubernetes' point of view, so you cannot "upgrade" those objects to the new GVK in-place. Earlier versions of Helm 3 did not perform the lookup correctly which has since been fixed to match the spec. + +In the `apiVersion` of the deployment resources was updated to `apps/v1` in tune with the api's deprecated, resulting in compatibility breakage. + +This major version signifies this change.