From d389a1975a419fd2044cffde24dac2b7f7f7255d Mon Sep 17 00:00:00 2001 From: odubajDT <93584209+odubajDT@users.noreply.github.com> Date: Mon, 24 Apr 2023 22:01:09 +0200 Subject: [PATCH] ci: introduce workflow for helm documentation validation (#454) Signed-off-by: odubajDT Signed-off-by: odubajDT <93584209+odubajDT@users.noreply.github.com> Co-authored-by: Giovanni Liva --- .github/scripts/generate-helm-docs.sh | 30 ++++++ .github/workflows/validate-helm-docs.yml | 51 ++++++++++ README.md | 4 + chart/open-feature-operator/README.md | 96 +++++++++---------- .../helm-docs-config.json | 22 +++++ chart/open-feature-operator/values.yaml | 38 ++++++++ 6 files changed, 193 insertions(+), 48 deletions(-) create mode 100755 .github/scripts/generate-helm-docs.sh create mode 100644 .github/workflows/validate-helm-docs.yml create mode 100644 chart/open-feature-operator/helm-docs-config.json diff --git a/.github/scripts/generate-helm-docs.sh b/.github/scripts/generate-helm-docs.sh new file mode 100755 index 000000000..f675bcc5a --- /dev/null +++ b/.github/scripts/generate-helm-docs.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Readme generator for OpenFeature Operator Helm Chart +# +# This script will install the readme generator if it's not installed already +# and then it will generate the README.md file from the local Helm values +# +# Dependencies: +# Node >=16 + +# renovate: datasource=github-releases depName=bitnami-labs/readme-generator-for-helm +GENERATOR_VERSION="2.5.0" + +echo "Checking if readme generator is installed already..." +if [[ $(npm list -g | grep -c "readme-generator-for-helm@${GENERATOR_VERSION}") -eq 0 ]]; then + echo "Readme Generator v${GENERATOR_VERSION} not installed, installing now..." + git clone https://github.com/bitnami-labs/readme-generator-for-helm.git + cd ./readme-generator-for-helm || exit + git checkout ${GENERATOR_VERSION} + npm ci + cd .. + npm install -g ./readme-generator-for-helm +else + echo "Readme Generator is already installed, continuing..." +fi + +echo "Generating readme now..." +readme-generator --config $(pwd)/chart/open-feature-operator/helm-docs-config.json --values=./chart/open-feature-operator/values.yaml --readme=./chart/open-feature-operator/README.md + +# Please be aware, the readme file needs to exist and needs to have a Parameters section, as only this section will be re-generated diff --git a/.github/workflows/validate-helm-docs.yml b/.github/workflows/validate-helm-docs.yml new file mode 100644 index 000000000..a08212ff5 --- /dev/null +++ b/.github/workflows/validate-helm-docs.yml @@ -0,0 +1,51 @@ +name: Validate Helm Docs +on: + pull_request: + branches: + - 'main' + paths: + - 'chart/**' +defaults: + run: + shell: bash +jobs: + check-helm-docs: + name: Check helm documentation values + runs-on: ubuntu-22.04 + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node + uses: actions/setup-node@v3.6.0 + with: + node-version: 16 + + - name: Generate helm charts + env: + RELEASE_REGISTRY: ghcr.io/openfeature + run: make helm-package + + - name: Install readme generator + run: | + git clone https://github.com/bitnami-labs/readme-generator-for-helm.git + cd ./readme-generator-for-helm + npm ci + npm install --location=global ./ + cd .. + + - name: Check Helm doc up to date + run: | + cd ./chart/open-feature-operator/ + cp ./README.md ./README-old.md + readme-generator --config $(pwd)/helm-docs-config.json --values=./values.yaml --readme=./README.md + if ! cmp --quiet ./README-old.md ./README.md; then + echo "The Helm values have changes that are not reflected in the readme. Please use ./.github/scripts/generate-helm-docs.sh to re-generate the docs." + echo "" + echo "=========== Diff ===========" + diff -u ./README-old.md ./README.md + exit 1 + else + echo "" + echo "Helm values documentation is correct!" + fi diff --git a/README.md b/README.md index a8564409c..8fdf38278 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ The OpenFeature Operator allows you to expose feature flags to your applications

Try the OpenFeature Operator in the Killercoda Playground (in browser)

+## Changelog + +See [CHANGELOG.md](https://github.com/open-feature/open-feature-operator/blob/main/CHANGELOG.md) + ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to the OpenFeature project. diff --git a/chart/open-feature-operator/README.md b/chart/open-feature-operator/README.md index 79b0ba48d..529879e8b 100644 --- a/chart/open-feature-operator/README.md +++ b/chart/open-feature-operator/README.md @@ -29,7 +29,7 @@ helm repo update helm upgrade --install open-feature-operator openfeature/open-feature-operator ``` -This installation will use the default helm configuration, described in the [configuration section](#configuration) +This installation will use the default helm configuration, described in the [Configuration section](#configuration) To overwrite these default values use the `--set` flag when calling `helm upgrade` or `helm install`, for example: ``` @@ -84,56 +84,56 @@ The command removes all the Kubernetes components associated with the chart and ## Configuration - +### Global + +| Name | Description | Value | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------ | +| `defaultNamespace` | To override the namespace use the `--namespace` flag. This default is provided to ensure that the kustomize build charts in `/templates` deploy correctly when no `namespace` is provided via the `-n` flag. | `open-feature-operator-system` | ### Sidecar configuration -| Value | Default | Explanation | -| ------------------------------------------ | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `sidecarConfiguration.envVarPrefix` | `FLAGD` | Sets the prefix for all environment variables set in the injected sidecar. | -| `sidecarConfiguration.port` | 8013 | Sets the value of the `XXX_PORT` environment variable for the injected sidecar container. | -| `sidecarConfiguration.metricsPort` | 8014 | Sets the value of the `XXX_METRICS_PORT` environment variable for the injected sidecar container. | -| `sidecarConfiguration.socketPath` | `""` | Sets the value of the `XXX_SOCKET_PATH` environment variable for the injected sidecar container. | -| `sidecarConfiguration.image.repository` | `ghcr.io/open-feature/flagd` | Sets the image for the injected sidecar container. | -| `sidecarConfiguration.image.tag` | current flagd version: `v0.5.2` | Sets the version tag for the injected sidecar container. | -| `sidecarConfiguration.providerArgs` | `""` | Used to append arguments to the sidecar startup command. This value is a comma separated string of key values separated by '=', e.g. `key=value,key2=value2` results in the appending of `--sync-provider-args key=value --sync-provider-args key2=value2` | -| `sidecarConfiguration.defaultSyncProvider` | `kubernetes` | Sets the value of the `XXX_SYNC_PROVIDER` environment variable for the injected sidecar container. There are 3 valid sync providers: `kubernetes`, `filepath` and `http` | -| `sidecarConfiguration.logFormat` | `json` | Sets the value of the `XXX_LOG_FORMAT` environment variable for the injected sidecar container. There are 2 valid log formats: `json` and `console` | -| `sidecarConfiguration.evaluator` | `json` | Sets the value of the `XXX_EVALUATOR` environment variable for the injected sidecar container. | -| `sidecarConfiguration.probesEnabled` | `true` | Enable or Disable Liveness and Readiness probes of the flagd sidecar. When enabled, HTTP probes( paths - `/readyz`, `/healthz`) are set with an initial delay of 5 seconds | +| Name | Description | Value | +| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | +| `sidecarConfiguration.port` | Sets the value of the `XXX_PORT` environment variable for the injected sidecar. | `8013` | +| `sidecarConfiguration.metricsPort` | Sets the value of the `XXX_METRICS_PORT` environment variable for the injected sidecar. | `8014` | +| `sidecarConfiguration.socketPath` | Sets the value of the `XXX_SOCKET_PATH` environment variable for the injected sidecar. | `""` | +| `sidecarConfiguration.image.repository` | Sets the image for the injected sidecar. | `ghcr.io/open-feature/flagd` | +| `sidecarConfiguration.image.tag` | Sets the version tag for the injected sidecar. | `v0.5.2` | +| `sidecarConfiguration.providerArgs` | Used to append arguments to the sidecar startup command. This value is a comma separated string of key values separated by '=', e.g. `key=value,key2=value2` results in the appending of `--sync-provider-args key=value --sync-provider-args key2=value2`. | `""` | +| `sidecarConfiguration.envVarPrefix` | Sets the prefix for all environment variables set in the injected sidecar. | `FLAGD` | +| `sidecarConfiguration.defaultSyncProvider` | Sets the value of the `XXX_SYNC_PROVIDER` environment variable for the injected sidecar container. There are 3 valid sync providers: `kubernetes`, `filepath` and `http`. | `kubernetes` | +| `sidecarConfiguration.evaluator` | Sets the value of the `XXX_EVALUATOR` environment variable for the injected sidecar container. | `json` | +| `sidecarConfiguration.logFormat` | Sets the value of the `XXX_LOG_FORMAT` environment variable for the injected sidecar container. There are 2 valid log formats: `json` and `console`. | `json` | +| `sidecarConfiguration.probesEnabled` | Enable or Disable Liveness and Readiness probes of the flagd sidecar. When enabled, HTTP probes( paths - `/readyz`, `/healthz`) are set with an initial delay of 5 seconds. | `true` | +| `sidecarConfiguration.debugLogging` | Controls the addition of the `--debug` flag to the container startup arguments. | `false` | + +### Flagd-proxy configuration + +| Name | Description | Value | +| ------------------------------------------ | ------------------------------------------------------------------------------- | ---------------------------------- | +| `flagdProxyConfiguration.port` | Sets the port to expose the sync API on. | `8015` | +| `flagdProxyConfiguration.metricsPort` | Sets the port to expose the metrics API on. | `8016` | +| `flagdProxyConfiguration.image.repository` | Sets the image for the flagd-proxy deployment. | `ghcr.io/open-feature/flagd-proxy` | +| `flagdProxyConfiguration.image.tag` | Sets the tag for the flagd-proxy deployment. | `v0.2.2` | +| `flagdProxyConfiguration.debugLogging` | Controls the addition of the `--debug` flag to the container startup arguments. | `false` | ### Operator resource configuration -| Value | Default | Explanation | -| ----------------------------------------------------------- | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `defaultNamespace` | `open-feature-operator` | [INTERNAL USE ONLY] To override the namespace use the `--namespace` flag. This default is provided to ensure that the kustomize build charts in `/templates` deploy correctly when no `namespace` is provided via the `-n` flag. | -| `controllerManager.kubeRbacProxy.image.repository` | `gcr.io/kubebuilder/kube-rbac-proxy` | | -| `controllerManager.kubeRbacProxy.image.tag` | `v0.13.1` | | -| `controllerManager.kubeRbacProxy.resources.limits.cpu` | `500m` | | -| `controllerManager.kubeRbacProxy.resources.limits.memory` | `128Mi` | | -| `controllerManager.kubeRbacProxy.resources.requests.cpu` | `5m` | | -| `controllerManager.kubeRbacProxy.resources.requests.memory` | `64Mi` | | -| `controllerManager.manager.image.repository` | `ghcr.io/open-feature/open-feature-operator` | | -| `controllerManager.manager.image.tag` | `v0.2.34` | | -| `controllerManager.manager.resources.limits.cpu` | `500m` | | -| `controllerManager.manager.resources.limits.memory` | `128Mi` | | -| `controllerManager.manager.resources.requests.cpu` | `10m` | | -| `controllerManager.manager.resources.requests.memory` | `64Mi` | | -| `managerConfig.controllerManagerConfigYaml` | `1` | | -| `managerConfig.replicas.health.healthProbeBindAddress` | `:8081` | | -| `managerConfig.replicas.metrics.bindAddress` | `127.0.0.1:8080` | | -| `managerConfig.replicas.webhook.port` | `9443` | | - -### flagd-proxy Configuration - -| Value | Default | Explanation | -| -------------------------------------------------- | -------------------------------------------- |---------------------------------------------------------------------------------- | -| `flagdProxyConfiguration.port` | `8015` | Sets the port to expose the sync API on | -| `flagdProxyConfiguration.metricsPort` | `8016` | Sets the port to expose the metrics API on | -| `flagdProxyConfiguration.image.repository` | `ghcr.io/open-feature/flagd-proxy` | Sets the image for the flagd-proxy deployment | -| `flagdProxyConfiguration.image.tag` | current flagd-proxy version: `v0.2.2` | Sets the tag for the flagd-proxy deployment | -| `flagdProxyConfiguration.debugLogging` | `false` | Controls the addition of the `--debug` flag to the container startup arguments | - -## Changelog - -See [CHANGELOG.md](https://github.com/open-feature/open-feature-operator/blob/main/CHANGELOG.md) +| Name | Description | Value | +| ------------------------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------- | +| `controllerManager.kubeRbacProxy.image.repository` | Sets the image for the kube-rbac-proxy. | `gcr.io/kubebuilder/kube-rbac-proxy` | +| `controllerManager.kubeRbacProxy.image.tag` | Sets the version tag for the kube-rbac-proxy. | `v0.14.0` | +| `controllerManager.kubeRbacProxy.resources.limits.cpu` | Sets cpu resource limits for kube-rbac-proxy. | `500m` | +| `controllerManager.kubeRbacProxy.resources.limits.memory` | Sets memory resource limits for kube-rbac-proxy. | `128Mi` | +| `controllerManager.kubeRbacProxy.resources.requests.cpu` | Sets cpu resource requests for kube-rbac-proxy. | `5m` | +| `controllerManager.kubeRbacProxy.resources.requests.memory` | Sets memory resource requests for kube-rbac-proxy. | `64Mi` | +| `controllerManager.manager.image.repository` | Sets the image for the operator. | `ghcr.io/open-feature/open-feature-operator` | +| `controllerManager.manager.image.tag` | Sets the version tag for the operator. | `v0.2.34` | +| `controllerManager.manager.resources.limits.cpu` | Sets cpu resource limits for operator. | `500m` | +| `controllerManager.manager.resources.limits.memory` | Sets memory resource limits for operator. | `128Mi` | +| `controllerManager.manager.resources.requests.cpu` | Sets cpu resource requests for operator. | `10m` | +| `controllerManager.manager.resources.requests.memory` | Sets memory resource requests for operator. | `64Mi` | +| `controllerManager.replicas` | Sets number of replicas of the OpenFeature operator pod. | `1` | +| `managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress` | Sets the bind address for health probes. | `:8081` | +| `managerConfig.controllerManagerConfigYaml.metrics.bindAddress` | Sets the bind address for metrics. | `127.0.0.1:8080` | +| `managerConfig.controllerManagerConfigYaml.webhook.port` | Sets the bind address for webhook. | `9443` | diff --git a/chart/open-feature-operator/helm-docs-config.json b/chart/open-feature-operator/helm-docs-config.json new file mode 100644 index 000000000..a8a77c2e4 --- /dev/null +++ b/chart/open-feature-operator/helm-docs-config.json @@ -0,0 +1,22 @@ +{ + "comments": { + "format": "##" + }, + "tags": { + "param": "@param", + "section": "@section", + "descriptionStart": "@descriptionStart", + "descriptionEnd": "@descriptionEnd", + "skip": "@skip", + "extra": "@extra" + }, + "modifiers": { + "array": "array", + "object": "object", + "string": "string", + "nullable": "nullable" + }, + "regexp": { + "paramsSectionTitle": "Configuration" + } +} diff --git a/chart/open-feature-operator/values.yaml b/chart/open-feature-operator/values.yaml index aba1e7672..405ee98af 100644 --- a/chart/open-feature-operator/values.yaml +++ b/chart/open-feature-operator/values.yaml @@ -1,60 +1,98 @@ # If this namespace is changed the value must be reflected in /open-feature-operator/values.yaml +## @section Global +## @param defaultNamespace To override the namespace use the `--namespace` flag. This default is provided to ensure that the kustomize build charts in `/templates` deploy correctly when no `namespace` is provided via the `-n` flag. defaultNamespace: open-feature-operator-system +## @section Sidecar configuration sidecarConfiguration: + ## @param sidecarConfiguration.port Sets the value of the `XXX_PORT` environment variable for the injected sidecar. port: 8013 + ## @param sidecarConfiguration.metricsPort Sets the value of the `XXX_METRICS_PORT` environment variable for the injected sidecar. metricsPort: 8014 + ## @param sidecarConfiguration.socketPath Sets the value of the `XXX_SOCKET_PATH` environment variable for the injected sidecar. socketPath: "" image: # these fields must remain in the same order, renovate uses a regex to update the tag value + ## @param sidecarConfiguration.image.repository Sets the image for the injected sidecar. repository: "ghcr.io/open-feature/flagd" + ## @param sidecarConfiguration.image.tag Sets the version tag for the injected sidecar. tag: v0.5.2 + ## @param sidecarConfiguration.providerArgs Used to append arguments to the sidecar startup command. This value is a comma separated string of key values separated by '=', e.g. `key=value,key2=value2` results in the appending of `--sync-provider-args key=value --sync-provider-args key2=value2`. providerArgs: "" + ## @param sidecarConfiguration.envVarPrefix Sets the prefix for all environment variables set in the injected sidecar. envVarPrefix: "FLAGD" + ## @param sidecarConfiguration.defaultSyncProvider Sets the value of the `XXX_SYNC_PROVIDER` environment variable for the injected sidecar container. There are 3 valid sync providers: `kubernetes`, `filepath` and `http`. defaultSyncProvider: kubernetes + ## @param sidecarConfiguration.evaluator Sets the value of the `XXX_EVALUATOR` environment variable for the injected sidecar container. evaluator: json + ## @param sidecarConfiguration.logFormat Sets the value of the `XXX_LOG_FORMAT` environment variable for the injected sidecar container. There are 2 valid log formats: `json` and `console`. logFormat: "json" + ## @param sidecarConfiguration.probesEnabled Enable or Disable Liveness and Readiness probes of the flagd sidecar. When enabled, HTTP probes( paths - `/readyz`, `/healthz`) are set with an initial delay of 5 seconds. probesEnabled: true + ## @param sidecarConfiguration.debugLogging Controls the addition of the `--debug` flag to the container startup arguments. debugLogging: false +## @section Flagd-proxy configuration flagdProxyConfiguration: + ## @param flagdProxyConfiguration.port Sets the port to expose the sync API on. port: 8015 + ## @param flagdProxyConfiguration.metricsPort Sets the port to expose the metrics API on. metricsPort: 8016 image: + ## @param flagdProxyConfiguration.image.repository Sets the image for the flagd-proxy deployment. repository: "ghcr.io/open-feature/flagd-proxy" + ## @param flagdProxyConfiguration.image.tag Sets the tag for the flagd-proxy deployment. tag: v0.2.2 + ## @param flagdProxyConfiguration.debugLogging Controls the addition of the `--debug` flag to the container startup arguments. debugLogging: false +## @section Operator resource configuration controllerManager: kubeRbacProxy: image: + ## @param controllerManager.kubeRbacProxy.image.repository Sets the image for the kube-rbac-proxy. repository: gcr.io/kubebuilder/kube-rbac-proxy + ## @param controllerManager.kubeRbacProxy.image.tag Sets the version tag for the kube-rbac-proxy. tag: "v0.14.0" resources: limits: + ## @param controllerManager.kubeRbacProxy.resources.limits.cpu Sets cpu resource limits for kube-rbac-proxy. cpu: 500m + ## @param controllerManager.kubeRbacProxy.resources.limits.memory Sets memory resource limits for kube-rbac-proxy. memory: 128Mi requests: + ## @param controllerManager.kubeRbacProxy.resources.requests.cpu Sets cpu resource requests for kube-rbac-proxy. cpu: 5m + ## @param controllerManager.kubeRbacProxy.resources.requests.memory Sets memory resource requests for kube-rbac-proxy. memory: 64Mi manager: image: + ## @param controllerManager.manager.image.repository Sets the image for the operator. repository: ghcr.io/open-feature/open-feature-operator + ## @param controllerManager.manager.image.tag Sets the version tag for the operator. tag: v0.2.34 # x-release-please-version resources: limits: + ## @param controllerManager.manager.resources.limits.cpu Sets cpu resource limits for operator. cpu: 500m + ## @param controllerManager.manager.resources.limits.memory Sets memory resource limits for operator. memory: 128Mi requests: + ## @param controllerManager.manager.resources.requests.cpu Sets cpu resource requests for operator. cpu: 10m + ## @param controllerManager.manager.resources.requests.memory Sets memory resource requests for operator. memory: 64Mi + ## @param controllerManager.replicas Sets number of replicas of the OpenFeature operator pod. replicas: 1 managerConfig: controllerManagerConfigYaml: health: + ## @param managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress Sets the bind address for health probes. healthProbeBindAddress: :8081 metrics: + ## @param managerConfig.controllerManagerConfigYaml.metrics.bindAddress Sets the bind address for metrics. bindAddress: 127.0.0.1:8080 webhook: + ## @param managerConfig.controllerManagerConfigYaml.webhook.port Sets the bind address for webhook. port: 9443