Skip to content

Commit 6d93b13

Browse files
idanl21pkoutsovasilisswiatekmebeahan
authored
Add autoops chart (#9363)
* init * added all env vriabels * added es_pass and username as an option and added autoops to values.schema.json * Update deploy/helm/elastic-agent/values.schema.json Co-authored-by: Panos Koutsovasilis <[email protected]> * fix scheme * run mage helm:updateAgentVersion helm:renderExamples * adde to CODEOWNERS * add contidions to shecma * change schema * fix schema * add exmaples to values file * add exmaples to values file * added example * run mage runderExamples * run mage runderExamples * run mage runderExamples * run mage runderExamples * fix values naming * Update deploy/helm/elastic-agent/templates/integrations/_auto_ops/_auto_ops.tpl Co-authored-by: Panos Koutsovasilis <[email protected]> * Update deploy/helm/elastic-agent/templates/integrations/_auto_ops/_auto_ops.tpl Co-authored-by: Panos Koutsovasilis <[email protected]> * Update deploy/helm/elastic-agent/templates/integrations/_auto_ops/secret.yaml Co-authored-by: Panos Koutsovasilis <[email protected]> * fix: update manifest.yaml of autoops-agent * Clear default values for autoops * added changelog * Update changelog/fragments/1762856188-added-opex-to-elastic-agent-helm-chart.yaml Co-authored-by: Eric Beahan <[email protected]> * Update changelog/fragments/1762856188-added-opex-to-elastic-agent-helm-chart.yaml Co-authored-by: Eric Beahan <[email protected]> * Delete docs/release-notes/_snippets/0.1.0.asciidoc * Delete changelog/0.1.0.yaml * remove unnecessary docs --------- Co-authored-by: Panos Koutsovasilis <[email protected]> Co-authored-by: Panos Koutsovasilis <[email protected]> Co-authored-by: Mikołaj Świątek <[email protected]> Co-authored-by: Eric Beahan <[email protected]> Co-authored-by: Eric Beahan <[email protected]>
1 parent 22c123c commit 6d93b13

File tree

10 files changed

+567
-4
lines changed

10 files changed

+567
-4
lines changed

.github/CODEOWNERS

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ changelog/fragments/
3030
/internal/pkg/otel/samples @elastic/ingest-otel-data @elastic/ingest-docs
3131
/internal/pkg/otel/components.yml @elastic/ingest-otel-leads
3232
/internal/pkg/composable/providers/kubernetes @elastic/elastic-agent-control-plane
33-
/internal/pkg/otel/samples/darwin/autoops_es*.yml @elastic/opex
34-
/internal/pkg/otel/samples/linux/autoops_es*.yml @elastic/opex
35-
/internal/pkg/otel/samples/windows/autoops_es*.yml @elastic/opex
33+
/internal/pkg/otel/samples/darwin/autoops_es.yml @elastic/opex
34+
/internal/pkg/otel/samples/linux/autoops_es.yml @elastic/opex
35+
/internal/pkg/otel/samples/windows/autoops_es.yml @elastic/opex
36+
/deploy/helm/elastic-agent/templates/integrations/_auto_ops @elastic.opex
37+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# REQUIRED
2+
# Kind can be one of:
3+
# - breaking-change: a change to previously-documented behavior
4+
# - deprecation: functionality that is being removed in a later release
5+
# - bug-fix: fixes a problem in a previous version
6+
# - enhancement: extends functionality but does not break or fix existing behavior
7+
# - feature: new functionality
8+
# - known-issue: problems that we are aware of in a given version
9+
# - security: impacts on the security of a product or a user’s deployment.
10+
# - upgrade: important information for someone upgrading from a prior version
11+
# - other: does not fit into any of the other categories
12+
kind: feature
13+
14+
# REQUIRED for all kinds
15+
# Change summary; a 80ish characters long description of the change.
16+
summary: added opex to elastic-agent helm chart, This change will add the Opex-CCM support to the offical elastic-agent helm chart deployment.
17+
18+
# REQUIRED for breaking-change, deprecation, known-issue
19+
# Long description; in case the summary is not enough to describe the change
20+
# this field accommodate a description without length limits.
21+
# description:
22+
23+
# REQUIRED for breaking-change, deprecation, known-issue
24+
# impact:
25+
26+
# REQUIRED for breaking-change, deprecation, known-issue
27+
# action:
28+
29+
# REQUIRED for all kinds
30+
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc.
31+
component: elastic-agent
32+
33+
# AUTOMATED
34+
# OPTIONAL to manually add other PR URLs
35+
# PR URL: A link the PR that added the changeset.
36+
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added.
37+
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number.
38+
# Please provide it if you are adding a fragment for a different PR.
39+
pr: https://github.com/elastic/elastic-agent/pull/9363
40+
41+
# AUTOMATED
42+
# OPTIONAL to manually add other issue URLs
43+
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of).
44+
# If not present is automatically filled by the tooling with the issue linked to the PR number.
45+
# issue: https://github.com/owner/repo/1234
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Example: Managed by Opex Agent
2+
3+
In this example we deploy an Elastic AutoOps Agent that is managed by Opex team .
4+
5+
6+
## Run:
7+
8+
There are 2 kinds of installations, related to auth method
9+
10+
### for API_KEY installation
11+
12+
```console
13+
helm install ./deploy/helm/elastic-agent -n kube-system \
14+
--set kube-state-metrics.enabled=false \
15+
--set kubernetes.enabled=false \
16+
--set autoOps.enabled=true \
17+
--set-string autoOps.autoops_token="tok-123" \
18+
--set-string autoOps.autoops_otel_url="https://otel.example.com:4318" \
19+
--set-string autoOps.autoops_temp_resource_id="res-abc" \
20+
--set-string autoOps.es_api_key="API_KEY_123"
21+
```
22+
23+
### for Username:password (Basic auth) installation
24+
25+
```console
26+
helm install ./deploy/helm/elastic-agent -n kube-system \
27+
--set kube-state-metrics.enabled=false \
28+
--set kubernetes.enabled=false \
29+
--set autoOps.enabled=true \
30+
--set-string autoOps.autoops_token="tok-123" \
31+
--set-string autoOps.autoops_otel_url="https://otel.example.com:4318" \
32+
--set-string autoOps.autoops_temp_resource_id="res-abc" \
33+
--set-string autoOps.es_username="elastic" \
34+
--set-string autoOps.es_username="es_pass"
35+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Turn off everything except the AutoOps preset
2+
kubernetes:
3+
enabled: false
4+
kube-state-metrics:
5+
enabled: false
6+
7+
autoOps:
8+
enabled: true
9+
autoops_token: "REPLACE_ME_TOKEN"
10+
autoops_otel_url: "https://otel.example.com:4318"
11+
autoops_temp_resource_id: "REPLACE_ME_RESOURCE_ID"
12+
es_api_key: "REPLACE_ME_API_KEY"
13+
elastic_cloud_connected_mode_api_key: "CCM-API-KEY"
14+
elastic_cloud_connected_mode_api_url: "CCM-API-URL"
15+
autoops_es_url: "https://ccm-test-eu-west-1.es.us-east-2.aws.elastic-cloud.com"
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
---
2+
# Source: elastic-agent/templates/agent/service-account.yaml
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: agent-autoops-example
7+
namespace: "default"
8+
labels:
9+
helm.sh/chart: elastic-agent-9.3.0-beta
10+
app.kubernetes.io/name: elastic-agent
11+
app.kubernetes.io/instance: example
12+
app.kubernetes.io/version: 9.3.0
13+
---
14+
# Source: elastic-agent/templates/agent/k8s/secret.yaml
15+
apiVersion: v1
16+
kind: Secret
17+
metadata:
18+
name: agent-autoops-example
19+
namespace: "default"
20+
labels:
21+
helm.sh/chart: elastic-agent-9.3.0-beta
22+
app.kubernetes.io/name: elastic-agent
23+
app.kubernetes.io/instance: example
24+
app.kubernetes.io/version: 9.3.0
25+
stringData:
26+
27+
agent.yml: |-
28+
exporters:
29+
otlphttp:
30+
endpoint: ${env:AUTOOPS_OTEL_URL}
31+
headers:
32+
Authorization: AutoOpsToken ${env:AUTOOPS_TOKEN}
33+
receivers:
34+
metricbeatreceiver:
35+
metricbeat:
36+
modules:
37+
- hosts: ${env:AUTOOPS_ES_URL}
38+
metricsets:
39+
- cat_shards
40+
- cluster_health
41+
- cluster_settings
42+
- license
43+
- node_stats
44+
- tasks_management
45+
module: autoops_es
46+
period: 10s
47+
- hosts: ${env:AUTOOPS_ES_URL}
48+
metricsets:
49+
- cat_template
50+
- component_template
51+
- index_template
52+
module: autoops_es
53+
period: 24h
54+
output:
55+
otelconsumer: null
56+
processors:
57+
- add_fields:
58+
fields:
59+
temp_resource_id: ${env:AUTOOPS_TEMP_RESOURCE_ID}
60+
token: ${env:AUTOOPS_TOKEN}
61+
target: autoops_es
62+
telemetry_types:
63+
- logs
64+
service:
65+
pipelines:
66+
logs:
67+
exporters:
68+
- otlphttp
69+
receivers:
70+
- metricbeatreceiver
71+
telemetry:
72+
logs:
73+
encoding: json
74+
---
75+
# Source: elastic-agent/templates/integrations/_auto_ops/secret.yaml
76+
apiVersion: v1
77+
kind: Secret
78+
metadata:
79+
name: agent-autoops-example-autoops
80+
namespace: "default"
81+
labels:
82+
helm.sh/chart: elastic-agent-9.3.0-beta
83+
app.kubernetes.io/name: elastic-agent
84+
app.kubernetes.io/instance: example
85+
app.kubernetes.io/version: 9.3.0
86+
stringData:
87+
autoops-token: "REPLACE_ME_TOKEN"
88+
autoops-es-url: "https://ccm-test-eu-west-1.es.us-east-2.aws.elastic-cloud.com"
89+
temp-resource-id: "REPLACE_ME_RESOURCE_ID"
90+
otel-url: "https://otel.example.com:4318"
91+
es-api-key: "REPLACE_ME_API_KEY"
92+
cloud-connected-mode-api-key: "CCM-API-KEY"
93+
cloud-connected-mode-api-url: "CCM-API-URL"
94+
---
95+
# Source: elastic-agent/templates/agent/k8s/deployment.yaml
96+
apiVersion: apps/v1
97+
kind: Deployment
98+
metadata:
99+
name: agent-autoops-example
100+
namespace: "default"
101+
labels:
102+
helm.sh/chart: elastic-agent-9.3.0-beta
103+
app.kubernetes.io/name: elastic-agent
104+
app.kubernetes.io/instance: example
105+
app.kubernetes.io/version: 9.3.0
106+
spec:
107+
selector:
108+
matchLabels:
109+
name: agent-autoops-example
110+
template:
111+
metadata:
112+
labels:
113+
name: agent-autoops-example
114+
annotations:
115+
checksum/config: e89ad87aab4abdf0b266914a815ddd71744340acbec3678f63b018cfe85334df
116+
spec:
117+
automountServiceAccountToken: true
118+
containers:
119+
- args:
120+
- otel
121+
- --config
122+
- /etc/elastic-agent/agent.yml
123+
command:
124+
- elastic-agent
125+
env:
126+
- name: NODE_NAME
127+
valueFrom:
128+
fieldRef:
129+
fieldPath: spec.nodeName
130+
- name: POD_NAME
131+
valueFrom:
132+
fieldRef:
133+
fieldPath: metadata.name
134+
- name: STATE_PATH
135+
value: /usr/share/elastic-agent/state
136+
- name: AUTOOPS_TOKEN
137+
valueFrom:
138+
secretKeyRef:
139+
key: autoops-token
140+
name: agent-autoops-example-autoops
141+
- name: AUTOOPS_TEMP_RESOURCE_ID
142+
valueFrom:
143+
secretKeyRef:
144+
key: temp-resource-id
145+
name: agent-autoops-example-autoops
146+
- name: AUTOOPS_OTEL_URL
147+
valueFrom:
148+
secretKeyRef:
149+
key: otel-url
150+
name: agent-autoops-example-autoops
151+
- name: AUTOOPS_ES_URL
152+
valueFrom:
153+
secretKeyRef:
154+
key: autoops-es-url
155+
name: agent-autoops-example-autoops
156+
- name: ELASTICSEARCH_READ_API_KEY
157+
valueFrom:
158+
secretKeyRef:
159+
key: es-api-key
160+
name: agent-autoops-example-autoops
161+
- name: ELASTIC_CLOUD_CONNECTED_MODE_API_KEY
162+
valueFrom:
163+
secretKeyRef:
164+
key: cloud-connected-mode-api-key
165+
name: agent-autoops-example-autoops
166+
- name: ELASTIC_CLOUD_CONNECTED_MODE_API_URL
167+
valueFrom:
168+
secretKeyRef:
169+
key: cloud-connected-mode-api-url
170+
name: agent-autoops-example-autoops
171+
optional: true
172+
image: docker.elastic.co/elastic-agent/elastic-agent:9.3.0-SNAPSHOT
173+
imagePullPolicy: IfNotPresent
174+
name: agent
175+
securityContext:
176+
runAsUser: 0
177+
volumeMounts:
178+
- mountPath: /usr/share/elastic-agent/state
179+
name: agent-data
180+
- mountPath: /etc/elastic-agent/agent.yml
181+
name: config
182+
readOnly: true
183+
subPath: agent.yml
184+
dnsPolicy: ClusterFirstWithHostNet
185+
nodeSelector:
186+
kubernetes.io/os: linux
187+
serviceAccountName: agent-autoops-example
188+
volumes:
189+
- emptyDir: {}
190+
name: agent-data
191+
- name: config
192+
secret:
193+
defaultMode: 292
194+
secretName: agent-autoops-example

deploy/helm/elastic-agent/templates/agent/_helpers.tpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Initialise input templates if we are not deploying as managed
8989
as they change the k8s configuration of presets e.g. necessary volume mounts, etc. */}}
9090
{{- include "elasticagent.kubernetes.init" $ -}}
9191
{{- include "elasticagent.system.init" $ -}}
92+
{{- include "elasticagent.autoops.init" $ -}}
9293
{{/* initialise inputs the custom integrations only if fleet is disabled */}}
9394
{{- if eq $.Values.agent.fleet.enabled false -}}
9495
{{- range $customInputName, $customInputVal := $.Values.extraIntegrations -}}
@@ -351,7 +352,7 @@ app.kubernetes.io/version: {{ .Values.agent.version}}
351352
{{- $presetVal := index . 1 -}}
352353
{{- $otelConfigVal := index . 2 -}}
353354
{{- $presetOtelConfig := dig "otelConfig" (dict) $presetVal -}}
354-
{{- $presetOtelConfig = uniq (deepCopy $presetOtelConfig | merge $otelConfigVal) -}}
355+
{{- $presetOtelConfig = (deepCopy $presetOtelConfig | merge $otelConfigVal) -}}
355356
{{- $_ := set $presetVal "otelConfig" $presetOtelConfig -}}
356357
{{- end -}}
357358

0 commit comments

Comments
 (0)