From 901f4d07b753fd562023400ab2d972184df1a30f Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sat, 2 May 2020 14:17:00 -0700 Subject: [PATCH] Auto generate chart readme file Signed-off-by: Tamal Saha --- Makefile | 17 ++++++++- charts/stash-mongodb/README.md | 61 ++++++++++++++++---------------- charts/stash-mongodb/doc.yaml | 19 ++++++++++ charts/stash-mongodb/values.yaml | 8 +++++ 4 files changed, 73 insertions(+), 32 deletions(-) create mode 100644 charts/stash-mongodb/doc.yaml diff --git a/Makefile b/Makefile index f2b0d59ed..5e6e17847 100644 --- a/Makefile +++ b/Makefile @@ -263,8 +263,23 @@ gen-values-schema: @yq r api/crds/installer.stash.appscode.com_stashmongodbs.yaml spec.validation.openAPIV3Schema.properties.spec > /tmp/stash-mongodb-values.openapiv3_schema.yaml @yq d /tmp/stash-mongodb-values.openapiv3_schema.yaml description > charts/stash-mongodb/values.openapiv3_schema.yaml +.PHONY: gen-chart-doc +gen-chart-doc: gen-chart-doc-stash-mongodb + +gen-chart-doc-%: + @echo "Generate $* chart docs" + @docker run --rm \ + -u $$(id -u):$$(id -g) \ + -v /tmp:/.cache \ + -v $$(pwd):$(DOCKER_REPO_ROOT) \ + -w $(DOCKER_REPO_ROOT) \ + --env HTTP_PROXY=$(HTTP_PROXY) \ + --env HTTPS_PROXY=$(HTTPS_PROXY) \ + $(BUILD_IMAGE) \ + chart-doc-gen -d ./charts/$*/doc.yaml -v ./charts/$*/values.yaml > ./charts/$*/README.md + .PHONY: manifests -manifests: gen-crds patch-crds label-crds gen-bindata gen-values-schema +manifests: gen-crds patch-crds label-crds gen-bindata gen-values-schema gen-chart-doc .PHONY: gen gen: clientset gen-crd-protos manifests openapi diff --git a/charts/stash-mongodb/README.md b/charts/stash-mongodb/README.md index bdfb03acb..b9825e998 100644 --- a/charts/stash-mongodb/README.md +++ b/charts/stash-mongodb/README.md @@ -1,18 +1,18 @@ # stash-mongodb -[stash-mongodb](https://github.com/stashed/stash-mongodb) - MongoDB database backup/restore plugin for [Stash by AppsCode](https://appscode.com/products/stash/). +[stash-mongodb](https://github.com/stashed/mongodb) - MongoDB database backup/restore plugin for [Stash by AppsCode](https://stash.run) ## TL;DR; ```console -helm repo add appscode https://charts.appscode.com/stable/ -helm repo update -helm install stash-mongodb-4.0.5 appscode/stash-mongodb -n kube-system --version=4.0.5 +$ helm repo add appscode https://charts.appscode.com/stable/ +$ helm repo update +$ helm install stash-mongodb-4.0.5 appscode/stash-mongodb -n kube-system --version=4.0.5 ``` ## Introduction -This chart installs necessary `Function` and `Task` definition to backup or restore MongoDB database 4.0.5 using Stash. +This chart deploys necessary `Function` and `Task` definition to backup or restore MongoDB database 4.0.5 using Stash on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. ## Prerequisites @@ -20,32 +20,22 @@ This chart installs necessary `Function` and `Task` definition to backup or rest ## Installing the Chart -- Add AppsCode chart repository to your helm repository list, +To install the chart with the release name `stash-mongodb-4.0.5`: ```console -helm repo add appscode https://charts.appscode.com/stable/ +$ helm install stash-mongodb-4.0.5 appscode/stash-mongodb -n kube-system --version=4.0.5 ``` -- Update helm repositories to fetch latest charts from the remove repository, +The command deploys necessary `Function` and `Task` definition to backup or restore MongoDB database 4.0.5 using Stash on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. -```console -helm repo update -``` - -- Install the chart with the release name `stash-mongodb-4.0.5` run the following command, - -```console -helm install stash-mongodb-4.0.5 appscode/stash-mongodb -n kube-system --version=4.0.5 -``` - -The above commands installs `Functions` and `Task` crds that are necessary to backup MongoDB database 4.0.5 using Stash. +> **Tip**: List all releases using `helm list` ## Uninstalling the Chart -To uninstall/delete the `stash-mongodb-4.0.5` run the following command, +To uninstall/delete the `stash-mongodb-4.0.5`: ```console -helm uninstall stash-mongodb-4.0.5 -n kube-system +$ helm delete stash-mongodb-4.0.5 -n kube-system ``` The command removes all the Kubernetes components associated with the chart and deletes the release. @@ -54,18 +44,27 @@ The command removes all the Kubernetes components associated with the chart and The following table lists the configurable parameters of the `stash-mongodb` chart and their default values. -| Parameter | Description | Default | -| ------------------ | ----------------------------------------------------------------------------------------------------------------------------- | --------------- | -| `image.registry` | Docker registry used to pull respective images | `stashed` | -| `image.repository` | Docker image used to backup/restore MongoDB database | `stash-mongodb` | -| `image.tag` | Tag of the image that is used to backup/restore MongoDB database. This is usually same as the database version it can backup. | `4.0.5` | -| `backup.args` | Optional arguments to pass to `mongodump` command during bakcup process | | -| `restore.args` | Optional arguments to pass to `mongorestore` command during restore process | | +| Parameter | Description | Default | +|------------------|-------------------------------------------------------------------------------------------------------------------------------|-----------------| +| nameOverride | Overrides name template | `""` | +| fullnameOverride | Overrides fullname template | `""` | +| image.registry | Docker registry used to pull MongoDB addon image | `stashed` | +| image.repository | Docker image used to backup/restore MongoDB database | `stash-mongodb` | +| image.tag | Tag of the image that is used to backup/restore MongoDB database. This is usually same as the database version it can backup. | `"4.0.5"` | +| backup.args | Arguments to pass to `mongodump` command during bakcup process | `""` | +| restore.args | Arguments to pass to `mongorestore` command during restore process | `""` | +| maxConcurrency | Maximum concurrency to perform backup or restore tasks | `3` | + + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example: -Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. +```console +$ helm install stash-mongodb-4.0.5 appscode/stash-mongodb -n kube-system --version=4.0.5 --set image.registry=stashed +``` -For example: +Alternatively, a YAML file that specifies the values for the parameters can be provided while +installing the chart. For example: ```console -helm install stash-mongodb-4.0.5 appscode/stash-mongodb -n kube-system --set docker.registry=my-registry +$ helm install stash-mongodb-4.0.5 appscode/stash-mongodb -n kube-system --version=4.0.5 --values values.yaml ``` diff --git a/charts/stash-mongodb/doc.yaml b/charts/stash-mongodb/doc.yaml new file mode 100644 index 000000000..f9c7876a1 --- /dev/null +++ b/charts/stash-mongodb/doc.yaml @@ -0,0 +1,19 @@ +project: + name: stash-mongodb + shortName: stash-mongodb + url: https://github.com/stashed/mongodb + description: "MongoDB database backup/restore plugin for [Stash by AppsCode](https://stash.run)" + app: "necessary `Function` and `Task` definition to backup or restore MongoDB database 4.0.5 using Stash" +repository: + url: https://charts.appscode.com/stable/ + name: appscode +chart: + name: stash-mongodb + version: "4.0.5" + values: "-- generate from values file --" + valuesExample: "-- generate from values file --" +prerequisites: +- Kubernetes 1.11+ +release: + name: stash-mongodb-4.0.5 + namespace: kube-system diff --git a/charts/stash-mongodb/values.yaml b/charts/stash-mongodb/values.yaml index 5374c9791..350d3b549 100644 --- a/charts/stash-mongodb/values.yaml +++ b/charts/stash-mongodb/values.yaml @@ -2,18 +2,26 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +# Overrides name template nameOverride: "" +# Overrides fullname template fullnameOverride: "" image: + # Docker registry used to pull MongoDB addon image registry: stashed + # Docker image used to backup/restore MongoDB database repository: stash-mongodb + # Tag of the image that is used to backup/restore MongoDB database. + # This is usually same as the database version it can backup. tag: "4.0.5" # optional argument to send mongodump or mongorestore command backup: + # Arguments to pass to `mongodump` command during bakcup process args: "" restore: + # Arguments to pass to `mongorestore` command during restore process args: "" # Maximum concurrency to perform backup or restore tasks