Skip to content

Commit

Permalink
[Helm] Implement values.schema.json (#5535)
Browse files Browse the repository at this point in the history
* feat: implement values.schema.json for elastic-agent helm chart

* fix: update rendered examples to latest elastic-agent version

* feat: split ESPlainAuth into ESPlainAuthBasic and ESPlainAuthAPI for better validation

* fix: omit redundant keys for ESSecretAuthBasic and ESSecretAuthAPI

* fix: update output type in TestKubernetesAgentHelm according to new values.schema.json
  • Loading branch information
pkoutsovasilis authored Sep 20, 2024
1 parent fc6ed90 commit 5c24129
Show file tree
Hide file tree
Showing 14 changed files with 1,261 additions and 184 deletions.
22 changes: 12 additions & 10 deletions deploy/helm/elastic-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,30 @@ The outputs section specifies where to send data. You can specify multiple outpu

### 1.1 - Output Object
The supported types of outputs are:
- `ESPlainAuth`: `elasticsearch` output with the connection details specified inline the yaml
- `ESPlainAuthBasic`: `elasticsearch` output with the connection details (url, username, password) specified inline the yaml
- `ESPlainAuthAPI`: `elasticsearch` output with the connection details (url, api_key) specified inline the yaml
- `ESSecretAuthBasic`: `elasticsearch` output with the connection details specified in a k8s secret
- `ESSecretAuthAPI`: `elasticsearch` output with the connection details specified in a k8s secret
- `ESECKRef`: `elasticsearch` output that references by name an Elasticsearch cluster managed by ECK operator

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| outputs.{name}.type | string | `"ESPlainAuth"` | type of the output [one of `ESPlainAuth`, `ESSecretAuthBasic`, `ESSecretAuthAPI`, `ESECKRef`] |
| outputs.{name}.url | string | `""` | url of the output [required for type `ESPlainAuth`] |
| outputs.{name}.username | string | `""` | the username to use to authenticate with the output [required for type `ESPlainAuth` if `api_key` is not set] |
| outputs.{name}.password | string | `""` | the password to use to authenticate with the output [required for type `ESPlainAuth` if `api_key` is not set] |
| outputs.{name}.api_key | string | `""` | the API key use to authenticate with the output [required for type `ESPlainAuth` if `username` and `password` are not set] |
| outputs.{name}.type | string | `"ESPlainAuthBasic"` | type of the output [one of `ESPlainAuthBasic`, `ESPlainAuthAPI`, `ESSecretAuthBasic`, `ESSecretAuthAPI`, `ESECKRef`] |
| outputs.{name}.url | string | `""` | url of the output [required for types `ESPlainAuthBasic` and `ESPlainAuthAPI`] |
| outputs.{name}.username | string | `""` | the username to use to authenticate with the output [required for type `ESPlainAuthBasic`] |
| outputs.{name}.password | string | `""` | the password to use to authenticate with the output [required for type `ESPlainAuthBasic`] |
| outputs.{name}.api_key | string | `""` | the API key use to authenticate with the output [required for type `ESPlainAuthAPI`] |
| outputs.{name}.secretName | string | `""` | the k8s secret to mount output connection details [required for types `ESSecretAuthBasic` and `ESSecretAuthAPI`] |
| outputs.{name}.name | string | `""` | name to reference an Elasticsearch cluster managed by ECK [required for type `ESECKRef`] |
| outputs.{name}.namespace | string | `""` | namespace to reference an Elasticsearch cluster managed by ECK [optional for type `ESECKRef`] |
Examples of Helm chart arguments to define an output with name `myOutput`:
- `ESPlainAuth`: `--set outputs.myOutput.url=https://elasticsearch:9200 --set outputs.myOutput.api_key=token`
- `ESPlainAuthBasic`: `--set outputs.myOutput.url=https://elasticsearch:9200 --set outputs.myOutput.username=changeme --set outputs.myOutput.password=changeme`
- `ESPlainAuthAPI`: `--set outputs.myOutput.url=https://elasticsearch:9200 --set outputs.myOutput.api_key=token`
- `ESSecretAuthBasic`: `--set outputs.myOutput.type=ESSecretAuthBasic --set outputs.myOutput.secretName=k8s_secret_name` (required keys in the k8s secret are `url`, `username`, `password`)
- `ESSecretAuthAPI`: `--set outputs.myOutput.type=ESSecretAuthAPI --set outputs.myOutput.secretName=k8s_secret_name` (required keys in the k8s secret are `url`, `api_key`)
- `ESECKRef`: `--set outputs.myOutput.type=ESECKRef --set outputs.myOutput.name=eck_es_cluster_name`

For `ESPlainAuth`, `ESSecretAuthBasic`, `ESSecretAuthAPI` extra fields can be specified inline the yaml following these guidelines (`ESECKRef` doesn't support them):
For `ESPlainAuthBasic`, `ESPlainAuthAPI` `ESSecretAuthBasic`, `ESSecretAuthAPI` extra fields can be specified inline the yaml following these guidelines (`ESECKRef` doesn't support them):
- ["Data parsing, filtering, and manipulation settings"](`https://www.elastic.co/guide/en/fleet/current/elasticsearch-output.html#output-elasticsearch-data-parsing-settings`)
- ["Performance tuning settings"](https://www.elastic.co/guide/en/fleet/current/elasticsearch-output.html#output-elasticsearch-performance-tuning-settings)
- ["Memory queue settings"](https://www.elastic.co/guide/en/fleet/current/elasticsearch-output.html#output-elasticsearch-memory-queue-settings)
Expand Down Expand Up @@ -129,8 +131,8 @@ The chart built-in [kubernetes integration](https://docs.elastic.co/integrations
### 3 - Elastic-Agent Configuration
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| agent.version | string | `"8.15.0"` | elastic-agent version |
| agent.image | object | `{"pullPolicy":"IfNotPresent","repository":"docker.elastic.co/beats/elastic-agent-complete","tag":""}` | image configuration |
| agent.version | string | `"9.0.0"` | elastic-agent version |
| agent.image | object | `{"pullPolicy":"IfNotPresent","repository":"docker.elastic.co/beats/elastic-agent","tag":"9.0.0-SNAPSHOT"}` | image configuration |
| agent.engine | string | `"k8s"` | generate kubernetes manifests or [ECK](https://github.com/elastic/cloud-on-k8s) CRDs |
| agent.unprivileged | bool | `false` | enable unprivileged mode |
| agent.presets | map[string]{} | `{ "perNode" : {...}, "clusterWider": {...}, "ksmShared": {...} }` | Map of deployment presets for the Elastic Agent. The key of the map is the name of the preset. See more for the presets required by the built-in Kubernetes integration [here](./values.yaml) |
Expand Down
8 changes: 5 additions & 3 deletions deploy/helm/elastic-agent/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,22 @@ The outputs section specifies where to send data. You can specify multiple outpu

{{ define "section.description.OutputObject.PreTable" }}
The supported types of outputs are:
- `ESPlainAuth`: `elasticsearch` output with the connection details specified inline the yaml
- `ESPlainAuthBasic`: `elasticsearch` output with the connection details (url, username, password) specified inline the yaml
- `ESPlainAuthAPI`: `elasticsearch` output with the connection details (url, api_key) specified inline the yaml
- `ESSecretAuthBasic`: `elasticsearch` output with the connection details specified in a k8s secret
- `ESSecretAuthAPI`: `elasticsearch` output with the connection details specified in a k8s secret
- `ESECKRef`: `elasticsearch` output that references by name an Elasticsearch cluster managed by ECK operator
{{ end }}

{{ define "section.description.OutputObject.PostTable" }}
Examples of Helm chart arguments to define an output with name `myOutput`:
- `ESPlainAuth`: `--set outputs.myOutput.url=https://elasticsearch:9200 --set outputs.myOutput.api_key=token`
- `ESPlainAuthBasic`: `--set outputs.myOutput.url=https://elasticsearch:9200 --set outputs.myOutput.username=changeme --set outputs.myOutput.password=changeme`
- `ESPlainAuthAPI`: `--set outputs.myOutput.url=https://elasticsearch:9200 --set outputs.myOutput.api_key=token`
- `ESSecretAuthBasic`: `--set outputs.myOutput.type=ESSecretAuthBasic --set outputs.myOutput.secretName=k8s_secret_name` (required keys in the k8s secret are `url`, `username`, `password`)
- `ESSecretAuthAPI`: `--set outputs.myOutput.type=ESSecretAuthAPI --set outputs.myOutput.secretName=k8s_secret_name` (required keys in the k8s secret are `url`, `api_key`)
- `ESECKRef`: `--set outputs.myOutput.type=ESECKRef --set outputs.myOutput.name=eck_es_cluster_name`

For `ESPlainAuth`, `ESSecretAuthBasic`, `ESSecretAuthAPI` extra fields can be specified inline the yaml following these guidelines (`ESECKRef` doesn't support them):
For `ESPlainAuthBasic`, `ESPlainAuthAPI` `ESSecretAuthBasic`, `ESSecretAuthAPI` extra fields can be specified inline the yaml following these guidelines (`ESECKRef` doesn't support them):
- ["Data parsing, filtering, and manipulation settings"](`https://www.elastic.co/guide/en/fleet/current/elasticsearch-output.html#output-elasticsearch-data-parsing-settings`)
- ["Performance tuning settings"](https://www.elastic.co/guide/en/fleet/current/elasticsearch-output.html#output-elasticsearch-performance-tuning-settings)
- ["Memory queue settings"](https://www.elastic.co/guide/en/fleet/current/elasticsearch-output.html#output-elasticsearch-memory-queue-settings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ stringData:
id: agent-clusterwide-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -117,13 +113,9 @@ stringData:
id: agent-ksmsharded-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -415,13 +407,9 @@ stringData:
id: agent-pernode-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -1100,7 +1088,7 @@ spec:
labels:
name: agent-pernode-example
annotations:
checksum/config: 445f37bb37be6c09d10658d6172b60937ad2eabb8b2caa491c02e319e32c3e2f
checksum/config: 1880bff2efcb86e1b6cc442b0804132a46df0bb93ceae4af8cd42b44964e53c6

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down Expand Up @@ -1220,7 +1208,7 @@ spec:
labels:
name: agent-clusterwide-example
annotations:
checksum/config: 07ad466a99831af1ca298d124df038347a662dbd2bb3e9e9f34d459e59b5ac22
checksum/config: 73527b0aad319ef33239ef3c862820c5ee5cafb42e2ce164049646791b69ec68

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down Expand Up @@ -1301,7 +1289,7 @@ spec:
labels:
name: agent-ksmsharded-example
annotations:
checksum/config: 25c0797d499503c38495e5319cafa8b6f233bc3777c06465748f79c47a826a52
checksum/config: 4ec2b2ef4d3c5c103e79e47a45d4b3b4f9f774e85293f9a5b2d56556025f1d2d

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ stringData:
id: agent-clusterwide-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -117,13 +113,9 @@ stringData:
id: agent-ksmsharded-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -415,13 +407,9 @@ stringData:
id: agent-pernode-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -1102,7 +1090,7 @@ spec:
labels:
name: agent-pernode-example
annotations:
checksum/config: f7d9ba588a1d1f957b809397f07b93e2c1bbcc812d9067887d4e009085c26873
checksum/config: f81171bdf0eed2d3bc8492050be0e6763188e3731e5cfc2b675f6ad8810c6fb7

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down Expand Up @@ -1247,7 +1235,7 @@ spec:
labels:
name: agent-clusterwide-example
annotations:
checksum/config: 07ad466a99831af1ca298d124df038347a662dbd2bb3e9e9f34d459e59b5ac22
checksum/config: 73527b0aad319ef33239ef3c862820c5ee5cafb42e2ce164049646791b69ec68

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down Expand Up @@ -1328,7 +1316,7 @@ spec:
labels:
name: agent-ksmsharded-example
annotations:
checksum/config: 25c0797d499503c38495e5319cafa8b6f233bc3777c06465748f79c47a826a52
checksum/config: 4ec2b2ef4d3c5c103e79e47a45d4b3b4f9f774e85293f9a5b2d56556025f1d2d

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ stringData:
id: agent-pernode-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -230,7 +226,7 @@ spec:
labels:
name: agent-pernode-example
annotations:
checksum/config: a7c974ba2737eab9abbfb69369c7652546ffbab54b4cb3e4942b083c72323b95
checksum/config: e4f00459bc975f20e15a69d830b8df6c1998190072d515e0c08cf5b51dd5bbc1

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ stringData:
id: agent-clusterwide-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -143,13 +139,9 @@ stringData:
id: agent-ksmsharded-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -441,13 +433,9 @@ stringData:
id: agent-pernode-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -1128,7 +1116,7 @@ spec:
labels:
name: agent-pernode-example
annotations:
checksum/config: f7d9ba588a1d1f957b809397f07b93e2c1bbcc812d9067887d4e009085c26873
checksum/config: f81171bdf0eed2d3bc8492050be0e6763188e3731e5cfc2b675f6ad8810c6fb7

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down Expand Up @@ -1263,7 +1251,7 @@ spec:
labels:
name: agent-clusterwide-example
annotations:
checksum/config: 48eef4bd335130eb2b974f2a4f9abbb2221519e8e75a96285c69bb9828d9e768
checksum/config: b04d7965af8739293cd90e352c59d1240473f56febd9aded16ba766d77f90b5f

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down Expand Up @@ -1334,7 +1322,7 @@ spec:
labels:
name: agent-ksmsharded-example
annotations:
checksum/config: 25c0797d499503c38495e5319cafa8b6f233bc3777c06465748f79c47a826a52
checksum/config: 4ec2b2ef4d3c5c103e79e47a45d4b3b4f9f774e85293f9a5b2d56556025f1d2d

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ stringData:
id: agent-nginx-example
outputs:
default:
api_key: ""
hosts:
- http://elasticsearch:9200
name: ""
namespace: ""
password: changeme
secretName: ""
type: elasticsearch
username: elastic
secret_references: []
Expand Down Expand Up @@ -219,7 +215,7 @@ spec:
labels:
name: agent-nginx-example
annotations:
checksum/config: 5b03a8c53bfa79596ff47efff33dd02b851f81b1bdbe1581b5a485eefe26103a
checksum/config: 4b3a03273d11151ee0f8bbdc8e235f8b6d2b344e09dedc632ae6f7f9e8e0ef34

spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down
Loading

0 comments on commit 5c24129

Please sign in to comment.